/* * Copyright 2008-2009 Katholieke Universiteit Leuven * * Use of this software is governed by the MIT license * * Written by Sven Verdoolaege, K.U.Leuven, Departement * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ #include <isl_ctx_private.h> #include <isl_map_private.h> #include <isl/lp.h> #include <isl_seq.h> #include "isl_tab.h" #include <isl_options_private.h> #include <isl_local_space_private.h> #include <isl_aff_private.h> #include <isl_mat_private.h> #include <isl_val_private.h> #include <isl_vec_private.h> #include <bset_to_bmap.c> #include <set_to_map.c> static enum isl_lp_result isl_tab_solve_lp(__isl_keep isl_basic_map *bmap, int maximize, isl_int *f, isl_int denom, isl_int *opt, isl_int *opt_denom, __isl_give isl_vec **sol) { … } /* Given a basic map "bmap" and an affine combination of the variables "f" * with denominator "denom", set *opt / *opt_denom to the minimal * (or maximal if "maximize" is true) value attained by f/d over "bmap", * assuming the basic map is not empty and the expression cannot attain * arbitrarily small (or large) values. * If opt_denom is NULL, then *opt is rounded up (or down) * to the nearest integer. * The return value reflects the nature of the result (empty, unbounded, * minimal or maximal value returned in *opt). */ enum isl_lp_result isl_basic_map_solve_lp(__isl_keep isl_basic_map *bmap, int max, isl_int *f, isl_int d, isl_int *opt, isl_int *opt_denom, __isl_give isl_vec **sol) { … } enum isl_lp_result isl_basic_set_solve_lp(__isl_keep isl_basic_set *bset, int max, isl_int *f, isl_int d, isl_int *opt, isl_int *opt_denom, __isl_give isl_vec **sol) { … } enum isl_lp_result isl_map_solve_lp(__isl_keep isl_map *map, int max, isl_int *f, isl_int d, isl_int *opt, isl_int *opt_denom, __isl_give isl_vec **sol) { … } enum isl_lp_result isl_set_solve_lp(__isl_keep isl_set *set, int max, isl_int *f, isl_int d, isl_int *opt, isl_int *opt_denom, __isl_give isl_vec **sol) { … } /* Return the optimal (rational) value of "obj" over "bset", assuming * that "obj" and "bset" have aligned parameters and divs. * If "max" is set, then the maximal value is computed. * Otherwise, the minimal value is computed. * * Return infinity or negative infinity if the optimal value is unbounded and * NaN if "bset" is empty. * * Call isl_basic_set_solve_lp and translate the results. */ static __isl_give isl_val *basic_set_opt_lp( __isl_keep isl_basic_set *bset, int max, __isl_keep isl_aff *obj) { … } /* Return the optimal (rational) value of "obj" over "bset", assuming * that "obj" and "bset" have aligned parameters. * If "max" is set, then the maximal value is computed. * Otherwise, the minimal value is computed. * * Return infinity or negative infinity if the optimal value is unbounded and * NaN if "bset" is empty. * * Align the divs of "bset" and "obj" and call basic_set_opt_lp. */ static __isl_give isl_val *isl_basic_set_opt_lp_val_aligned( __isl_keep isl_basic_set *bset, int max, __isl_keep isl_aff *obj) { … } /* Return the optimal (rational) value of "obj" over "bset". * If "max" is set, then the maximal value is computed. * Otherwise, the minimal value is computed. * * Return infinity or negative infinity if the optimal value is unbounded and * NaN if "bset" is empty. */ static __isl_give isl_val *isl_basic_set_opt_lp_val( __isl_keep isl_basic_set *bset, int max, __isl_keep isl_aff *obj) { … } /* Return the minimal (rational) value of "obj" over "bset". * * Return negative infinity if the minimal value is unbounded and * NaN if "bset" is empty. */ __isl_give isl_val *isl_basic_set_min_lp_val(__isl_keep isl_basic_set *bset, __isl_keep isl_aff *obj) { … } /* Return the maximal (rational) value of "obj" over "bset". * * Return infinity if the maximal value is unbounded and * NaN if "bset" is empty. */ __isl_give isl_val *isl_basic_set_max_lp_val(__isl_keep isl_basic_set *bset, __isl_keep isl_aff *obj) { … }