That's more difficult. Let's say your variable that contains the required array length is called x. You either need to decompose your model into two parts (the first part determining x, the second part then using that solution to construct a new model with the right length), or you need to allocate an array with the maximum possible length and use constraints to say that everything beyond index x is ignored.
Cheers, Guido On 15/08/2013, at 8:08 AM, Ajit Dingankar <ajit.dingan...@gmail.com> wrote: >> Try to use a variable of IntVarArgs while constructing the model to which >> additional variables can be added. Then, after you are done with >> constructing your model you can copy the elements of the IntVarArgs into an >> IntVar Array. >> >> Not sure that this actually answers your question. >> >> Cheers >> Christian > > Thanks, Christian! I think your suggestion is the same as Tip 4.5, but > my problem is that the terminating condition for the while loop there > (or "how many variables should be added") depends on the solution of > the IntVar representing the size; unlike the case for Tip 4.5 where > the size is read from a file (or is a known value obtained somehow). > > Thanks, > Ajit > ==== > > > > _______________________________________________ > Gecode users mailing list > users@gecode.org > https://www.gecode.org/mailman/listinfo/gecode-users _______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users