check whether projection is bounded
[barvinok.git] / barvinok_enumerate.c
blobf8b096a2df4f7978e3360e25cf7061abeefb9443
1 #include <unistd.h>
2 #include <sys/times.h>
3 #include <getopt.h>
4 #include <polylib/polylibgmp.h>
5 #include "ev_operations.h"
6 #include <util.h>
7 #include <barvinok.h>
9 /* The input of this example program is the same as that of testehrhart
10 * in the PolyLib distribution, i.e., a polytope in combined
11 * data and parameter space, a context polytope in parameter space
12 * and (optionally) the names of the parameters.
13 * Both polytopes are in PolyLib notation.
16 struct option options[] = {
17 { "convert", no_argument, 0, 'c' },
18 { "size", no_argument, 0, 's' },
19 { 0, 0, 0, 0 }
23 int main(int argc, char **argv)
25 Polyhedron *A, *C;
26 Matrix *M;
27 Enumeration *en;
28 char **param_name;
29 int c, ind = 0;
30 int convert = 0;
31 int size = 0;
33 while ((c = getopt_long(argc, argv, "cs", options, &ind)) != -1) {
34 switch (c) {
35 case 'c':
36 convert = 1;
37 break;
38 case 's':
39 size = 1;
40 break;
44 M = Matrix_Read();
45 A = Constraints2Polyhedron(M, 600);
46 Matrix_Free(M);
47 M = Matrix_Read();
48 C = Constraints2Polyhedron(M, 600);
49 Matrix_Free(M);
50 Polyhedron_Print(stdout, P_VALUE_FMT, A);
51 Polyhedron_Print(stdout, P_VALUE_FMT, C);
52 param_name = Read_ParamNames(stdin, C->Dimension);
53 en = barvinok_enumerate(A, C, 600);
54 Enumeration_Print(stdout, en, param_name);
55 if (size)
56 printf("\nSize: %d\n", Enumeration_size(en));
57 if (convert) {
58 Enumeration_mod2table(en, C->Dimension);
59 Enumeration_Print(stdout, en, param_name);
60 if (size)
61 printf("\nSize: %d\n", Enumeration_size(en));
63 Enumeration_Free(en);
64 Free_ParamNames(param_name, C->Dimension);
65 Polyhedron_Free(A);
66 Polyhedron_Free(C);
67 return 0;