Denys Duchier wrote:
> Guido Tack <[email protected]> writes:
>
>> These element constraints are for 2d matrices of width w and height h
>> encoded in the IntVarArgs a.
>
> that's the missing information. the constraint is then actually:
> a(x,y) = z
> or is it:
> a(y,x) = z
> for a matrix a or width w and height h. It would be really nice to make
> this clear.
The constraint is a[x+w*y] = z, and w*h must be a.size(), just as the
documentation says.
I don't want to discuss whether that's a(x,y) or a(y,x) because there's been
enough confusion about the Matrix class already... In programming terms (as
opposed to mathematics), a is a 2d array in row-major order, and z is
constrained to be the element in row y and column x. I'll add that to the
documentation.
The minimodel library contains element constraints on Matrix objects, which of
course internally use these post functions.
Cheers,
Guido
--
Guido Tack, http://people.cs.kuleuven.be/~guido.tack/
_______________________________________________
Gecode users mailing list
[email protected]
https://www.gecode.org/mailman/listinfo/gecode-users