Math 171A Homework 1 Solutions
Instructor: Jiawang Nie
January 24, 2012
1.
Find the optimal solution to the following LP
maximize
x
1
+ 4
x
2
+ 3
x
3
subject to
2
x
1
+
x
2
+
x
3
≤
4
x
1

x
3
= 1
x
2
≥
0
, x
3
≥
0
.
Solution: The second equality constraint
x
1
=
x
3
+ 1 allows us to convert the
problem into a two dimensional optimization problem in the variables
x
2
and
x
3
.
Bring it into the problem, we get the following equivalent problem:
max
4(
x
2
+
x
3
) + 1
,
s.t.
x
2
+ 3
x
3
≤
2
,
x
2
≥
0
, x
3
≥
0
.
In this problem, there are two variables
x
2
and
x
3
, we draw a Figure and find the
feasible region, see Figure 1. There are three corner points (0
,
0)
,
(0
,
2
3
)
,
(2
,
0).
Calculate the objective function value at these three corner points, we get the
maximum function value at the point (2
,
0) with a value of 9, then
x
1
=
x
3
+1 = 1,
i.e. the optimal solution of the original problem is
x
*
= (1
,
2
,
0).
Use Matlab to check the solution, the optimal solution
x
*
= [1 2 0], which is the
same as above. The matlab code as follows:
f= [1; 4; 3];
A = [2 1 1; 0 1 0; 0 0 1];
b = [4; 0; 0];
Aeq = [1 0 1];
beq = 1;
x = linprog(f,A,b,Aeq,beq)
2.
Draw the feasible region defined by the following six constraints:
x
1
+ 2
x
2
≤
6
,
x
1

x
2
≥
2
,
x
2
≤
1
,
x
1

x
2
≤
4
,
x
1
≥
0
,
x
2
≥
0
.
Find all the corner points.
1