[Oz] Multiple evaluation question
Denys Duchier
Denys.Duchier at ps.uni-sb.de
Wed Feb 10 10:26:50 CET 1999
khoxsey at ix.netcom.com (Kent Hoxsey) writes:
> My model has a rule that says a certain two of the attributes of an item
> cannot be the same, which I define as a reified constraint:
>
> declare X Y R in {FD.decl X} {FD.decl Y} R::0#1
> R = (X \=: Y)
>
> Now imagine I have two items, each with two attributes:
>
> A = item(attr1:1 attr2:2)
> B = item(attr1:1 attr2:1)
>
> What I would like to do is to apply a procedure to item A, save the
> value of R, and then apply the procedure to item B and again save the
> value of R.
This is what abstractions are for:
declare Rs = {Map [A B] fun {$ I} I.attr1\=:I.attr2 end}
Now Rs contains a list of boolean variables resulting from evaluating
the reified constraint for each item.
However I wonder why you are using a reified constraint. If the only
valid models of your problem are those where the attributes are
different, then why not just pose this constraint.
{ForAll [A B] proc {$ I} I.attr1\=:I.attr2 end}
Am I misunderstanding your problem? Also, your example above has items
with determined attributes; in that case, of course, constraints are
pointless since there is nothing to be constrained.
I hope this helped. The "Finite Domain Constraint Programming
Tutorial" is also well worth reading; it has loads of examples that
may help clarify things a bit.
Sincerely,
--
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