[gecode-users] data structure for effiency

Serdar Kadioglu serdark at su.sabanciuniv.edu
Thu Mar 15 14:42:57 CET 2007


Hi! 

I would like to keep variables in a matrix data structure. 
Array of arrays like VarArray<VarArray<IntVar>> did not work. 
My aim is to reach a cell with an unknown row_IntVar , and known column_int 

If I flatten everything in one dimensional VarArray
then to reach a cell I call; 

        element(Intvar_row * #of columns + column_int).

This multiplication and addition is just an index arithmetic but forces me to call
two linear() operations and create many redundant IntVar's for every j.

Is there an efficient way of reaching these cells, 
(may be a 2D structure that I am unaware of probably)
because this bottleneck really slows down the model. 

Regards,
serdar




More information about the gecode-users mailing list