Thanks, Peter and Torsten. Is there documentation of how Oz transforms
constraint expressions using operators into calls to FD functions? At the
moment it's a bit of a mystery to me.

I had suspected that about the temporary variables. I wasn't sure whether
the expression parser was smart enough to turn them into FD variables or
not. Though this issue came up a lot more in the SEND+MORE=MONEY
generalization problem.

If I write the following constraint, where A, B, C, D and E have already
been declared as FD variables, how does it get translated into functions?

A+B+C := D+E

I guess it can't be {FD.Sum [A B C] ':='} = {FD.Sum [D E] ':='}, because
that would create a temporary, non-FD variable. So does it translate as
{FD.SumC [1 1 1 ~1 ~1] [A B C D E] ':=' 0}? Or does it not try to translate
it at all?

Anyway, it turns out that I can't use 711*1000000 on the RHS because it is
pre-reduced to a constant that is too large to be used in an FD constraint.
But when I wrote:

Item1*Item2*Item3*Item4 =: S*1000000

it worked fine. What is that getting translated to? There doesn't seem to be
an FD.mulC that takes an arbitrary number of arguments, so it seems to
require temporary variables, yet it works.

Also, it seems to me that temporary variables could, in some cases at least,
be automatically range-determined. E.g., if [A B C]::1###1000, and V is
unbound, then:

A+B+C =: V

should be enough for Oz to determine that V must be an FD variable with a
range from 3 to 3000. I think it would get more difficult to determine in
arbitrarily complex equations, though.

- Lyle
_________________________________________________________________________________
mozart-users mailing list                               
mozart-users@mozart-oz.org
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to