15.5.4 Choice Points versus Choice Variables

Unlike in Prolog, an Oz disjunction does not create a choice point,i.e. a case distinction. The only way to commit to one alternative is to cause all the others to become inconsistent.

<Disjunctive Propagator>=
or {Equal N M}  then skip 
[] {DomPlus N M} then skip 
[] {DomPlus M N} then skip 
[] {Side N M}
end

Yet, in order to perform search, we often need to force commitment to one or the other alternative. The standard trick in constraint programming is to introduce a choice variable, also known as a control variable.

We control the alternatives by a choice variable C. C is a finite domain variable with the domain 1#4; simply by equating it with 1, 2, 3 or 4, we can commit to the corresponding alternative.

<Choice Variables>=
or C=1 {Equal N M}  then skip 
[] C=2 {DomPlus N M} then skip 
[] C=3 {DomPlus N M} then skip 
[] C=4 {Side N M} then skip 
end

By distributing the values of the finite domain contol variable C we can now created choice points on need by

{FD.distribute naive [C]}

.


Denys Duchier, Claire Gardent and Joachim Niehren
Version 1.3.99 (20050412)