Several predicates are provided for choosing variables and assigning
values to variables.
- indomain(V):
V is instantiated to a value in the domain. On backtracking, the
domain variable is instantiated to the next value in the domain.
- indomain_down(V):
Same as indomain(V) but the largest value in the domain is used first.
- indomain_updown(V):
Same as indomain(V) but the value nearest to the middle is used first.
- labeling(Options,Vars):
Label the variables Vars under control by the list of search options, where Options may contain the following:
- Variable selection options
- backward: The list of variables is reversed first.
- constr: Variables are ordered first by the number of attached constraints.
- degree: Variables are ordered first by degree, i.e., the number connected variables.
- ff: The first-fail principle is used: the leftmost variable with the smallest domain is selected.
- ffc: The same as with the two options: ff and constr.
- ffd: The same as with the two options: ff and degree.
- forward: Choose variables in the given order from left to right.
- inout: The variables are reordered in an inside-out fashion. For example, the variable list [X1,X2,X3,X4,X5] is rearranged into the list [X3,X2,X4,X1,X5].
- leftmost: The same as forward.
- max: Select first a variable whose domain has the largest upper bound, breaking ties by selecting a variable with the smallest domain.
- min: Select first a variable whose domain has the smallest lower bound, breaking ties by selecting a variable with the smallest domain.
- Value selection options
- down: Values are assigned to variables by using indomain_down.
- updown: Values are assigned to variables by using indomain_updown.
- split: Bisect the variable's domain, excluding the upper half first.
- reverse_split: Bisect the variable's domain, excluding the lower half first.
- Other options
- maximize(Exp):Maximize the expression Exp. Exp must become ground after all the variables are labeled.
- minimize(Exp): Minimize the expression Exp.
- time_out(Time,Result): This option imposes a time limit on labeling the variables. With this option, the labeling(Options,Vars) is equivalent to time_out(labeling(Options1,Vars),Time,Result) where Options1 is the same as Options but with no time_out option.
- time_out(Time): Same as time_out(Time,_)
- deleteff(V,Vars,Rest):
Chooses first a domain variable V from Vars with the
minimum domain. Rest is a list of domain variables without V.
- deleteffc(V,Vars,Rest):
Chooses first a variable that has the smallest domain and the largest degree (i.e., the largest number of connected variables in the constraint network). Note that the degrees of variables are not memorized, but computed each time deleteffc is called.
- labeling(Vars):
- fd_labeling(Vars):
Same as labeling([],Vars).
- labeling_ff(Vars):
- fd_labeling_ff(Vars):
Same as labeling([ff],Vars).
- labeling_ffc(Vars):
- fd_labeling_ffc(Vars):
Same as labeling([ffc],Vars).
Neng-Fa Zhou
2012-01-03