next up previous index
Next: Examples Up: The Set Domain Library Previous: The solver   Index

Constraint predicates

?Svar `:: ++Glb..++Lub

attaches a domain to the set variable or to a list of set variables Svar. If Glb is not a subset of Lub it fails. If Svar is already a domain variable its domain will be updated according to the new domain; if Svar is instantiated it fails. Otherwise if Svar is free it becomes a set variable.
set(?Term)
succeeds if Term is a ground set.
?S `= ?S1
The value of the set term S is equal to the value of the set term S1.
?E in ?S
The element E is an element of S. If E is ground it is added to the lower bound of the domain of S, otherwise the constraint is delayed. If E is ground and does not belong to the upper bound of S domain, it fails.
?E notin ?S
The element E does not belong to S. If E is ground it is removed from the upper bound of S, otherwise the constraint is delayed. If E is ground and belongs to the upper bound of the domain of S, it is removed from the upper bound and the constraint is solved. If E is ground and belongs to the lower bound of S domain, it fails.
?S `< ?S1
The value of the set term S is a subset of the value of the set term S1. If the two terms are ground sets it just checks the inclusion and succeeds or fails. If the lower bound of the domain of S is not included in the upper bound of S1 domain, it fails. Otherwise it checks the inclusion over the bounds. The constraint is then delayed.
?S `<> ?S1
The domains of S and S1 are disjoint (intersection empty).
all_union(?Lsets, ?S)
Lsets is a list of set variables or ground sets. S is a set term which is the union of all these sets. If S is a free variable, it becomes a set variable and its attached domain is defined from the union of the domains or ground sets in Lsets.
all_disjoint(?Lsets)
Lsets is a list of set variables of ground sets. All the sets are pairwise disjoint.
#(?S,?C)
S is a set term and C its cardinality. C can be a free variable, a finite domain variable or an integer. If C is free, this predicate is a mean to access the set cardinality and attach it to C. If not, the cardinality of S is constrained to be C.
sum_weight(?S,?W)
S is a set variable whose domain is a weighted domain. W is the weight of S. If W is a free variable, this predicate is a mean to access the set weight and attach it to W. If not, the weight of S is constrained to be W. e.g.
S `:: {e(2,3)}..{e(2,3), e(1,4)}, sum_weight(S, W)
returns W :: 3..7.
refine(?Svar)
If Svar is a set variable, it labels Svar to its first possible domain value. If there are several instances of Svar, it creates choice points. If Svar is a ground set, nothing happens. Otherwise it fails.


next up previous index
Next: Examples Up: The Set Domain Library Previous: The solver   Index
Warwick Harvey
2004-08-07