« Gecode version 3.4 released | Main | About 100 new Gecode models »

Changes of my Gecode models for version 3.4.0

See Gecode version 3.4 released for a description of things that was changed in Gecode version 3.4.0.

One major change was replacement of tt, imp, eqv, ~ for logical implication, equivalence, and reification to a neater syntax, as well as post has been replaced with rel and expr.

For example, in alldifferent_except_0.cpp (decomposition of the global constraint all different except 0), this code segment
post(space,
     tt(imp(x[i] != c && x[j] != c, // =>
     x[i] != x[j])),
     icl
     );
is now written
rel(space,
   (x[i] != c && x[j] != c) >> (x[i] != x[j]),
   icl
);
This is a more direct syntax which I like very much. Since I'm a lazy person, I love this kind of syntactic sugar.

Another example is from who_killed_agatha2.cpp. This older code segment:
 post(*this, 
      tt(
        imp(hates_m2(i, agatha) == 1, 
            hates_m2(i, butler) == 1)), 
        opt.icl()
     ); 
is now written
 rel(*this, 
        (hates_m2(i, agatha) == 1) >> 
        (hates_m2(i, butler) == 1), 
        opt.icl()); 
Here are all the changed models, which are available at my Gecode page. Many of them required just a simple change of post() to rel(); then there is no special comment below.

A comment: I will very soon also blog about a couple (about 100) new Gecode models that also - as much as possible - use the new syntax.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)