[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [Help-glpk] How to use less operator in gmpl?

**From**: |
Andrew Makhorin |

**Subject**: |
Re: [Help-glpk] How to use less operator in gmpl? |

**Date**: |
Thu, 9 Aug 2007 13:54:50 +0400 |

>* Hi, I am new to GNU MathProg language.*
>* I have following model but glpk always complains:*
>* "test2.mod:10: operand preceding*
>* less has invalid type"*
>* The GMPL document says it has this less*
>* operator. How could I use it in modeling?*
Being non-linear the less operator can be applied only to constants
and parameters, but not to variables, because glpk does not support
non-linear constraints.
Nevertheless, you can reformulate your model using SOS2 constraints,
since less is a piecewise linear operator. For more details see:
http://lists.gnu.org/archive/html/help-glpk/2007-06/msg00005.html
>* var a {i in I}, binary;*
>* s.t. R4 {i in I diff J}: a[i]-a[i-1] !=0;*
This constraint is also incorrectly formulated. The correct
formulation is the following:
s.t. R4 {i in I diff J}: a[i] + a[i-1] = 1;