3 #include "isl_lp_piplib.h"
5 #include "isl_map_private.h"
7 enum isl_lp_result
isl_tab_solve_lp(struct isl_basic_map
*bmap
, int maximize
,
8 isl_int
*f
, isl_int denom
, isl_int
*opt
,
12 enum isl_lp_result res
;
13 unsigned dim
= isl_basic_map_total_dim(bmap
);
16 isl_seq_neg(f
, f
, 1 + dim
);
18 bmap
= isl_basic_map_gauss(bmap
, NULL
);
19 tab
= isl_tab_from_basic_map(bmap
);
20 res
= isl_tab_min(bmap
->ctx
, tab
, f
, bmap
->ctx
->one
, opt
, opt_denom
);
21 isl_tab_free(bmap
->ctx
, tab
);
24 isl_seq_neg(f
, f
, 1 + dim
);
29 /* Given a basic map "bmap" and an affine combination of the variables "f"
30 * with denominator "denom", set *opt/*opt_denom to the minimal
31 * (or maximal if "maximize" is true) value attained by f/d over "bmap",
32 * assuming the basic map is not empty and the expression cannot attain
33 * arbitrarily small (or large) values.
34 * If opt_denom is NULL, then *opt is rounded up (or down)
35 * to the nearest integer.
36 * The return value reflects the nature of the result (empty, unbounded,
37 * minmimal or maximal value returned in *opt).
39 enum isl_lp_result
isl_solve_lp(struct isl_basic_map
*bmap
, int maximize
,
40 isl_int
*f
, isl_int d
, isl_int
*opt
,
46 switch (bmap
->ctx
->lp_solver
) {
48 return isl_pip_solve_lp(bmap
, maximize
, f
, d
, opt
, opt_denom
);
50 return isl_tab_solve_lp(bmap
, maximize
, f
, d
, opt
, opt_denom
);