[gecode-users] iterating/filtering IntView

Kilian Sprotte ml13 at onlinehome.de
Mon May 14 20:16:01 CEST 2007


Hi,

I am inside a propagate method of a binary propagator... :)

At some point, I know that x0 is assigned. What I would like to do is  
to filter the domain of x1 using a given predicate function.

if (x0.assigned()) {
    IntVarValues r1(x1);
    while (r1()) {
      if (!my_predicate(x0.val(), r1.val()))
        GECODE_ME_CHECK(x1.nq(home, r1.val()))
      ++r1;
    }
    return ES_SUBSUMED;

It does not seem to be a good idea however to alter the view x1 while  
iterating over it...(is it true that this should not be done/will  
cause problems?)

Hhm, could anyone give me a hint, what I could use in order to do  
this safely?

Thanks a lot,
   Kilian





More information about the gecode-users mailing list