[gecode-users] missing doc for element constraint
Guido Tack
tack at gecode.org
Thu Aug 5 10:56:46 CEST 2010
Denys Duchier wrote:
> Guido Tack <tack at gecode.org> 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/
More information about the users
mailing list