[gecode-users] Enumerating assignments removed by other propagators since last propagate call

Peter Tiedemann petert at itu.dk
Tue Mar 27 18:32:06 CEST 2007


Hi,

Im trying to write an N-ary propagator that when propagating needs to
do some work for each assignment xi = a that was previously allowed
but which have now been pruned by another propagator.

As far as i can tell, Gecode doesnt maintain this information for me,
so a simple and reasonably efficient way to find this seems to
maintain a clone of the domain as it where in the previous call to
propagate,  then for each variable xi check if the domain size has
changed, and if so iterate through the old domain of xi, checking each
value for membership in the new domain for xi.

I have a added a ViewArray<IntView xOld to my propagator to be the
copy of the previous domains.

It would seem that all i have to do is to clone x in the beginning of
the very first propagate call, in the end of every propagate call and
remember to clone xOld when asked to clone the propagator. Is that
correct?

If this is the right way to handle this, what is the correct way to
clone the ViewArray x/xOld? Should i use "xOld.update(home,false,x);",
"xOld = ViewArray<IntView>(home,x);" or something else entirely?

So far my attempts have caused some strange behavior, so im guessing
that i have misunderstood something :)

I could of course just implement my own lists of previously allowed
assignments, but i would like to understand what im doing wrong.

Regards,
Peter Tiedemann




More information about the gecode-users mailing list