3 #include <polylib/polylibgmp.h>
4 #include <barvinok/evalue.h>
5 #include <barvinok/util.h>
6 #include <barvinok/barvinok.h>
9 /* The input of this example program is a polytope in combined
10 * data and parameter space followed by two lines indicating
11 * the number of existential variables and parameters respectively.
12 * The first lines starts with "E ", followed by a number.
13 * The second lines starts with "P ", followed by a number.
14 * These two lines are (optionally) followed by the names of the parameters.
15 * The polytope is in PolyLib notation.
18 #ifdef HAVE_GROWING_CHERNIKOVA
19 #define MAXRAYS POL_NO_DUAL
25 #define getopt_long(a,b,c,d,e) getopt(a,b,c)
28 struct option options
[] = {
29 { "pip", no_argument
, 0, 'p' },
30 { "convert", no_argument
, 0, 'c' },
31 { "floor", no_argument
, 0, 'f' },
32 { "range", no_argument
, 0, 'r' },
33 { "version", no_argument
, 0, 'V' },
38 int main(int argc
, char **argv
)
52 while ((c
= getopt_long(argc
, argv
, "pfcrV", options
, &ind
)) != -1) {
67 printf(barvinok_version());
74 A
= Constraints2Polyhedron(M
, MAXRAYS
);
78 while ((*s
=='#') || (sscanf(s
, "E %d", &exist
)<1))
82 while ((*s
=='#') || (sscanf(s
, "P %d", &nparam
)<1))
85 Polyhedron_Print(stdout
, P_VALUE_FMT
, A
);
86 printf("exist: %d, nparam: %d\n", exist
, nparam
);
87 param_name
= Read_ParamNames(stdin
, nparam
);
89 EP
= barvinok_enumerate_pip(A
, exist
, nparam
, MAXRAYS
);
91 EP
= barvinok_enumerate_e(A
, exist
, nparam
, MAXRAYS
);
95 evalue_range_reduction(EP
);
96 print_evalue(stdout
, EP
, param_name
);
98 fprintf(stderr
, "WARNING: floor conversion not supported\n");
99 evalue_frac2floor(EP
);
100 print_evalue(stdout
, EP
, param_name
);
101 } else if (convert
) {
102 evalue_mod2table(EP
, nparam
);
103 print_evalue(stdout
, EP
, param_name
);
105 free_evalue_refs(EP
);
107 Free_ParamNames(param_name
, nparam
);