next up previous
Next: Finite Domains (III) Up: Adding Computation Domains: CLP Previous: Finite Domains (I)

Finite Domains (II)

  $\mbox{$\bullet$}$
Example:
?- X #= A + B, A::1..3, B::3..7.
X::4..10, A::1..3, B::3..7, X #= A + B
  $\mbox{$\bullet$}$
The respective minimums and maximums are added
  $\mbox{$\bullet$}$
There is no unique solution
?- X #= A - B, A::1..3, B::3..7.
X::-6..0, A::1..3, B::3..7, X #= A - B
  $\mbox{$\bullet$}$
The minimum value of X is the minimum value of A minus the maximum value of B
  $\mbox{$\bullet$}$
(Similar for the maximum values)
  $\mbox{$\bullet$}$
Putting more constraints:
?- X #= A - B, A::1..3, B::3..7, X #>= 0.
A = 3, B = 3, X = 0



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