[gecode-users] Subclassing JavaBrancingDesc

Mikael Zayenz Lagerkvist zayenz at gmail.com
Wed Apr 9 08:23:55 CEST 2008


On Wed, Apr 9, 2008 at 2:17 AM, Malcolm Ryan <malcolmr at cse.unsw.edu.au> wrote:
>  On 09/04/2008, at 2:04 AM, Christian Schulte wrote:
>  > I know that C++ sounds less appealing but Gecode is first and foremost
>  > geared to be good as a C++ library.
>
>  Yes. I guess I have to bite the bullet and move to C++.

One very good thing about using Gecode instead of Gecode/J is that
there is operator overloading in C++, leading to much more readable
models. For example, a quite common expression like (s1+d1>=s2 or
s2+d2>=s1) is hard to read and cumbersome in Java
    post(this, new BExpr(new Expr(s1).plus(d1), IRT_GQ, s2).or(new
Expr(s2).plus(d2), IRT_GQ, s1);
while it is quite straightforward in C++
    post(this, tt(~(s1+d1>=s2) || ~(s2+d2>=s1)));
where ~ is used as a reification operator, and tt indicates that the
expression should hold.

Cheers,
Mikael


-- 
Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/




More information about the gecode-users mailing list