Never used LINGO, plus not interested in learning it!
I ran it in Ubasic: 500:300:200 = 550 is correct as MINIMUM expense.
IF program assumes MAXIMUM revenue, then 400:600:0 = 620.
Perhaps your LINGO assumed this?
Hello,
I'm trying to solve a linear programming problem using LINGO software. The textbook gives the answers in the back, so I know I have the below constraints right, but when I enter them into LINGO and solve, I don't get the right answers. The answers should be: X1 = 500, X2 = 300, X3 = 200. Cost: 550. Can anyone point out what I've done/entered wrong?
Max 0.50x1 + .70x2 + .45x3
s.t.
10x2 - 15x3 >= 0
6x1 + 8x2 - 5x3 >= 0
x1 <= 500
x2 <= 600
x3 <= 400
x1 + x2 + x3 = 1000
x1, x2, x3 >= 0
I entered this problem in LINGO like this:
! MAXIMIZE PROFIT;
MAX = 0.50*X1 + 0.70*X2 + 0.45*X3;
!MATERIAL CONSTRAINT 1;
X1 + X2 + X3 = 1000;
!MATERIAL CONSTRAINT 2;
X1 <= 500;
!MATERIAL CONSTRAINT 3;
X2 <= 600;
!MATERIAL CONSTRAINT 4;
X3 <= 400;
!MATERIAL CONSTRAINT 5;
10*X2 - 15*X3 >= 0;
!MATERIAL CONSTRAINT 6;
6*X1 + 8*X2 - 5*X3 >= 0;
In case you want to "see" the program in UBASIC:
(using a,b,c instead of x1,x2,x3)
FOR a = 0 to 500
FOR b = 0 to 600
c = 1000 - a - b
IF c>400 or c<0 THEN NEXT b
IF 10*b - 15*c < 0 OR 6*a + 8*b - 5*c < 0 THEN NEXT b
m = .5*a + .7*b + .45*c
[store m if lowest so far]
NEXT b
NEXT a