The variable selection strategy lets you specify which variable of Vars is labeled next and is one of:
- Label the variables in the order they occur in Vars. This is the default.
- First fail. Label the leftmost variable with smallest domain next, in order to detect infeasibility early. This is often a good strategy.
- Of the variables with smallest domains, the leftmost one participating in most constraints is labeled next.
- Label the leftmost variable whose lower bound is the lowest next.
- Label the leftmost variable whose upper bound is the highest next.
The value order is one of:
- Try the elements of the chosen variable's domain in ascending order. This is the default.
- Try the domain elements in descending order.
The branching strategy is one of:
- For each variable X, a choice is made between X = V and X
#\=V, where V is determined by the value ordering options. This is the default.
- For each variable X, a choice is made between X = V_1, X = V_2 etc., for all values V_i of the domain of X. The order is determined by the value ordering options.
- For each variable X, a choice is made between X
#=<M and X
#>M, where M is the midpoint of the domain of X.
At most one option of each category can be specified, and an option must not occur repeatedly.
The order of solutions can be influenced with:
This generates solutions in ascending/descending order with respect to the evaluation of the arithmetic expression Expr. Labeling Vars must make Expr ground. If several such options are specified, they are interpreted from left to right, e.g.:
?- [X,Y] ins 10..20, labeling([max(X),min(Y)],[X,Y]).
This generates solutions in descending order of X, and for each
binding of X, solutions are generated in ascending order of Y. To obtain
the incomplete behaviour that other systems exhibit with "
minimize(Expr)", use once/1,
Labeling is always complete, always terminates, and yields no redundant solutions.