[Oz] Help: choice statement ...
Denys Duchier
Denys.Duchier at ps.uni-sb.de
Fri Jan 7 09:08:19 CET 2000
ravi at konark.ncst.ernet.in (P Ravi Prakash) writes:
> I have a question regarding `choice' statement in distributers. The
> documentation says that the 2 choices (Var = Val and Var \= Val) created
> by this statement could be executed in any order. Is there any way to
> force the order?
Let me add my 2 cents to Christian's reply.
A frequent technique for exercising control over the distribution
strategy is to introduce a "control" or "choice" variable I:
I::1#3
thread
or I=1 {P1}
[] I=2 {P2}
[] I=3 {P3}
end
end
Now all you need to do is decide what distribution strategy to apply
to I. For example {FD.distribute naive [I]} gives you back what you
got by just using choice directly. However, much more is possible.
E.g. using this technique, you can easily obtain constructive
disjunction for I by splitting the above 3 way disjunction into 3
disjunctions, one for each possible value of I:
thread
or I=1 {P1} [] I\=:1 end
end
thread
or I=2 {P2} [] I\=:2 end
end
thread
or I=3 {P3} [] I\=:3 end
end
Thus, if {P2} is inconsistent, 2 is removed from the domain of I.
Cheers,
--
Dr. Denys Duchier Denys.Duchier at ps.uni-sb.de
Forschungsbereich Programmiersysteme (Programming Systems Lab)
Universitaet des Saarlandes, Geb. 45 http://www.ps.uni-sb.de/~duchier
Postfach 15 11 50 Phone: +49 681 302 5618
66041 Saarbruecken, Germany Fax: +49 681 302 5615
-
Please send submissions to users at mozart-oz.org
and administriva mail to users-request at mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.
More information about the mozart-users
mailing list