help-glpk
[Top][All Lists]

## Re: [Help-glpk] Sign of an integer

 From: hamsda9 Subject: Re: [Help-glpk] Sign of an integer Date: Mon, 7 Apr 2008 10:31:19 -0700 (PDT)

```
Andrew Makhorin wrote:
>
>> var sx{a in A, b in B}, binary;
>> /* sx[a,b] is sign(sum{c in C} x[a,b,c]) */
>> /* in other word, sx[a,b] is logical_or{c in C} x[a,b,c] */
>>
>> s.t. foo{a in A, b in B}: sum{c in C} x[a,b,c] <= card(C) * sx[a,b];
>>
>> s.t. rooms{a in A}: sum{b in B} sx[a,b] <= r;
>
> Incorrect. The first constraint must be the following:
>
> s.t. foo{a in A, b in B}:
>      0 <= card(C) * sx[a,b] - sum{c in C} x[a,b,c] <= card(C) - 1;
>
>

Thanks you really helped me out, it worked like a charm.

I gotta say, the way you transformed this problem and solved it with your
0 <= card(C) * sx[a,b] - sum{c in C} x[a,b,c] <= card(C) - 1;
equation is just genius and an amazing idea. You sure are a very intellgent
person.

You have my deepest respect and appreciation.
Thanks again.
--
View this message in context:
http://www.nabble.com/Sign-of-an-integer-tp16535546p16537941.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.

```