[ library(fd) | Reference Manual | Alphabetic Index ]

deleteffc(?Var, +List, -Rest)

Select from List the variable Var which has the smallest domain and most constraints and return the rest of the list.
A variable.
A term unifying with a list of domain variables or integers.
A list of domain variables or integers.


This predicate is used in the labeling procedures. When we look for the instantiation of a list of domain variables which is consistent with a set of constraints, it is better to start with instantiations which are most likely to fail, because this will cut down the size of the search space considerably. The predicate deleteffc/3 selects among the variables with the smallest domain that one which has most constraints attached to it. This choice is based on the heuristics that variables with more constraints are more likely to fail when instantiated.

If several variables are equally eligible, the leftmost one in the list is taken. Constants are treated like variables of domain size one with no constraints attached. The list Rest is the same as List except that the selected element is missing. In particular, any existing list order is preserved.

Fail Conditions

Fails if List is nil.



See Also

constraints_number / 2, deleteff / 3, indomain / 1, fd_search : search / 6