[gecode-users] Value intersection problem

Anden blah anden_blah at hotmail.com
Fri Jan 23 16:44:19 CET 2009


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.


_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/photos.aspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20090123/8136dcc8/attachment.htm>


More information about the gecode-users mailing list