> i am searching for an expression equal to the mathematicl sign function. > I have a sum in a "subject to" statement, and i want the returning value of > this sum to be zero if the sum is 0 or to be one if the sum is greater than > 0.
> Example: > subject to rooms{a in A}: sum{b in B} sign(sum{c in C} x[a,b,c]) <= r; > whereas x is a variable only containing binary values. > any ideas? 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; _______________________________________________ Help-glpk mailing list Help-glpk@gnu.org http://lists.gnu.org/mailman/listinfo/help-glpk