[gecode-users] How can I port this from gecode 1.3.1 to gecode 2.0.0

Guido Tack tack at ps.uni-sb.de
Fri Jan 25 18:46:28 CET 2008


Mauricio Toro wrote:
> I had this function before when using Gecode 1.3.1
>
> void rel_intset_setoptype_intset_setreltype_setvar(Space *home,  
> const IntSet *x, SetOpType op, const IntSet *y, SetRelType r, SetVar  
> *z)
> {
>  //Gecode::rel(home, *x, op, *y, r, *z); ???
> }
>
> How can I port it to Gecode 2.0.0?

You have to emulate it like this:

void rel_intset_setoptype_intset_setreltype_setvar(Space *home, const  
IntSet *x, SetOpType op, const IntSet *y, SetRelType r, SetVar *z)
{
  Gecode::IntSetRanges xr(*x);
  Gecode::IntSetRanges yr(*y);
  switch (op) {
  case SOT_INTER:
    {
        Gecode::Iter::Ranges::Inter< Gecode::IntSetRanges,  
Gecode::IntSetRanges > ir(xr,yr);
        Gecode::IntSet result(ir);
        Gecode::dom(home, *z, inverse(r), ir);
    }
    break;
  case SOT_UNION:
    ...
  }
  case ...
  }
}

Where inverse(r) is pseudo-code for inverting the relation (SRT_SUB <- 
 > SRT_SUP).

We'll add support for things like this to the minimodel layer, but we  
removed it from the main library because it is really just a modeling  
help.

Cheers,
	Guido





More information about the gecode-users mailing list