On 11/29/06, Pieter Thysebaert <[EMAIL PROTECTED]> wrote:
I'm using Gecode 1.2.2 and am wondering if there is a common practice
for declaring n-dimensional matrices of integer variables, with n > 2
(From what I see, MiniModel::Matrix is for 2-d matrices).
Can it be done using the available variable array classes? (building
arrays of arrays of IntVarArrays) ?
Hi,
The Matrix class is, as you've correctly identified, a 2-d matrix class.
Before we had the Matrix class, our common practice for matrices was
to declare an IntVarArray and then to write accessor-functions like to
following
IntVar& y(int i, int j) {
return x[i*n*n+j];
}
This idea can be naturally extended to handle more than two dimensions.
Cheers,
Mikael
--
Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/
_______________________________________________
Gecode users mailing list
[EMAIL PROTECTED]
https://www.gecode.org/mailman/listinfo/gecode-users