Hi folks,
I'm working through the constraint problems in Chapter 12 of CTM. Problem #2
involves finding the prices which, when summed equal $7.11, and when
multiplied also equal $7.11. I wrote the following solution:
proc {Grocery ?Sol}
sol(Item1 Item2 Item3 Item4)=Sol
in
Item1::1#711
Item2::1#711
Item3::1#711
Item4::1#711
Item1+Item2+Item3+Item4 =: 711
Item1*Item2*Item3*Item4 =: 711000000
Item1 =<: Item2
Item2 =<: Item3
Item3 =<: Item4
{FD.distribute naive Sol}
end
{Browse {SolveAll Grocery}}
But I get an error I don't understand:
Mozart Engine 1.4.0 (20090523) playing Oz 3
%*************************** type error *************************
%**
%** Expected type: vector of integer in [~134 217 727,...,134 217 727]
%** At argument: 1
%** In statement: {FDP.sumCN ~711000000#1
'#'(1)#(_{1#708}#_{1#708}#_{1#708}#_{1#708}) '=:' 0}
%**
%** Call Stack:
%** procedure 'FDSumCN' in file
"c:/cygwin/home/yjaradin/mozart/share/lib/compiler/RunTime.oz", line 314,
column 3, PC = 31934008
%**--------------------------------------------------------------
Well I didn't call FDP.sumCN directly, so I must have done something wrong
on the line multiplying the four items. I don't know what. Any ideas?
Thanks,
Lyle
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users