Solution of Linear Programming Problems With Matlab
Solution of Linear Programming Problems With Matlab
Notation
ai ≤ bi or ai ≥ bi for all 1 ≤ i ≤ n.
min f T x (1)
1
subject to
If we define
" # 10, 000 2 1
12 16, 000 3 2
f= , b= , A= ,
7 0 −1 0
0 0 −1
this problem can be identified with the linear programming maximum problem associated
with f , A, b. Likewise it can be identified with the linear programming minimum problem
associated with −f , A, b.
x=linprog(f,A,b)
If you also want to retrieve the minimal value fmin = minx (f T x), type
[x,fmin]=linprog(f,A,b)
x=linprog(f,A,b,Aeq,beq)
or
[x,fmin]=linprog(f,A,b,Aeq,beq)
x =
1.0e+003 *
3.99999999989665
2
2.00000000013951
fopt =
-6.199999999973631e+004
This is the answer found in the class notes. The solution point is (4000, 2000), and the
maximum profit is $6, 2000.
Practice Problems
In each of the following problems first identify vectors and matrices such that the op-
timization problem can be written in the form of Definitions 1 or 2. Then use the linprog
command to solve the linear program.
Problem 1.
x1 + x2 = max
subject to
2x1 + x2 ≤ 29,
x1 + 2x2 ≤ 25,
x1 ≥ 2,
x2 ≥ 5.
Problem 2.
x1 + x2 + x3 + x4 + x5 = max
subject to
x1 + x2 ≤ 100,
x3 + x4 ≤ 70,
x2 + x3 + 2x4 + 5x5 ≤ 250,
xj ≥ 0 (1 ≤ j ≤ 5).
Problem 3.
x1 + x2 + x3 + x4 + x5 = min
subject to
x1 + x2 = 100,
x3 + x4 = 70,
x2 + x3 + 2x4 + 5x5 = 250,
xj ≥ 0 (1 ≤ j ≤ 5).