signature MODELING structure Modeling : MODELING
The Modeling structure provides functionality to post arithmetic constraints using a convenient infix operator syntax.
Notes:
This module maps constraints onto regular sum constraints of the FD module. This transformation is not always optimal, that is, one might be able to devise a better constraint manually.Note also that since this module extensively performs folding of constant expressions, it eventually might exceed the implementation specific integer constant limit of finite domain constraints. In such a case, folding can be prevented by introducing a finite domain variable that is assigned a singleton value.
import signature MODELING from "x-alice:/lib/gecode/MODELING-sig" import structure Modeling from "x-alice:/lib/gecode/Modeling"
signature MODELING = sig type space type intvar type boolvar datatype conlevel = BND | DEF | DOM | VAL infix 7 `* infix 6 `+ `- infix 5 `# infix 4 `= `<> `> `>= `< `<= infix 3 `-> infix 3 `<- infix 3 `== infix 3 `& infix 3 `| infix 3 XOR datatype domain_element = `` of int | `# of int * int type domain = domain_element list datatype b_var_sel = B_DEGREE_MAX | B_DEGREE_MIN | B_MAX_MAX | B_MAX_MIN | B_MIN_MAX | B_MIN_MIN | B_NONE | B_REGRET_MAX_MAX | B_REGRET_MAX_MIN | B_REGRET_MIN_MAX | B_REGRET_MIN_MIN | B_SIZE_MAX | B_SIZE_MIN datatype b_val_sel = B_MAX | B_MED | B_MIN | B_SPLIT_MAX | B_SPLIT_MIN datatype term = FD of intvar | ` of int | `+ of term * term | `- of term * term | `* of term * term | SUMV of intvar vector datatype rel = `< of term * term | `<= of term * term | `= of term * term | `<> of term * term | `>= of term * term | `> of term * term val fdterm : space * domain -> term val fdtermVec : space * int * domain -> term vector val post : space * rel * conlevel -> unit val distinct : space * term vector * conlevel -> unit val branch : space * term vector * b_var_sel * b_val_sel -> unit datatype b_term = BV of boolvar | BC of bool | HOLDS of rel | `== of b_term * b_term | `-> of b_term * b_term | `<- of b_term * b_term | `! of b_term | `& of b_term * b_term | XOR of b_term * b_term | `| of b_term * b_term val boolterm : space -> b_term val booltermVec : space * int -> b_term vector val postTrue : space * b_term -> unit end
The type of first class comutational spaces. Usually equal to SPACE.space.
The type of finite domain variables.
The type of boolean constraint variables. Fundamentally, they are FD variables constrained to the 0-1 domain.
Type to identify the eagerness of propagation.
When the required level is not implemented for a propagator,
the closest, stricter version is used.
DOM: Domain Proagatin. Strictest.
BND: Bounds Propagation.
VAL: Value Propagation. Most loose.
DEF: The default for the propagator.
Used to describe domains of finite domain variables. `` i denotes the single integer value i and >`#(l,h) denotes all integer values between l and h. For example, [``3,`#(5,10)] denotes [3,5,6,7,8,9,10].
This datatype is used to post arithmetic constraints.
This datatype is used to post equations, inequations, and disequations.
returns a freshly created finite domain variable term initialized with d.
returns a vector of n freshly created finite domain variable terms initialized with d.
post the constraint denoted by r in space s using consistency level cl.
post the constraint that all variables in the vector v in space s have to be distinct using consistency level cl. If the vector contains terms other than FD variables, an exception is thrown.
post a branching on the variables in the vector v in space s, with b_var_sel and b_val_sel as the branching strategies. If the vector contains terms other than FD variables, an exception is thrown.
This datatype is used to post boolean constraints.
returns a freshly created true/false domain variable term.
returns a vector of n freshly created true/false domain variable terms.
post the constraint that the boolean term denoted by t holds in space s.