module LuckyDraw:Time-stamp: <modified the 11/12/2006 (at 15:25) by Erwan Jahier>sig
..end
The Boolean part is based on BDDS and the numeric part on convex Polyhedron (Polka, by B. Jeannet).
Example of use:
List.iter print_solution
(draw (solve (make_bool_expr ["x",Float] "x > 10.0 and x <= 20.0"))) ;;
List.iter print_solution
(draw (solve (make_bool_expr ["x",Bool; "y",Bool; "Z",Bool] "true"))) ;;
typevar_name =
string
type
var_type =
| |
Float |
| |
Int |
| |
Bool |
type
value =
| |
F of |
| |
I of |
| |
B of |
type
bool_expr
val make_bool_expr : (var_name * var_type) list ->
string -> bool_expr
and
, or
, not
, xor
, =>
, =
, true
,
false
, if then else
, <
, <=
, >
, >=
, +
, *
, -
, /
,
div
, mod
as well as variable identifiers and numeric (integer, float)
litterals.
e.g., make_bool_expr ["x", Bool; y, Int] "0 < y and y < 10"
bool_expr
bool_expr
using the following functions,
with obvious semantics.bool_expr
constructorsval and_b : bool_expr -> bool_expr -> bool_expr
val or_b : bool_expr -> bool_expr -> bool_expr
val xor_b : bool_expr -> bool_expr -> bool_expr
val impl_b : bool_expr -> bool_expr -> bool_expr
val eq_b : bool_expr -> bool_expr -> bool_expr
val not_b : bool_expr -> bool_expr
val true_b : bool_expr
val false_b : bool_expr
val ite_b : bool_expr ->
bool_expr -> bool_expr -> bool_expr
val var_b : string -> bool_expr
type
int_expr
val var_i : string -> int_expr
val val_i : int -> int_expr
val eq_i : int_expr -> int_expr -> bool_expr
val sup_i : int_expr -> int_expr -> bool_expr
val supeq_i : int_expr -> int_expr -> bool_expr
val inf_i : int_expr -> int_expr -> bool_expr
val infeq_i : int_expr -> int_expr -> bool_expr
val ite_i : bool_expr ->
int_expr -> int_expr -> int_expr
val sum_i : int_expr -> int_expr -> int_expr
val diff_i : int_expr -> int_expr -> int_expr
val prod_i : int_expr -> int_expr -> int_expr
val quot_i : int_expr -> int_expr -> int_expr
val mod_i : int_expr -> int_expr -> int_expr
val div_i : int_expr -> int_expr -> int_expr
val uminus_i : int_expr -> int_expr
type
float_expr
val var_f : string -> float_expr
val val_f : float -> float_expr
val eq_f : float_expr -> float_expr -> bool_expr
val sup_f : float_expr -> float_expr -> bool_expr
val supeq_f : float_expr -> float_expr -> bool_expr
val inf_f : float_expr -> float_expr -> bool_expr
val infeq_f : float_expr -> float_expr -> bool_expr
val ite_f : bool_expr ->
float_expr -> float_expr -> float_expr
val sum_f : float_expr -> float_expr -> float_expr
val diff_f : float_expr -> float_expr -> float_expr
val prod_f : float_expr -> float_expr -> float_expr
val quot_f : float_expr -> float_expr -> float_expr
val uminus_f : float_expr -> float_expr
typesubst =
var_name * value
typesolution =
subst list
type
solutions_set
val solve : bool_expr -> solutions_set
typedraw_mode =
int * int * int
val draw : ?mode:draw_mode ->
?verbose:int -> solutions_set -> solution list
val set_efficient_mode : unit -> unit
val set_fair_mode : unit -> unit
val string_of_value : value -> string
val bool_expr_to_string : bool_expr -> string
val print_solution : solution -> unit
val set_seed : int -> unit
val set_default_max_int : int -> unit
val set_default_min_int : int -> unit
val set_default_max_float : float -> unit
val set_default_min_float : float -> unit