[ Reference Manual | Alphabetic Index ]

# library(fd)

Finite domain library   [more]

## Predicates

#(?Min, ?Cstrs, ?Max)
The cardinality operator
?X ## ?Y
X is different from Y.
##(?X, ?Y, ?B)
The constraint X ## Y has the truth value B.
?C1 #/\ ?C2
The constraint expression C1 and the constraint expression C2 is true.
#/\(?X, ?Y, ?B)
The constraint X #/\ Y has the truth value B.
?Vars #:: ?Domain
Terms in Vars have the domain Domain. The predicate is an alias for ::/2.
#::(?X, ?Y, ?B)
The constraint X #:: Y has the truth value B. The predicate is an alias for ::/3.
?X #< ?Y
The linear term X is less than the linear term Y.
#<(?X, ?Y, ?B)
The constraint X #< Y has the truth value B.
?X #<= ?Y
The linear term X is less than or equal to the linear term Y.
#<=(?X, ?Y, ?B)
The constraint X #<= Y has the truth value B.
?C1 #<=> ?C2
The constraint expression C1 is equivalent to the constraint expression C2.
#<=>(?X, ?Y, ?B)
The constraint X #<=> Y has the truth value B.
?X #= ?Y
X is equal to Y.
#=(?X, ?Y, ?B)
The constraint X #= Y has the truth value B.
?C1 #=> ?C2
The constraint expression C1 implies the constraint expression C2.
#=>(?X, ?Y, ?B)
The constraint X #=> Y has the truth value B.
?X #> ?Y
The linear term X is greater than the linear term Y.
#>(?X, ?Y, ?B)
The constraint X #> Y has the truth value B.
?X #>= ?Y
The linear term X is greater than or equal to the linear term Y.
#>=(?X, ?Y, ?B)
The constraint X #>= Y has the truth value B.
#\+ ?C
The constraint expression C is false.
#\+(?X, ?B)
The constraint #\+ X has the truth value B.
?C1 #\/ ?C2
The constraint expression C1 or the constraint expression C2 is true.
#\/(?X, ?Y, ?B)
The constraint X #\/ Y has the truth value B.
?X #\= ?Y
X is different from Y.
#\=(?X, ?Y, ?B)
The constraint X #\= Y has the truth value B.
?Vars :: ?Domain
Terms in Vars have the domain Domain.
::(?X, ?Y, ?B)
The constraint X :: Y has the truth value B.
alldifferent(?List)
The elements of the list List are pairwise different.
alldistinct(?List)
The elements of the list List are pairwise different.
atmost(+N, ?List, +V)
At most N elements of the list List have the value V.
constraints_number(?Var, ?N)
The number of constraints and suspended goals associated with the variable Var is N.
default_domain(-Var)
This predicate is called to assign a default domain to a free variable Var which occurs in arithmetic constraints.
deleteff(?Var, +List, -Rest)
Select from List the variable Var which has the smallest domain and return the rest of the list.
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.
deletemin(?Var, +List, -Rest)
Select from List the variable Var which has the smallest lower domain bound, and return the rest of the list.
disjunction(?Start1, +Duration1, ?Start2, +Duration2, ?Flag)
Flag indicates which of the two non-overlapping tasks is scheduled as first. Either the one with starting time Start1 and duration Duration1 (then the value of Flag is 1), or the second one with starting time Start2 and duration Duration2 (and the Flag is 2).
disjunction_choose(?Start1, +Duration1, ?Start2, +Duration2, ?Flag)
Flag indicates which of the two non-overlapping tasks is scheduled as first. Either the one with starting time Start1 and duration Duration1 (then the value of Flag is 1), or the second one with starting time Start2 and duration Duration2 (and the Flag is 2).
disjunctive(?Starts, +Durations, ?Flags)
Succeeds if there exists a sequential ordering of non-overlapping tasks with starting times Starts and durations Durations, with respect to the ordering priorities of single pairs of tasks (elementary disjunctions) represented in the list Flags.
dom(+Var, ?List)
List is the list of elements in the domain of Var.
dom_check_in(+Element, +Dom)
Element is in the domain Dom.
dom_compare(?Res, +Dom1, +Dom2)
Res is the result of the comparison of the domains Dom1 and Dom2.
dom_copy(+Dom1, -Dom2)
Dom2 is a copy of the domain Dom1.
dom_difference(+Dom1, +Dom2, -DomDiff, -Size)
The domain DomDifference is Dom1 \Dom2 and Size is the number of its elements.
dom_intersection(+Dom1, +Dom2, -DomInt, -Size)
The domain DomInt is the intersection of domains Dom1 and Dom2 and Size is the number of its elements.
dom_member(?Element, +Dom)
Element is in the domain Dom.
dom_range(+Dom, ?Min, ?Max)
Return the minimum and maximum value in the integer domain Dom.
dom_size(+Dom, ?Size)
Size is the number of elements in the domain Dom.
dom_to_list(+Dom, ?List)
List is the list of elements in the domain Dom.
dom_union(+Dom1, +Dom2, -DomUnion, -Size)
The domain DomUnion is the union of domains Dom1 and Dom2 and Size is the number of its elements.
dvar_attribute(+DVar, ?Attrib)
Attrib is the attribute of the domain variable DVar.
dvar_domain(+DVar, -Dom)
Dom is the domain of the domain variable DVar.
dvar_msg(+DVar1, +DVar2, -MsgDVar)
MsgDVar is a domain variable which is the most specific generalisation of domain variables or atomic values DVar1 and DVar2.
dvar_range(+DVar, ?Min, ?Max)
Return the minimum and maximum domain value of DVar
dvar_remove_element(+DVar, +El)
The element El is removed from the domain of DVar and all concerned lists are woken.
dvar_remove_greater(+DVar, +El)
Remove all elements in the domain of DVar which are greater than the integer El and wake all concerned lists.
dvar_remove_smaller(+DVar, +El)
Remove all elements in the domain of DVar which are smaller than the integer El and wake all concerned lists.
dvar_replace(+DVar, +NewDom)
Change the domain of the domain variable DVar to NewDom without propagating the changes.
dvar_update(+DVar, +NewDom)
Change the domain of the domain variable DVar to NewDom and propagate the changes.
element(?Index, +List, ?Value)
Value is the Index'th element of the integer list List.
fd_eval(?C)
Evaluate and state the constraint expression C.
indomain(?Var)
Instantiate Var to a value in its domain.
integer_list_to_dom(+List, -Dom)
Convert a sorted list of integers and integer intervals into a domain Dom.
integers(+Vars)
Constrains Vars to be integers.
is_domain(?Term)
Succeeds if Term is a domain variable.
is_exact_solver_var(?)
No description available
is_integer_domain(?Term)
Succeeds if Term is a domain variable with an integer domain.
is_solver_var(?)
No description available
?B isd ?C
The constraint expression C evaluates to the boolean value B.
labeling(+Vars)
Instantiate all variables in a list to values in their domain
list_to_dom(+List, -Dom)
Convert a list of atomic terms and integer intervals into a domain Dom.
maxdomain(+Var, ?Max)
Max is the maximum element in the domain of Var.
min_max(?Goal, ?C)
Find the solution of Goal that minimizes the maximum of elements of C.
min_max(+Goal, ?Template, ?Solution, ?C)
Find the solution of Goal that minimizes the maximum of elements of C, and unify the minimized Template with Solution.
min_max(?Goal, ?C, +Lower, +Upper, +Percent)
Find the solution of Goal that minimizes the maximum of elements of C, within the bounds set by Lower,Upper and Percent.
min_max(?Goal, ?C, +Lower, +Upper, +Percent, +Timeout)
Find the solution of Goal that minimizes the maximum of elements of C, within the bounds set by Lower,Upper and Percent in time not longer than Timeout.
min_max(+Goal, ?Template, ?Solution, ?C, +Lower, +Upper, +Percent, +Timeout)
Find the solution of Goal that minimizes the maximum of elements of C, within the bounds set by Lower,Upper and Percent in time not longer than Timeout.
min_max_body(?, ?, ?)
No description available
min_max_body(?, ?, ?, ?, ?)
No description available
min_max_body(?, ?, ?, ?, ?, ?)
No description available
min_max_body(?, ?, ?, ?, ?, ?, ?)
No description available
min_max_body(?, ?, ?, ?, ?, ?, ?, ?, ?)
No description available
mindomain(+Var, ?Min)
Min is the minimum element in the domain of Var.
minimize(?Goal, ?C)
Find the solution of Goal that minimizes C.
minimize(+Goal, ?Template, ?Solution, ?C)
Find the solution of Goal that minimizes C, and unify the minimized Template with Solution.
minimize(?Goal, ?C, +Lower, +Upper, +Percent)
Find the solution of Goal that minimizes C, within the bounds set by Lower, Upper and Percent.
minimize(?Goal, ?C, +Lower, +Upper, +Percent, +Timeout)
Find the solution of Goal that minimizes C, within the bounds set by Lower, Upper and Percent in time not longer than Timeout.
minimize(+Goal, ?Template, ?Solution, ?C, +Lower, +Upper, +Percent, +Timeout)
Find the solution of Goal that minimizes the maximum of elements of C, within the bounds set by Lower,Upper and Percent in time not longer than Timeout.
minimize_body(?, ?, ?)
No description available
minimize_body(?, ?, ?, ?, ?)
No description available
minimize_body(?, ?, ?, ?, ?, ?)
No description available
minimize_body(?, ?, ?, ?, ?, ?, ?)
No description available
minimize_body(?, ?, ?, ?, ?, ?, ?, ?, ?)
No description available
minimize_bound_check
If within a minimization, force a check of the cost variable against the cost bound, which may lead to earlier failure.
msg(?, ?, ?)
No description available
new_domain_var(-Var)
A user hook predicate which is called whenever a variable obtains a default domain from the solver.
par_indomain(?Var)
Instantiate Var to a number of values in its domain in parallel.
sorted_list_to_dom(+List, -Dom)
Convert a sorted list of atomic terms and integer intervals into a domain Dom.
tr_fd_out(?, ?)
No description available
var_fd(+Var, +Dom)
Create a domain variable with a given domain.

## Reexports

reexport fd_arith
except fd_eq / 1, fd_eq / 2, fd_ge / 1, fd_ge / 2, fd_gec / 5, fd_gec_ent / 6, fd_ineq / 1, fd_ineq / 2, fd_qeq / 3, fd_re / 2, fd_dom_simple / 2, fd_dom_simple / 3
reexport fd_chip
reexport fd_elipsys
reexport fd_util

## Other Exports

export macro(element / 5, tr_fd_out / 2, [write, goal])

## Description

The library fd.pl implements constraints over finite domains that can contain integer as well as atomic elements. More detailed documentation can be found in the 'Obsolete Libraries Manual', since this library is now largely superseded by library(ic).

### Glossary

domain variable
A domain variable is a variable which can be instantiated only to a value from a given finite set. Unification with a term outside of this domain fails. The domain can be associated with the variable using the predicate ::/2. Built-in predicates that expect domain variables treat atomic and other ground terms as variables with singleton domains.
integer domain variable
An integer domain variable is a domain variable whose domain contains only integer numbers. Only such variables are accepted in inequality constraints and in rational terms. Note that a non-integer domain variable can become an integer domain variable when the non-integer values are removed from its domain.
integer interval
An integer interval is written as Min .. Max with integer expressions Min =< Max and it represents the set {Min, Min + 1, ..., Max}.
linear term
A linear term is a linear integer combination of integer domain variables. The constraint predicates accept linear terms even in a non-canonical form, containing functors +, - and *, e.g. 5*(3+(4-6)*Y-X*3). If the constraint predicates encounter a variable without a domain, they give it a default domain -10000000..10000000. Note that arithmetic operations on linear terms are performed with standard machine word integers without any overflow checks. If the domain ranges or coefficients are too large, the operation will not yield correct results. Both the maximum and minimum value of a linear term must be representable in a machine word, and so must the maximum and minimum value of every ci xi term.
rational term
A rational term is a term constructed from integers and integer domain variables using the arithmetic operations +, -, *, /, abs, min and max. The nonlinear parts are handled by introducing an auxiliary constraint with a new result variable, and using this result variable in the linear term context. Every subexpression of the form VarA/VarB must have an integer value in the solution. The system replaces such a subexpression by a new variable X and adds a new constraint VarA #= VarB * X. Similarly, all subexpressions of the form VarA*VarB are replaced by a new variable X and a new constraint X #= VarA * VarB is added, and similary for the functions abs/1, min/2 and max/2.
constraint expression
A constraint expression is either an arithmetic constraint or a combination of constraint expressions using the logical FD connectives #/\/2, #\//2, #=>/2, #<=>/2, #\+/1.