[gecode-users] Dynamic size of IntVarArray in Gecode 3.4.0

Mikael Zayenz Lagerkvist zayenz at gmail.com
Fri Sep 10 16:39:05 CEST 2010


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#l00852

2010/9/10 Nacho <ncasti at fdi.ucm.es>:
> 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
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
>
>



-- 
Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/



More information about the users mailing list