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
;
49 context
= isl_basic_set_read_from_file(ctx
, stdin
, 0, ISL_FORMAT_POLYLIB
);
51 n
= fscanf(stdin
, "%d", &neg_one
);
53 assert(neg_one
== -1);
54 bset
= isl_basic_set_read_from_file(ctx
, stdin
,
55 isl_basic_set_dim(context
, isl_dim_set
), ISL_FORMAT_POLYLIB
);
57 while (fgets(s
, sizeof(s
), stdin
)) {
58 if (strncasecmp(s
, "Maximize", 8) == 0)
60 if (strncasecmp(s
, "Rational", 8) == 0)
61 bset
= isl_basic_set_set_rational(bset
);
62 if (strncasecmp(s
, "Urs_parms", 9) == 0)
64 if (strncasecmp(s
, "Urs_unknowns", 12) == 0)
68 context
= isl_basic_set_intersect(context
,
69 isl_basic_set_positive_orthant(isl_basic_set_get_dim(context
)));
70 context
= to_parameter_domain(context
);
72 bset
= isl_basic_set_intersect(bset
,
73 isl_basic_set_positive_orthant(isl_basic_set_get_dim(bset
)));
76 set
= isl_basic_set_partial_lexmax(bset
, context
, &empty
);
78 set
= isl_basic_set_partial_lexmin(bset
, context
, &empty
);
80 isl_set_dump(set
, stdout
, 0);
81 fprintf(stdout
, "no solution:\n");
82 isl_set_dump(empty
, stdout
, 4);