Next: FD Set Operations, Previous: The Global Constraint Programming Interface, Up: Defining Global Constraints [Contents][Index]
The propagator needs access to information about the current domains of variables. This is provided by the following predicates, all of which which are constant time operations.
fd_var(?X) polymorphicfd_var(?X, -Type) polymorphic,since release 4.10.0Checks that X is currently an unbound variable that is known to
the CLPFD solver. Type is unified with its type, integer or real.
fd_min(?X, ?Min) polymorphicwhere X is a numeric argument.
Min is unified with the lower bound of the current domain of
X, i.e., a number, the atom inf denoting integer minus infinity,
or the atom finf denoting real minus infinity.
fd_max(?X, ?Max) polymorphicwhere X is a numeric argument.
Max is unified with the upper bound of the current domain of
X, i.e., a number, the atom sup denoting integer plus infinity,
or the atom fsup denoting real plus infinity.
fd_size(?X, ?Size) polymorphicwhere X is a numeric argument. For integer arguments,
Size is unified with the size of the current domain of X,
if the domain is bounded, the atom sup otherwise. For real
arguments, Size is unified with the upper bound minus the lower
bound if they are finite, the atom fsup otherwise.
fd_set(?X, ?Set)where X is an integer argument. Set is unified with an FD set denoting the internal representation of the current domain of X; see below.
fd_dom(?X, ?Range) polymorphicwhere X is a numeric argument. Range is unified with a term denoting the current domain of X. For integer arguments, that term is an IntegerRange; for real arguments, it is a RealRange. See Syntax of Range Expressions.
fd_degree(?X, ?Degree) polymorphicwhere X is a numeric argument. Degree is unified with the number of constraints that are attached to X.
Please note: the degree is computed in terms of propagators, not constraints, and may include some propagators that have been detected as entailed.
fd_failures(?X, ?Failures) since release 4.7.0where X is a numeric argument. Failures is
unified with the number of times that X has been involved in a
failure, as far as the solver can detect it. This number affects
the variable selection methods impact and dom_w_deg.
Not supported for real variables.
Please note: the number is not reset on backtracking, and so
it is a counter for the whole search.
fd_set_failures(?X, +Failures) since release 4.7.0where X is a numeric argument. The failure count of X is set to Failures, which should be a non-negative small integer. This can be useful for repeated searches or similar circumstances. Not supported for real variables.
The following predicates can be used for computing the set of variables that are (transitively) connected via constraints to some given variable(s).
fd_neighbors(+Var, -Neighbors) polymorphicGiven a numeric argument Var, Neighbors is the set of other domain variables that occur with Var in some constraint.
fd_closure(+Vars, -Closure) polymorphicGiven a list Vars of numeric arguments, Closure is the set
of variables (including Vars) that can be transitively reached
via constraints. Thus, fd_closure/2 is the transitive closure
of fd_neighbors/2.