[gecode-users] Reified Constraints do not propagate

Max Ostrowski ostrowsk at cs.uni-potsdam.de
Tue Apr 17 09:41:09 CEST 2012


Big thanks for this, will make things so much easier.

Best,
Max


On 04/17/2012 01:20 AM, Guido Tack wrote:
> Hi,
>
> I just added a fix to the svn trunk for the case of a reified equality
> between an IntVar and an int.  The default ICL for that case is now
> ICL_DOM (consistent with just using rel directly).
>
> Other cases (e.g. equality between two variables) may still ignore the
> ICL, but we'll have a look at that, too.
>
> Cheers,
> Guido
>
> -- 
> Guido Tack
> http://www.csse.monash.edu/~guidot/
> <http://www.csse.monash.edu/%7Eguidot/>
>
>
>
> On 13/04/2012, at 9:17 PM, Max Ostrowski wrote:
>
>> Thanks and sorry for bugging you again.
>>
>> I tried to analyze the minimodel code.
>> I think that posting LinExpr instead of LinRel won't change the
>> problem, right?
>> So is there any interface so that one can still use the very handy
>> LinExpr class?
>> I do parse some quite complicated formulas and want to post a
>> linear() constraint.
>> LinExpr as far as I understood, optimizes this formula and
>> reformulates it to fit into the form that is needed for the linear
>> constraint.
>> Is there a way to get this linear constraint out of it again to post
>> it manually and preserve the ICL?
>>
>> Or do i have to generate the linear constraint (array of variables
>> and numbers) myself to get the full propagation power. Is there a
>> logical reason why the ICL is lost during this "translation"?
>>
>> Best,
>> Max
>>
>> On 04/10/2012 01:19 PM, Christian Schulte wrote:
>>>
>>> Maybe, not so clear yet. We will change reification for the next
>>> major release and might at that time also think how to fix passing
>>> the consistency level.
>>>
>>>  
>>>
>>> For the time being you should stick to what Guido has suggested.
>>>
>>>  
>>>
>>> Christian
>>>
>>>  
>>>
>>> --
>>>
>>> Christian Schulte, www.ict.kth.se/~cschulte/
>>>
>>>  
>>>
>>> *From:* users-bounces at gecode.org [mailto:users-bounces at gecode.org]
>>> *On Behalf Of *Max Ostrowski
>>> *Sent:* Tuesday, April 10, 2012 12:42 PM
>>> *To:* Guido Tack
>>> *Cc:* users at gecode.org
>>> *Subject:* Re: [gecode-users] Reified Constraints do not propagate
>>>
>>>  
>>>
>>> Thank you very much for the insight.
>>> Unfortunately this could be a problem,
>>> as i have to change my data structures.
>>>
>>> Will this be fixed in future versions?
>>>
>>> Best,
>>> Max
>>>
>>> On 04/10/2012 12:32 PM, Guido Tack wrote:
>>>
>>> This is a current shortcoming of the minimodel library.  For some
>>> linear constraints (such as x==5 in this case) the IntConLevel is
>>> ignored.  To get the full propagation, you have to post the
>>> constraint directly, like this:
>>>
>>>  
>>>
>>> Gecode::rel(*test, test->x_[1], IRT_EQ, 5, test->b_[1], ICL_DOM);
>>>
>>>  
>>>
>>> Cheers,
>>>
>>> Guido
>>>
>>>  
>>>
>>> On 10 Apr 2012, at 19:20, Max Ostrowski wrote:
>>>
>>>
>>>
>>> I have a small example where i do not understand why no propagation
>>> takes place.
>>>
>>> test is a pointer to the space instance
>>> x_ is an array of 10 IntVars(0,10)
>>> b_ is an array of 2 BoolVars(0,1)
>>>
>>>
>>>     LinRel rel1(test->x_[0],IRT_EQ,5);
>>>     rel1.post(*test,true,ICL_DEF);
>>>
>>>     Gecode::distinct(*test,test->x_,ICL_DEF);
>>>
>>>     LinRel rel2(test->x_[1],IRT_EQ,5);
>>>     Gecode::rel(*test, rel2 == test->b_[1],ICL_DEF);
>>>
>>>     test->status();
>>>     if (test->failed())
>>>         std::cout << "Failed" << std::endl;
>>>     std::cout << test->x_ << std::endl;
>>>     std::cout << test->b_ << std::endl;
>>>
>>>
>>> So i post das one of my elements x_[0] is 5, and all elements are
>>> distinct.
>>> Now i have a reified constraint that x_[1] == 5.
>>> The distinct constraint removes 5 from he domain of x_[1],
>>>  but the propagator does not fire.
>>> The result is:
>>>
>>> {5, {0..4,6..10}, {0..4,6..10}, {0..4,6..10}, {0..4,6..10},
>>> {0..4,6..10}, {0..4,6..10}, {0..4,6..10}, {0..4,6..10}, {0..4,6..10}}
>>>
>>> {[0..1], [0..1]}
>>>
>>>
>>> Even with ICL_DOM the boolean variable is not touched if values are
>>> removed from the domain.
>>> Also i think this could be easily done with "Advisors" ?
>>> I have no experience with this, so my question:
>>> Is this behavior the desired one?
>>> Can this be changed if i have reifications like mine where i compare
>>> to constants?
>>>
>>> Thanks a lot,
>>>
>>> Max
>>>
>>> _______________________________________________
>>> Gecode users mailing list
>>> users at gecode.org <mailto:users at gecode.org>
>>> https://www.gecode.org/mailman/listinfo/gecode-users
>>>
>>>  
>>>
>>> -- 
>>>
>>> Guido Tack,
>>>
>>> http://www.csse.monash.edu/~guidot/
>>> <http://www.csse.monash.edu/%7Eguidot/>
>>>
>>>  
>>>
>>>  
>>>
>>>  
>>>
>>>  
>>>
>>
>> _______________________________________________
>> Gecode users mailing list
>> users at gecode.org <mailto:users at gecode.org>
>> https://www.gecode.org/mailman/listinfo/gecode-users
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20120417/aff0129e/attachment-0001.htm>


More information about the users mailing list