2 #include <barvinok/options.h>
3 #include <barvinok/util.h>
7 #ifdef HAVE_GROWING_CHERNIKOVA
8 #define MAXRAYS (POL_NO_DUAL | POL_INTEGER)
14 Vector
*Polyhedron_Sample(Polyhedron
*P
, struct barvinok_options
*options
)
20 #define ALLOC(type) (type*)malloc(sizeof(type))
22 void barvinok_stats_clear(struct barvinok_stats
*stats
)
24 stats
->unimodular_cones
= 0;
27 void barvinok_stats_print(struct barvinok_stats
*stats
, FILE *out
)
29 fprintf(out
, "Unimodular cones: %d\n", stats
->unimodular_cones
);
32 struct barvinok_options
*barvinok_options_new_with_defaults()
34 struct barvinok_options
*options
= ALLOC(struct barvinok_options
);
38 barvinok_stats_clear(&options
->stats
);
43 options
->MaxRays
= MAXRAYS
;
45 #ifdef USE_INCREMENTAL_BF
46 options
->incremental_specialization
= 2;
47 #elif defined USE_INCREMENTAL_DF
48 options
->incremental_specialization
= 1;
50 options
->incremental_specialization
= 0;
54 options
->lookup_table
= 0;
56 options
->lookup_table
= 1;
59 options
->count_sample_infinite
= 1;
61 options
->count_sample_infinite
= 0;
65 options
->gbr_lp_solver
= BV_GBR_GLPK
;
66 #elif defined HAVE_LIBCDDGMP
67 options
->gbr_lp_solver
= BV_GBR_CDD
;
69 options
->gbr_lp_solver
= BV_GBR_NONE
;
75 struct argp_option barvinok_argp_options
[] = {
76 { "primal", BV_OPT_PRIMAL
, 0, 0 },
77 { "table", BV_OPT_TABLE
, 0, 0 },
78 { "specialization", BV_OPT_SPECIALIZATION
, "[bf|df|random]", 0 },
79 { "gbr", BV_OPT_GBR
, "[cdd]", 0,
80 "solver to use for basis reduction" },
81 { "version", 'V', 0, 0 },
85 error_t
barvinok_parse_opt(int key
, char *arg
, struct argp_state
*state
)
87 struct barvinok_options
*options
= state
->input
;
91 printf(barvinok_version());
93 case BV_OPT_SPECIALIZATION
:
94 if (!strcmp(arg
, "bf"))
95 options
->incremental_specialization
= BV_SPECIALIZATION_BF
;
96 else if (!strcmp(arg
, "df"))
97 options
->incremental_specialization
= BV_SPECIALIZATION_DF
;
98 else if (!strcmp(arg
, "random"))
99 options
->incremental_specialization
= BV_SPECIALIZATION_RANDOM
;
105 options
->lookup_table
= 1;
108 if (!strcmp(arg
, "cdd"))
109 options
->gbr_lp_solver
= BV_GBR_CDD
;
112 return ARGP_ERR_UNKNOWN
;
117 struct argp barvinok_argp
= {
118 barvinok_argp_options
, barvinok_parse_opt
, 0, 0