[gecode-users] First contact with gecode

Christian Schulte cschulte at kth.se
Mon Oct 6 09:38:15 CEST 2014


Just a tip: please read Sections 3.1 and 7.1 in MPG. It shows how to write
normal C++ expressions for posting linear constraints.

Cheers
Christian

--
Christian Schulte, Professor of Computer Science, KTH,
www.gecode.org/~schulte/

-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Frederic C
Sent: Monday, October 06, 2014 8:19 AM
To: users at gecode.org
Subject: Re: [gecode-users] First contact with gecode

I changed IRT_LE for IRT_LQ and it works, thank you. I'm silly, if
coefficients are all zeros, it helps if the right hand size can also be
zero!

Fred

Le 06/10/2014 00:29, Chris Mears a écrit :
> Hello Fred,
>
>>       { // 1A + 1B >  0
>>         IntArgs coeffs(2); coeffs[0] = 1;  coeffs[1] = 1;
>>         linear(*this, coeffs, s, IRT_GT, int(0));
>>       }
> I am not sure how you got this to compile, because this should be 
> "IRT_GR".
>
>>       { // 1A + 0B >  0
>>         IntArgs coeffs(2); coeffs[0] = 1;  coeffs[1] = 0;
>>         linear(*this, coeffs, s, IRT_GT, int(0));
>>       }
>>       { // 1A + 1B >  0
>>         IntArgs coeffs(2); coeffs[0] = 0;  coeffs[1] = 1;
>>         linear(*this, coeffs, s, IRT_GT, int(0));
>>       }
>>       { // 0A + 0B <= 0
>>         IntArgs coeffs(2); coeffs[0] = 0;  coeffs[1] = 0;
>>         linear(*this, coeffs, s, IRT_LE, int(0));
>>       }
> Here you want IRT_LQ ( <= ) instead of IRT_LE ( < ).


_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users




More information about the users mailing list