Hi, Thank you very much for your help. It works! Best regards, Nacho
-----Mensaje original----- De: Mikael Zayenz Lagerkvist [mailto:[email protected]] Enviado el: viernes, 10 de septiembre de 2010 16:39 Para: Nacho CC: [email protected] Asunto: Re: [gecode-users] Dynamic size of IntVarArray in Gecode 3.4.0 Hi, There are several ways that you can achieve what you want. A simple solution is to just construct a new variable array, and to assign it to the relevant member variable. Alternatively, you could store your variables in an alternate data-structure and updating the variables manually. Updating the variables is not actually magic, what you need to do is to allocate the new data-structure, and then to update each new variable from its corresponding variable in the old space (compare with the code for update in VarArray[1]). Hope this helps, Mikael [1] http://www.gecode.org/doc-latest/reference/kernel_2array_8hpp_source.html#l0 0852 2010/9/10 Nacho <[email protected]>: > Hi, > > I have migrated from Gecode 3.2.2 to Gecode 3.4.0 today. I have read the > Changelog about the new IntVarArray API and I can not find out how to adapt > our previous implementation to the current framework. > > > > We need to use Gecode to reason with models where constraints and variables > can be added and removed. As a new constraint is processed, it is added to > the Space and propagated. New variables appearing in this constraint are > added to an IntVarArray, which is updated by the Space copy function. In > order to backtrack to previous models (removing constraints and variables), > each time a new constraint is processed we clone the Space. > > > > In Gecode 3.4.0, dynamically addition of IntVars to an IntVarArray is no > more supported. This is possible by using IntVarArgs, but, I need to update > the variable data structure with each new constraint being processed, and > IntVarArgs can not be updated. The MPG.pdf includes Tip 4.5 for dynamically > constructing problems, but I think this can not address the behaviour we > want to achieve. Do you have any ideas of how to address my problem? > > > > Thank you very much in advance, > > Nacho > > _______________________________________________ > Gecode users mailing list > [email protected] > https://www.gecode.org/mailman/listinfo/gecode-users > > -- Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/ _______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
