[gecode-users] rtest_eq_dom doesnt lead to RT_TRUE !?!?!
Martin Mann
mmann at informatik.uni-freiburg.de
Thu Jun 8 13:13:39 CEST 2006
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
More information about the gecode-users
mailing list