[gecode-users] rtest_eq_dom doesnt lead to RT_TRUE !?!?!

Christian Schulte schulte at imit.kth.se
Thu Jun 8 14:19:56 CEST 2006


While you were right about the implementation, there is a problem in your
setup: direectly after posting a constraint, you can not be sure that it has
been propagated. That is, your first have to propagate the space with
applying status() for example. Maybe you did that and just don't mentioned
it.

Christian

--
Christian Schulte, http://www.imit.kth.se/~schulte/ 

-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Martin Mann
Sent: Thursday, June 08, 2006 1:14 PM
To: gecode user list
Subject: [gecode-users] rtest_eq_dom doesnt lead to RT_TRUE !?!?!


Hi,

first of all: I am using the trunc version... but I checked and the 
corresponding source for the stable version is the same!

I found a strange behavior of the Gecode::rel function using IRT_NQ as 
an reified constraint.

I used 2 variables with the following domains:

d1 = (1)
d2 = (0,2)

also I ve got a reified constraint like that

rel(home, d1, IRT_NQ, d2, isNQ, ICL_DOM)

so isNQ should be true if d1 an d2 are unequal!

BUT: isNQ is NOT assigned!

i dived into the source and followed the my instance of the rel function:

rel
-> Rel::ReEqDom<IntView,NegBoolView>
-> ReEqDom<View,CtrlView>::propagate()
-> rtest_eq_dom()
->
and found this...
===================================
   template <class View>
   forceinline RelTest
   rtest_eq_dom(View x, View y) {
     RelTest rt = rtest_eq_bnd(x,y);
     if (rt != RT_MAYBE) return rt;
     return (x.range() || y.range()) ? RT_MAYBE :
        test_eq_dom_check(x,y);
   }
==================================
   template <class View>
   RelTest
   rtest_eq_dom_check(View x, View y) {
     ViewRanges<View> rx(x), ry(y);
     while (rx() && ry()) {
       if (rx.max() < ry.min()) {
	++rx;
       } else if (ry.max() < rx.min()) {
	++ry;
       } else return RT_MAYBE;
     }
     return RT_FALSE;
   }
==================================
   template <class View>
   forceinline RelTest
   rtest_eq_bnd(View x, View y) {
     if ((x.min() > y.max()) || (x.max() < y.min())) return RT_FALSE;
     return (x.assigned() && y.assigned()) ? RT_TRUE : RT_MAYBE;
   }
==================================


if I m right... rtest_eq_dom will never return RT_TRUE if this cant be 
determinated via bound constraint.... ???
this is because the called rtest_eq_dom_check() function will never 
return RT_TRUE ...

but this isnt what i expect if i am using ICL_DOM or?

in my case non of the 2 called functions lead to RT_TRUE but at least 
one should do ...

is it a bug or a feature? ;)

thanks for a closer look

Martin


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





More information about the gecode-users mailing list