a polytope with rays independent of the existential variables is unbounded
[barvinok.git] / barvinok_enumerate_e.c
blobf70c6ace8aade0c2956707609c96530fca1f2430
1 #include <unistd.h>
2 #include <sys/times.h>
3 #include <polylib/polylibgmp.h>
4 #include "ev_operations.h"
5 #include <util.h>
6 #include <barvinok.h>
8 /* The input of this example program is a polytope in combined
9 * data and parameter space followed by two lines indicating
10 * the number of existential variables and parameters respectively.
11 * The first lines starts with "E ", followed by a number.
12 * The second lines starts with "P ", followed by a number.
13 * These two lines are (optionally) followed by the names of the parameters.
14 * The polytope is in PolyLib notation.
17 int main()
19 Polyhedron *A;
20 Matrix *M;
21 char **param_name;
22 int exist, nparam;
23 char s[128];
24 evalue *EP;
26 M = Matrix_Read();
27 A = Constraints2Polyhedron(M, 600);
28 Matrix_Free(M);
30 fgets(s, 128, stdin);
31 while ((*s=='#') || (sscanf(s, "E %d", &exist)<1))
32 fgets(s, 128, stdin);
34 fgets(s, 128, stdin);
35 while ((*s=='#') || (sscanf(s, "P %d", &nparam)<1))
36 fgets(s, 128, stdin);
38 Polyhedron_Print(stdout, P_VALUE_FMT, A);
39 printf("exist: %d, nparam: %d\n", exist, nparam);
40 param_name = Read_ParamNames(stdin, nparam);
41 EP = barvinok_enumerate_e(A, exist, nparam, 600);
42 print_evalue(stdout, EP, param_name);
43 free_evalue_refs(EP);
44 Free_ParamNames(param_name, nparam);
45 Polyhedron_Free(A);
46 return 0;