5 #include "isl_map_private.h"
7 /* The input of this program is the same as that of the "example" program
8 * from the PipLib distribution, except that the "big parameter column"
11 * Context constraints in PolyLib format
13 * Problem constraints in PolyLib format
14 * Optional list of options
17 * Maximize compute maximum instead of minimum
18 * Rational compute rational optimum instead of integer optimum
19 * Urs_parms don't assume parameters are non-negative
20 * Urs_unknowns don't assume unknowns are non-negative
23 static struct isl_basic_set *to_parameter_domain(struct isl_basic_set *context)
25 struct isl_dim *param_dim;
26 struct isl_basic_set *model;
28 param_dim = isl_dim_set_alloc(context->ctx,
29 isl_basic_set_n_dim(context), 0);
30 model = isl_basic_set_empty(param_dim);
31 context = isl_basic_set_from_underlying_set(context, model);
36 int main(int argc, char **argv)
38 struct isl_ctx *ctx = isl_ctx_alloc();
39 struct isl_basic_set *context, *bset;
41 struct isl_set *empty;
48 context = isl_basic_set_read_from_file(ctx, stdin, 0, ISL_FORMAT_POLYLIB);
50 fscanf(stdin, "%d", &neg_one);
51 assert(neg_one == -1);
52 bset = isl_basic_set_read_from_file(ctx, stdin,
53 isl_basic_set_dim(context, isl_dim_set), ISL_FORMAT_POLYLIB);
55 while (fgets(s, sizeof(s), stdin)) {
56 if (strncasecmp(s, "Maximize", 8) == 0)
58 if (strncasecmp(s, "Rational", 8) == 0)
59 bset = isl_basic_set_set_rational(bset);
60 if (strncasecmp(s, "Urs_parms", 9) == 0)
62 if (strncasecmp(s, "Urs_unknowns", 12) == 0)
66 context = isl_basic_set_intersect(context,
67 isl_basic_set_positive_orthant(isl_basic_set_get_dim(context)));
68 context = to_parameter_domain(context);
70 bset = isl_basic_set_intersect(bset,
71 isl_basic_set_positive_orthant(isl_basic_set_get_dim(bset)));
74 set = isl_basic_set_partial_lexmax(bset, context, &empty);
76 set = isl_basic_set_partial_lexmin(bset, context, &empty);
78 isl_set_dump(set, stdout, 0);
79 fprintf(stdout, "no solution:\n");
80 isl_set_dump(empty, stdout, 4);