3 #include "isl_piplib.h"
4 #include "isl_map_piplib.h"
6 enum isl_lp_result
isl_pip_solve_lp(struct isl_basic_map
*bmap
, int maximize
,
7 isl_int
*f
, isl_int denom
, isl_int
*opt
,
10 enum isl_lp_result res
= isl_lp_ok
;
11 PipMatrix
*domain
= NULL
;
16 total
= isl_basic_map_total_dim(bmap
);
17 domain
= isl_basic_map_to_pip(bmap
, 0, 1, 0);
20 entier_set_si(domain
->p
[0][1], -1);
21 isl_int_set(domain
->p
[0][domain
->NbColumns
- 1], f
[0]);
22 isl_seq_cpy_to_pip(domain
->p
[0]+2, f
+1, total
);
24 options
= pip_options_init();
27 options
->Urs_unknowns
= -1;
28 options
->Maximize
= maximize
;
30 sol
= pip_solve(domain
, NULL
, -1, options
);
31 pip_options_free(options
);
37 else if (entier_zero_p(sol
->list
->vector
->the_deno
[0]))
38 res
= isl_lp_unbounded
;
41 isl_seq_cpy_from_pip(opt
,
42 &sol
->list
->vector
->the_vector
[0], 1);
43 isl_seq_cpy_from_pip(opt_denom
,
44 &sol
->list
->vector
->the_deno
[0], 1);
46 mpz_fdiv_q(*opt
, sol
->list
->vector
->the_vector
[0],
47 sol
->list
->vector
->the_deno
[0]);
49 mpz_cdiv_q(*opt
, sol
->list
->vector
->the_vector
[0],
50 sol
->list
->vector
->the_deno
[0]);
52 pip_matrix_free(domain
);
57 pip_matrix_free(domain
);