How can I bound a variable to be negative in GMPL linear programming (Gusek)?

234 Views Asked by At

I am new to linear programming, and I am having trouble finding a solution to an easy problem.

I am using the language GMPL in the pragramme Gusek. My problem is that the variables are initially always greater than 0, but I need a -inf<x3<=0 bound. I have literally tried everything, and I haven't seen any solution to this problem.

The problem looks like:

var x1;
var x2;
var x3;

minimize
z: 9*x1+6*x2+4*x3;

subject to

c1: x1+2*x2-3*x3<=11;
c2: x1+x2+3*x3<=10;
c3: 4*x1+3*x2-2*x3>=24;

bounds

-inf < x3 <= 0

solve;
end;

The "bounds" syntax doesn't work really. I mean it is not a valid syntax to my best knowledge, but as I said, I am new to this field. The problem is easily solved by hand, I know, but I'd like to be able to solve similar problems of bigger scale.

Thx in advance

1

There are 1 best solutions below

0
On

By default, variables in GMPL are free. (This is opposed to many other systems where the default is non-negative).

To declare a negative variable do:

 var x3 <= 0;

See section 4.3 in http://gusek.sourceforge.net/gmpl.pdf