reduce constant after inversion; avoid infinite loop
[barvinok.git] / piptest.c
blobc1efa1425d3062d9c893c19b424216c2b03dfd37
1 #include <polylib/polylibgmp.h>
2 #include "piputil.h"
3 #include "ev_operations.h"
4 #include <barvinok.h>
5 #include "config.h"
7 #ifdef HAVE_GROWING_CHERNIKOVA
8 #define MAXRAYS 0
9 #else
10 #define MAXRAYS 600
11 #endif
13 int main(int argc, char **argv)
15 Polyhedron *A;
16 Matrix *M;
17 Polyhedron *D, *P, *N;
18 char **param_name;
19 int exist, nparam, nvar;
20 char s[128];
21 evalue sum;
23 M = Matrix_Read();
24 A = Constraints2Polyhedron(M, MAXRAYS);
25 Matrix_Free(M);
27 fgets(s, 128, stdin);
28 while ((*s=='#') || (sscanf(s, "E %d", &exist)<1))
29 fgets(s, 128, stdin);
31 fgets(s, 128, stdin);
32 while ((*s=='#') || (sscanf(s, "P %d", &nparam)<1))
33 fgets(s, 128, stdin);
35 Polyhedron_Print(stdout, P_VALUE_FMT, A);
36 printf("exist: %d, nparam: %d\n", exist, nparam);
37 param_name = Read_ParamNames(stdin, nparam);
39 nvar = A->Dimension - exist - nparam;
40 D = pip_lexmin(A, exist, nparam);
42 value_init(sum.d);
43 evalue_set_si(&sum, 0, 1);
44 for (P = D; P; P = N) {
45 N = P->next;
46 P->next = 0;
47 evalue *EP;
48 exist = P->Dimension - nvar - nparam;
49 EP = barvinok_enumerate_e(P, exist, nparam, MAXRAYS);
50 print_evalue(stderr, EP, param_name);
51 eadd(EP, &sum);
53 print_evalue(stderr, &sum, param_name);