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

Christian Schulte cschulte at kth.se
Fri Mar 19 15:55:53 CET 2010


Peter,

the changelog for the transitions from 1.* to 2.* and 2.* to 3.* actually
tells you what and how to change.

Then, we are currently in the process of writing "Modeling and Programming
with Gecode". Please give me 30 minutes to send out an annoucement of a
draft. The draft has a chapter that addresses your problem!

Christian

--
Christian Schulte, www.ict.kth.se/~cschulte/


-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Peter Vanhee
Sent: Friday, March 19, 2010 3:47 PM
To: users at gecode.org
Subject: [gecode-users] Iterating/filtering IntView in Gecode 3.x

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


_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users




More information about the users mailing list