[gecode-users] Generating constraints

Max chaosangel at gmx.de
Tue Oct 28 15:47:35 CET 2008


Thanks for the link.

I'm not sure if i can use minimodel, do all the operators have the same 
return value?
I just tested it and 2 things occur to me:
Gecode::MiniModel::LinExpr<Gecode::IntVar> operator*(const 
Gecode::MiniModel::LinExpr<Gecode::IntVar>&, int)
Gecode::MiniModel::LinExpr<Gecode::IntVar> operator*(int, const 
Gecode::MiniModel::LinExpr<Gecode::IntVar>&)
do exists, but no variant of the operator which takes both sides a 
LinExpr<IntVar>
Furthermore a constant -> so an integer, cannot be converted to a linear 
expression.

Is there a reason for that, it would be so nice to implement it that way 
at least on my side of the code :-)


Guido Tack wrote:
> Max wrote:
>> But, with this code written i do get some errors, because the rel method
>> is not defined for constants
>> as:
>> - both arguments
>> - first argument
>>
>> so i can not write
>>
>> rel(this, 5, IRT_GR, x, b);
>>
>> Why?
>> Do i have manually to flip the operands ?
>
> You could also use the post functions from minimodel here:
> post(this, tt(eqv(~(5 > x), b)));
>
> They should accept constants in all positions (and if not, we'll have 
> to fix it).
>
> Cheers,
>     Guido
>





More information about the gecode-users mailing list