next up previous
Next: A Project Management Problem Up: Adding Computation Domains: CLP Previous: Finite Domains (II)

Finite Domains (III)


Some useful primitives in finite domains:

  $\mbox{$\bullet$}$
mindomain(X, T): the term T is the minimum value in the domain of the variable X
  $\mbox{$\bullet$}$
This can be used to minimize (c.f., maximize) a solution
?- X #= A - B, A::1..3, B::3..7,
mindomain(X, X).
A = 1, B = 7, X = -6
  $\mbox{$\bullet$}$
labeling(VarList): instantiates variables in VarList to values in their domains
?- X*X + Y*Y #= Z*Z, X#>0, Y#>0, Z#>0, labeling([Z,X,Y]).
Z = 5, X = 3, Y = 4 ;
Z = 5, X = 4, Y = 3 ;
Z = 10, X = 6, Y = 8 ;

(variables have a large domain by default)



Last modification: Thu Oct 7 12:04:03 MEST 1999 <webmaster@clip.dia.fi.upm.es>