[Gecode] bug: equal and the empty set

Grégoire Dooms dooms at info.ucl.ac.be
Mon May 23 18:09:31 CEST 2005


Grégoire Dooms wrote:

>
> I also attach a patch against set/reified/propagators.cc 1.25
> (this is a CVS version Christian sent me a few weeks ago - I have no 
> CVS access).
>

Should read twice before posting.
The previous patch does not fix it in other cases (two sets not equal 
but neither being empty).
This one should be better;

--
Grégoire
-------------- next part --------------
--- propagators.cc.orig	2005-05-23 17:13:35.000000000 +0200
+++ propagators.cc	2005-05-23 18:04:33.000000000 +0200
@@ -226,16 +226,20 @@
       // directly test x0==x1
       GlbIter<SetView> x0lb(x0);
       GlbIter<SetView> x1lb(x1);
-      for (; x0lb(); ++x0lb) {
+      for (; x0lb() && x1lb(); ++x0lb, ++x1lb) {
         if (x0lb.min() != x1lb.min() ||
             x0lb.max() != x1lb.max()) {
           b.t_zero_none(home);
           return ES_SUBSUMED;
         }
-        ++x1lb;
       }
-      b.t_one_none(home);
-      return ES_SUBSUMED;
+      if (!x0lb() && !x1lb()) {
+          b.t_one_none(home);
+          return ES_SUBSUMED;
+      } else {
+          b.t_zero_none(home);
+          return ES_SUBSUMED;
+      }
     }
     
     // check whether cardinalities still allow equality


More information about the gecode-users mailing list