Harmon Nine wrote:

Please forgive if this question has already been asked. I couldn't find it in the mail archives ...

Why does this work?

proc {Grocery Root}
   A#B#C#D = Root
   S       = 711
in
   Root ::: 0#S
   A+B+C+D =: S
   A*B*C*D =: S*100*100*100
   %% eliminate symmetries
   A =<: B
   B =<: C
   C =<: D
   {FD.distribute generic(value:splitMax) Root}
end


While substituting the S with its value does not? I.e. The following gives a type error when run using {ExploreAll Grocery}:

proc {Grocery Root}
   A#B#C#D = Root
in
   Root ::: 0#711
   A+B+C+D =: 711
   A*B*C*D =: 711*100*100*100
   %% eliminate symmetries
   A =<: B
   B =<: C
   C =<: D
   {FD.distribute generic(value:splitMax) Root}
end

It's very simple: the number 711*100*100*100 is too large to be passed to a FD constraint (a simple overflow). The first example works because the large number is *inside* the =: constraint.

Peter

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

Reply via email to