- alldifferent(Vars):
- all_different(Vars):
The elements in Vars are mutually different, where Vars is a list of terms.
- alldistinct(Vars):
- all_distinct(Vars):
This is equivalent to alldifferent(Vars), but it uses a stronger consistency-checking algorithm in order to exclude inconsistent values from the domains of variables.
- post_neqs(L):
L is a list of inequality constraints of the form
X #\= Y
, where X and Y are variables. This constraint is equivalent to the conjunction of the inequality constraints in L, but it extracts all_distinct constraints from the inequality constraints.
- assignment(Xs,Ys):
Let Xs=[X1,...,Xn], and let Ys=[Y1,...,Yn]. Then, the following are true:
Xs in 1..n,
Ys in 1..n,
for each i,j in 1..n, Xi#=j #<=> Yj#=i
where #<=>
is a Boolean constraint. The variables in Ys are called dual variables.
- assignment0(Xs,Ys):
Let Xs=[X0,...,Xn], and let Ys=[Y0,...,Yn]. Then, the following are true:
Xs in 0..n,
Ys in 0..n,
for each i,j in 0..n, Xi#=j #<=> Yj#=i
The variables in Ys are called dual variables.
- fd_element(I,L,V):
- element(I,L,V):
This succeeds if the Ith element of L is V, where I must be an integer or an integer domain variable, V must be a term, and L must be a list of terms.
- fd_atmost(N,L,V):
- atmost(N,L,V):
This succeeds if there are at most N elements in L that are equal to V, where N must be an integer or an integer domain variable, V must be a term, and L must be a list of terms.
- fd_atleast(N,L,V):
- atleast(N,L,V):
This succeeds if there are at least N elements in L that are equal to V, where N must be an integer or an integer domain variable, V must be a term, and L must be a list of terms.
- fd_exactly(N,L,V):
- exactly(N,L,V):
This succeeds if there are exactly N elements in L that are equal to V, where N must be an integer or an integer domain variable, V must be a term, and L must be a list of terms.
- global_cardinality(L,Vals):
Let L be a list of integers or domain variables [X1,
, Xd], and let Vals be a list of pairs [K1-V1,
, Kn-Vn], where each key, Ki, is a unique integer, and each Vi is a domain variable or an integer. This constraint is true if every element of L is equal to some key, and if, for each pair Ki-Vi, exactly Vi elements of L are equal to Ki. This constraint is a generalization of the fd_exactly constraint.
- cumulative(Starts,Durations,Resources,Limit):
This constraint is useful for describing and solving scheduling problems. The arguments Starts, Durations, and Resources are lists of integer domain variables of the same length, and Limit is an integer domain variable. Let Starts be [S1, S2,
, Sn], let Durations be [D1, D2,
, Dn], and let Resources be [R1, R2,
, Rn]. For each job i, Si represents the start time, Di represents the duration, and Ri represents the number of resources that is needed. Limit is the number of resources that is available at any time.
- serialized(Starts,Durations):
This constraint describes a set of non-overlapping tasks, where Starts and Durations must be lists of integer domain variables of the same length. Let Os be a list of 1's of the same length as Starts. This constraint is equivalent to cumulative(Starts,Durations,Os,1).
- post_disjunctive_tasks(Disjs):
Disjs is a list of terms, each in the form disj_tasks(S1,D1,S2,D2), where S1 and S2 are two integer domain variables, and D1 and D2 are two positive integers. This constraint is equivalent to posting the disjunctive constraint S1+D1
#=<
S2 #\/
S2+D2 #=<
S1 for each term disj_tasks(S1,D1,S2,D2) in Disjs, but it may be more efficient, since it converts the disjunctive tasks into global constraints.
- diffn(L):
This constraint ensures that no two rectangles in L overlap with each other. A rectangle in an n-dimensional space is represented by a list of 2 x n elements [X1, X2,
, Xn, S1, S2,
, Sn], where Xi is the starting coordinate of the edge in the ith dimension, and Si is the size of the edge.
- count(Val,List,RelOp,N):
Let Count be the number of elements in List that are equal to Val. Then, the constraint is equivalent to
Count RelOp N
. RelOp can be any arithmetic constraint symbol.
- circuit(L):
Let L be a list of variables [
], where each Xi has the domain 1..n. A valuation X1=v1, X2=v2,
, Xn=vn satisfies the constraint if 1->v1, 2->v2, ..., n->vn forms a Hamilton cycle. To be more specific, each variable has a different value, and no sub-cycles can be formed. For example, for the constraint circuit([X1,X2,X3,X4]), [3,4,2,1] is a solution, but [2,1,4,3] is not, because it contains sub-cycles.
- path_from_to(From,To,L): Let L be a list of domain variables [V1, V2,
, Vn] representing a directed graph. This constraint ensures that there is always a path from From to To. For each domain variable Vi, let vi be a value in the domain of Vi. It is assumed that there is an arc from vertex i to vertex vi in the directed graph, and that vi is in 1..n. It is also assumed that From and To are two integers in 1..n.
- path_from_to(From,To,L,Lab): Let L be a list of terms
aa aaa aaa aaa aaa aaa aaa
[node(LabV1,V1),
, node(LabVn,Vn)]
where LabVi is a domain variable representing the label to be assigned to node i, and Vi is a domain variable representing the set of neighboring vertices that are directly reachable from node i. This constraint ensures that there exists a path of vertices all labeled with Lab from From to To, and that all of the vertices that are labeled with Lab are reachable from vertex From.
- paths_from_to(Connections,L): This constraint is a generalization of the path_from_to(From,To,L,Lab) constraint for multiple paths, where Connections gives a list of connections in the form [(Start1,End1,LabC1),
,(Startk,Endk,LabCk)], and L gives a directed graph in the form [node(LabV1,V1),
, node(LabVn,Vn)]. This constraint ensures that, for each connection (Starti,Endi,LabCi), there is a path of vertices that are all labeled with LabCi from Starti to Endi in the directed graph, such that no two paths intersect at any vertex, and such that all of the vertices that are labeled with LabCi can be reached from Starti.