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)
9 enum isl_lp_result res = isl_lp_ok;
10 PipMatrix *domain = NULL;
15 total = bmap->nparam + bmap->n_in + bmap->n_out + bmap->n_div;
16 domain = isl_basic_map_to_pip(bmap, 0, 1, 0);
19 entier_set_si(domain->p[0][1], -1);
20 isl_seq_cpy_to_pip(domain->p[0]+2, f, total);
22 options = pip_options_init();
25 options->Urs_unknowns = -1;
26 options->Maximize = maximize;
28 sol = pip_solve(domain, NULL, -1, options);
29 pip_options_free(options);
35 else if (entier_zero_p(sol->list->vector->the_deno[0]))
36 res = isl_lp_unbounded;
39 mpz_fdiv_q(*opt, sol->list->vector->the_vector[0],
40 sol->list->vector->the_deno[0]);
42 mpz_cdiv_q(*opt, sol->list->vector->the_vector[0],
43 sol->list->vector->the_deno[0]);
45 pip_matrix_free(domain);
50 pip_matrix_free(domain);