[gecode-users] Value intersection problem

Morten Boysen boysen at itu.dk
Mon Jan 26 21:19:33 CET 2009


Hi Christian

Thank you very much for clarifying that for me. I think what confused 
me, is that the documentation on MedEvent, seen here 
http://www.gecode.org/gecode-doc-latest/group__TaskVarMEPC.html#gfa985ae465bd12df08e29252cdb7519b, 
only mentions Gecode::ME_GEN_FAILED, Gecode::ME_GEN_NONE and 
Gecode::ME_GEN_ASSIGNED.

Kind regards
Morten Boysen

Christian Schulte skrev:
> Dear Morten,
> 
> thanks for reposting!
> 
> The ModEvent depends not only on size but on the type of domain: a
> modification event is meant to capture how a domain changes. So for
> integers:
>  - If the domain has size > 1 and turns to size 1, you get ME_INT_VAL
>  - If the domain has size > 1 and turns to size > 1 and either the min or
> max change you get ME_INT_BND
>  - Otherwise, you get ME_INT_DOM (some inner values got removed).
> 
> As you see, this depends on the variable type. You can always assume that
> the value for modification event triggered on assignment equals
> ME_GEN_ASSIGNED (that is, ME_INT_VAL == ME_GEN_ASSIGNED).
> 
> Hope that helps
> Christian
> 
> --
> Christian Schulte, www.ict.kth.se/~cschulte/
> 
> -----Original Message-----
> From: Morten Boysen [mailto:boysen at itu.dk] 
> Sent: Sunday, January 25, 2009 10:57 PM
> To: Christian Schulte
> Cc: 'Anden blah'; users at gecode.org
> Subject: Re: [gecode-users] Value intersection problem
> 
> Hi Christian
> 
> Below is my reply, which I have changed a little bit since the original 
> reply was badly worded on my part:
> 
> 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 becomes smaller, but 
> is still larger than 1? That is, if the domain is reduced to size 1, the 
> ModEvent is ME_GEN_ASSIGNED, but wha ModEvent is used if the size is 
> decreased from e.g. 4 to 3?
> 
> Kind regards
> Morten
> 
> 
> Christian Schulte skrev:
>> Sorry, guys: somebody answered that email but somehow I must have 
>> deleted that… Could that person please resend the message. Thanks a bunch!
>>
>>  
>>
>> Sorry again from an idiot who cannot handle his mail client
>>
>> Christian
>>
>>  
>>
>> --
>>
>> Christian Schulte, www.it.kth.se/~cschulte/
>>
>>  
>>
>> *From:* users-bounces at gecode.org [mailto:users-bounces at gecode.org] *On 
>> Behalf Of *Christian Schulte
>> *Sent:* Friday, January 23, 2009 5:05 PM
>> *To:* 'Anden blah'; users at gecode.org
>> *Subject:* Re: [gecode-users] Value intersection problem
>>
>>  
>>
>> 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-bounces at gecode.org [mailto:users-bounces at gecode.org] *On 
>> Behalf Of *Anden blah
>> *Sent:* Friday, January 23, 2009 4:44 PM
>> *To:* users at 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
>> users at gecode.org
>> https://www.gecode.org/mailman/listinfo/gecode-users
> 
> 





More information about the gecode-users mailing list