[gecode-users] Clockwise constraint

Malcolm Ryan malcolmr at cse.unsw.edu.au
Tue Jun 3 11:33:23 CEST 2008


On 03/06/2008, at 6:40 PM, Guido Tack wrote:
>
>> If we kept the smallest value of b
>> between propagations the amortised cost of the computation could be
>> small.
>
> That wouldn't help, because you cannot start checking for values  
> starting from that previous smallest value.

Why not? Most of the time the old value of 'b' will still be a valid  
solution. If it isn't, we know that none of the smaller values are  
solutions so we should be able to count upwards from there (or jump  
straight to min(B), if b < min(B)). Ie, something like:

    if (B.min() > A.max() && B.max() < C.min()) {
       // set X = true
    }

    if (!B.in(b)) {
       b = B.min();
    }

    possible = false;
    lb = A.min();
    ub = C.max();
    max = B.max();
    for (; b <= max; b++) {
       if (b > lb && b < ub) {
          possible = true;
          break;
       }
    }

    if (!possible) {
        // set X = false
    }

Wouldn't that work? Or am I making some incorrect assumptions about  
the data available to propagators?

>> How would I go about adding this to Gecode/J?
>
> Unfortunately, we just found out that one important ingredient for  
> reified propagators currently does not work in Gecode/J: you cannot  
> return ES_SUBSUMED from a propagator (which you need in order to  
> rewrite into other propagators).  So I'm afraid currently the only  
> option is to add the propagator in C++ and then interface it to Java.

That was what I had in mind. I remember you saying previously that the  
Java Propagator class is not suitable for "real" problems.

Malcolm




More information about the gecode-users mailing list