update isl for change in coalescing
[barvinok.git] / polysign.c
blob247537ee740a3fbdd7c4add8470e423194a326a3
1 #include <assert.h>
2 #include <barvinok/options.h>
3 #include <barvinok/util.h>
4 #include "polysign.h"
5 #include "config.h"
7 #ifndef HAVE_LIBGLPK
8 enum order_sign glpk_polyhedron_affine_sign(Polyhedron *D, Matrix *T,
9 struct barvinok_options *options)
11 assert(0);
14 enum lp_result glpk_constraints_opt(Matrix *C, Value *obj, Value denom,
15 enum lp_dir dir, Value *opt)
17 assert(0);
19 #endif
21 #ifndef HAVE_LIBCDDGMP
22 enum order_sign cdd_polyhedron_affine_sign(Polyhedron *D, Matrix *T,
23 struct barvinok_options *options)
25 assert(0);
28 enum order_sign cddf_polyhedron_affine_sign(Polyhedron *D, Matrix *T,
29 struct barvinok_options *options)
31 assert(0);
34 enum lp_result cdd_constraints_opt(Matrix *C, Value *obj, Value denom,
35 enum lp_dir dir, Value *opt)
37 assert(0);
40 enum lp_result cddf_constraints_opt(Matrix *C, Value *obj, Value denom,
41 enum lp_dir dir, Value *opt)
43 assert(0);
45 #endif
47 enum order_sign polyhedron_affine_sign(Polyhedron *D, Matrix *T,
48 struct barvinok_options *options)
50 if (options->lp_solver == BV_LP_POLYLIB)
51 return PL_polyhedron_affine_sign(D, T, options);
52 else if (options->lp_solver == BV_LP_GLPK)
53 return glpk_polyhedron_affine_sign(D, T, options);
54 else if (options->lp_solver == BV_LP_CDD)
55 return cdd_polyhedron_affine_sign(D, T, options);
56 else if (options->lp_solver == BV_LP_CDDF)
57 return cddf_polyhedron_affine_sign(D, T, options);
58 else if (options->lp_solver == BV_LP_ISL)
59 return isl_polyhedron_affine_sign(D, T, options);
60 else
61 assert(0);
65 * Optimize (minimize or maximize depending on dir) the affine
66 * objective function obj (of length dimension+1), with denominator
67 * denom over the polyhedron specified by the constraints C.
68 * The result is returned in opt.
70 enum lp_result constraints_opt(Matrix *C, Value *obj, Value denom,
71 enum lp_dir dir, Value *opt,
72 struct barvinok_options *options)
74 if (options->lp_solver == BV_LP_POLYLIB)
75 return PL_constraints_opt(C, obj, denom, dir, opt, options->MaxRays);
76 else if (options->lp_solver == BV_LP_GLPK)
77 return glpk_constraints_opt(C, obj, denom, dir, opt);
78 else if (options->lp_solver == BV_LP_CDD)
79 return cdd_constraints_opt(C, obj, denom, dir, opt);
80 else if (options->lp_solver == BV_LP_CDDF)
81 return cddf_constraints_opt(C, obj, denom, dir, opt);
82 else if (options->lp_solver == BV_LP_ISL)
83 return isl_constraints_opt(C, obj, denom, dir, opt);
84 else
85 assert(0);
89 * Optimize (minimize or maximize depending on dir) the affine
90 * objective function obj (of length dimension+1), with denominator
91 * denom over the polyhedron specified by P.
92 * The result is returned in opt.
94 enum lp_result polyhedron_opt(Polyhedron *P, Value *obj, Value denom,
95 enum lp_dir dir, Value *opt,
96 struct barvinok_options *options)
98 if (options->lp_solver == BV_LP_POLYLIB)
99 return PL_polyhedron_opt(P, obj, denom, dir, opt);
100 else {
101 Matrix M;
102 Polyhedron_Matrix_View(P, &M, P->NbConstraints);
103 return constraints_opt(&M, obj, denom, dir, opt, options);