2 #include <barvinok/options.h>
3 #include <barvinok/util.h>
7 #ifdef HAVE_GROWING_CHERNIKOVA
8 #define MAXRAYS (POL_NO_DUAL | POL_INTEGER)
13 #define ALLOC(type) (type*)malloc(sizeof(type))
15 void barvinok_stats_clear(struct barvinok_stats
*stats
)
17 stats
->unimodular_cones
= 0;
20 void barvinok_stats_print(struct barvinok_stats
*stats
, FILE *out
)
22 fprintf(out
, "Unimodular cones: %d\n", stats
->unimodular_cones
);
25 struct barvinok_options
*barvinok_options_new_with_defaults()
27 struct barvinok_options
*options
= ALLOC(struct barvinok_options
);
31 barvinok_stats_clear(&options
->stats
);
36 options
->MaxRays
= MAXRAYS
;
38 #ifdef USE_INCREMENTAL_BF
39 options
->incremental_specialization
= 2;
40 #elif defined USE_INCREMENTAL_DF
41 options
->incremental_specialization
= 1;
43 options
->incremental_specialization
= 0;
48 options
->gbr_lp_solver
= BV_GBR_GLPK
;
49 #elif defined HAVE_LIBCDDGMP
50 options
->gbr_lp_solver
= BV_GBR_CDD
;
52 options
->gbr_lp_solver
= BV_GBR_NONE
;
55 options
->lexmin_emptiness_check
= BV_LEXMIN_EMPTINESS_CHECK_SAMPLE
;
56 options
->lexmin_reduce
= 1;
57 options
->lexmin_polysign
= BV_LEXMIN_POLYSIGN_POLYLIB
;
62 struct argp_option barvinok_argp_options
[] = {
63 { "primal", BV_OPT_PRIMAL
, 0, 0 },
64 { "specialization", BV_OPT_SPECIALIZATION
, "[bf|df|random]", 0 },
65 { "version", 'V', 0, 0 },
69 error_t
barvinok_parse_opt(int key
, char *arg
, struct argp_state
*state
)
71 struct barvinok_options
*options
= state
->input
;
75 printf(barvinok_version());
77 case BV_OPT_SPECIALIZATION
:
78 if (!strcmp(arg
, "bf"))
79 options
->incremental_specialization
= BV_SPECIALIZATION_BF
;
80 else if (!strcmp(arg
, "df"))
81 options
->incremental_specialization
= BV_SPECIALIZATION_DF
;
82 else if (!strcmp(arg
, "random"))
83 options
->incremental_specialization
= BV_SPECIALIZATION_RANDOM
;
89 return ARGP_ERR_UNKNOWN
;
94 struct argp barvinok_argp
= {
95 barvinok_argp_options
, barvinok_parse_opt
, 0, 0