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 = bmap->nparam + bmap->n_in + bmap->n_out + bmap->n_div;
17 domain = isl_basic_map_to_pip(bmap, 0, 1, 0);
20 entier_set_si(domain->p[0][1], -1);
21 isl_seq_cpy_to_pip(domain->p[0]+2, f, total);
23 options = pip_options_init();
26 options->Urs_unknowns = -1;
27 options->Maximize = maximize;
29 sol = pip_solve(domain, NULL, -1, options);
30 pip_options_free(options);
36 else if (entier_zero_p(sol->list->vector->the_deno[0]))
37 res = isl_lp_unbounded;
40 isl_seq_cpy_from_pip(opt,
41 &sol->list->vector->the_vector[0], 1);
42 isl_seq_cpy_from_pip(opt_denom,
43 &sol->list->vector->the_deno[0], 1);
45 mpz_fdiv_q(*opt, sol->list->vector->the_vector[0],
46 sol->list->vector->the_deno[0]);
48 mpz_cdiv_q(*opt, sol->list->vector->the_vector[0],
49 sol->list->vector->the_deno[0]);
51 pip_matrix_free(domain);
56 pip_matrix_free(domain);