I am using a simple problem to learn Constraint Programming in Oz (after
reading the manual, believe it or not).

Problem:
Bag of numbers [7 7 7 11 13 13 13 16 19 19 21 23 27 37 41 56 56 61 73 77 97]
orlese (3#7 1#11 3#13 1#16 2#19 1#21 1#23 1#27 1#37 1#41 2#56 1#61 1#73 1#77
1#97)

Formula: A*B+C-D+E

(Add anti-symmetry B =<: A E =<: C)

Solution Set: [94 134 233 426 496 915 917 1072 1431 1553 1569 1580 1622 1673
1886 1922 2094 2139 2249 2437 2491 2569 2714 2812]

One solution is not possible (2437)

(I used solution(a:A b:B c:C d:D e:E))

My questions:
* How to represent the Bag (List above) constraint - 1? I thought of "take A
from (Set from) Bag. Now take B from (Set from) Bag minus A, etc. I am not
sure how to represent this.
* How to represent the Bag constraint - 2? I thought of using a solution
similar to the Change example using the tuple example above. Then how do you
check that you have used up all the 7's, 11's etc.? Can you count the use in
the solution, if the solution is not yet bound?
* How do you find the Failed solution (2437)? (I just did it "by
inspection")
* I am somewhat confused where in the = (vs. =:) is used in constraints, as
they apply to variables. I understand that = can block, yet I see it used in
examples. (e.g. Nb.english = Nb.red)


Any help in my learning would be much appreciated. Thanks.

Alex


_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to