[gecode-users] Iterating/filtering IntView in Gecode 3.x

Peter Vanhee peter.vanhee at gmail.com
Fri Mar 19 15:46:40 CET 2010


Hey all,

I have more or less the same problem as mentioned here: http://thread.gmane.org/gmane.comp.lib.gecode.user/919,
however the solution seems to be outdated for gecode 3.x: e.g. GECODE_AUTOARRAY is not existing anymore etc.

Within the binary propagator, and when one variable is assigned (x0), I need to filter values in the other variable (x1). 
What I do right  now is:

// loop over all values of x1 and push to remove if necessary
vector<int> remove;
for (IntVarValues i(*x1); i(); ++i) {
	if (!predicate(home, x0->val(), i.val())) remove.push_back(i.val());
}

// remove values from domain
for(vector<int>::iterator i=remove.begin(); i!=remove.end(); ++i) {
	GECODE_ME_CHECK(x1->nq(_home, r));
}


This is not at all efficient:  90% of the time is spent in Int::IntVarImp::nq_full, and 38% in Int::IntVarImp::RangeList::min().
How can I change this? 

I have variables with big domains (into the millions of values) that have few continuous ranges.

Thanks,
Peter




More information about the users mailing list