Malcolm Ryan wrote: > Currently, I create an IntVarArray as: > > vars = IntVarArray(space, N); > > and then incrementally create variables as: > > vars[t] = IntVar(space, domainSet); > > My question is: does this actually save memory? I assume that creating > the array created N 'uninitialised' IntVars. Are these variables > significantly smaller than initialised IntVars? Or is this a false > saving?
An IntVar is just a container for a pointer to an "IntVar implementation". An uninitialized IntVar therefore is much smaller than an actual IntVar. > Would I be better to create a smaller IntVarArray and replace > it with an incrementally longer one as variables are created? You can grow IntVarArrays incrementally using the add method (they are resized automatically). That way you may save some more memory, and all the IntVars in the array are initialized at all times. Otherwise you can't e.g. call update on the array, you always have to update the variables individually, right? Cheers, Guido _______________________________________________ Gecode users mailing list us...@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users