Hi The values were not sorted. We sorted the values before using them with inter_v and ít solved the problem. :-)
I have a small follow-up question regarding advisors: We use a series of advisors to schedule the propagator, but we are uncertain on what ModEvent is used, if the domain of the variable the advisor is attached to becomes smaller, but is still larger than 1? Kind regards Morten Christian Schulte skrev: > Hi > > > > Are the values sorted? They must be even though the documentation > doesn’t say it (damn). > > > > Christian > > > > -- > > Christian Schulte, www.it.kth.se/~cschulte/ > > > > *From:* users-boun...@gecode.org [mailto:users-boun...@gecode.org] *On > Behalf Of *Anden blah > *Sent:* Friday, January 23, 2009 4:44 PM > *To:* us...@gecode.org > *Subject:* [gecode-users] Value intersection problem > > > > Hi > > I am trying to restrict the values of an IntView by doing the following: > ...(values is given as parameter for the method containing this code, > the type is const set<string>& ) > > > vector<string> v; > > for(set<string>::const_iterator setIt = values.begin(); setIt!= > values.end(); setIt++) > { > v.push_back(*setIt); > } > GECODE_AUTOARRAY(int,restrictedDoms,v.size()); > for(int i=0;i<v.size();i++) > { > restrictedDoms[i] = atoi(v[i].c_str()); > } > Gecode::Iter::Values::Array restrictIterator(restrictedDoms, v.size()); > > return iv.inter_v(homeFZ, restrictIterator, false); > > --- > > I can inspect the code and see that the values contained in > "restrictedDoms" are the values 1 to 10. Furthermore I can see that > iv.size() is 10 (values 1 to 10) before the call to inter_v (and > unassigned of course). Then after the call to inter_v, iv is assigned, > and I can see that the value it is assigned to is the first value in the > restrictedDoms array. > > So what am I doing wrong? > > Thanks! > > Andreas > > p.s. Of course it is useless to intersect a variable with domain 1 to > 10 with the values 1 to 10, but still the behavior is unexpected. > > ------------------------------------------------------------------------ > > What can you do with the new Windows Live? Find out > <http://www.microsoft.com/windows/windowslive/default.aspx> > > > ------------------------------------------------------------------------ > > _______________________________________________ > Gecode users mailing list > us...@gecode.org > https://www.gecode.org/mailman/listinfo/gecode-users _______________________________________________ Gecode users mailing list us...@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users