lp_solve
[lab2-2 60] which lp_solve
/usr/bin/lp_solve
[lab2-2 58] cat
sax.lp
// cookie problem
max: 5x1 + 6x2 + 9x3;
y1: x1 + 2x2 +3x3 <= 5;
y2: x1 + x2 +2x3 <= 3;
[lab2-2 59] lp_solve -S4
sax.lp //
-S4 option prints
dual variables
Value of objective function: 17
Actual values of the variables:
x1
1
x2
2
x3
0
Actual values of the constraints:
y1
5
y2
3
Dual values with from - till limits:
y1
1
3 6
y2
4
2.5 5
x1
0 -1e+24 1e+24
x2
0 -1e+24 1e+24
x3
0 -1e+24 1e+24
[lab2-2 65] cat
ix3.lp
// example of an integer LP
max: 3 x1 + 13 x2;
c1: 2x1 + 9x2 <= 40;
c2: 11x1 - 8x2 <= 82;
int x1,x2;
[lab2-2 66] lp_solve <
ix3.lp
// dual variables meaningless, so not requested
Value of objective function: 58
Actual values of the variables:
x1
2
x2
4