LP Practice Solutions-18-19
LP Practice Solutions-18-19
LP Practice Solutions-18-19
2018/2019
1
Practice exercise set Linear Programming
Exercise 1
Solve the following linear problem graphically:
max 2x1 + x2
s.t. 2x1 + x2 ≤ 10
x1 ≤ 4
x2 ≤ 5
x1 , x2 ≥ 0.
Solution
7
x2 z=8
6
5 xA
2
xB
1
z = 10
0
0 1 2 3 4 5 6 7
x1
The red lines correspond to the level curves of the objective function for z = 8
and z = 10. The blue arrow represents the gradient of the objective function. All
the points laying in the segment (A, B) represent solution with value 10, and are
optimal solutions. However, only xA = (2.5, 5) and xB = (4, 2) are vertices, so
there are two optimal basic solutions and an infinite number of non-basic optimal
solutions.
Page 2
Practice exercise set Linear Programming
Exercise 2
Solve the following linear problem graphically:
min −x1 − x2
s.t.
−3x1 + 2x2 ≥ 6
3x1 + x2 ≥ 9
x1 , x2 ≥ 0.
Solution
x2 9
8
4
−x1 − x2 = −8
3
−x1 − x2 = − 19
3
2
0
0 1 2 3 4 5 6 7 8 9
x1
The red lines correspond to the level curves of the objective function for z = 8
and z = − 193
. The blue arrow represents gradient of the objective function. The
objective function can decrease indefinitely, thus the problem is unbounded.
Page 3
Practice exercise set Linear Programming
Exercise 3
Determine using the Simplex algorithm with Bland’s rule the optimal solution to
the following linear programming problem:
Solution
The problem in standard form is:
min −x1 − 3x2 − 5x3 − 2x4
s.t. x1 + 2x2 + 3x3 + x4 + s1 = 3
2x1 + x2 + x3 + 2x4 + s2 = 4
The initial tableau is
x1 x2 x3 x4 s1 s2
0 -1 -3 -5 -2 0 0
s1 3 1 2 3 1 1 0
s2 4 2 1 1 2 0 1
Page 4
Practice exercise set Linear Programming
x1 x2 x3 x4 s1 s2
5.6 1 0.4 0 0 1.6 0.2
x3 0.4 0 0.6 1 0 0.4 -0.2
x4 1.8 1 0.2 0 1 -0.2 0.6
All the reduced costs are nonnegative, then the optimal solution to the problem
is the basis (x1 , x4 ) with values:
0.4
xB =
1.8
The value associated with the optimal solution is 5.6 (the original problem is a
maximization one).
Exercise 4
Determine using the Simplex algorithm with Bland’s rule the optimal solution to
the following linear programming problem:
Solution
The problem in standard form is:
x1 x2 x3 x4 s1 s2
0 -5 -2 -3 -1 0 0
s1 4 1 -2 2 2 1 0
s2 6 -1 1 1 -1 0 1
Page 5
Practice exercise set Linear Programming
x1 x2 x3 x4 s1 s2
20 0 -12 7 9 5 0
x1 4 1 -2 2 2 1 0
s2 10 0 -1 3 1 1 1
Exercise 5
Solve the following linear programming problem using the Simplex algorithm
with Bland’s rule:
min 3x1 + x2 + x3
s.t. 2x1 + x2 + x3 = 6
x1 + x2 + 2x3 = 2
x1 , x2 , x3 ≥ 0.
Solution
We will execute the two-phase simplex method. In phase one we try to find a
basic feasible expressed in canonical form. The auxiliary problem is:
min w1 + w2
s.t. 2x1 + x2 + x3 + w1 = 6
x1 + x2 + 2x3 + w2 = 2
x1 , x2 , x3 , w1 , w2 ≥ 0.
w1 = 6 − 2x1 − x2 − x3
w2 = 2 − x1 − x2 − 2x3
Therefore,
w1 + w2 = 8 − 3x1 − 2x2 − 3x3 .
x1 x2 x3 w1 w2
-8 -3 -2 -3 0 0
w1 6 2 1 1 1 0
w2 2 1 1 2 0 1
Page 6
Practice exercise set Linear Programming
x1 x2 x3 w1 w2
-2 0 1 3 0 3
w1 2 0 -1 -3 1 -2
x1 2 1 1 2 0 1
The reduced cost are all nonnegative. The optimal solution is [w1 , x1 ] = [2, 2] is
with an objective function value of 2. Since the objective function value of the
first stage is strictly positive (and not zero) the original problem is infeasible.
Exercise 6
Consider the following linear programming problem:
max 2x1 + x2
−2x1 − x2 ≤ −1
x1 − x2 ≤ 3
4x1 + x2 ≤ 17
x2 ≤ 5
−x1 + x2 ≤ 4
where x1 , x2 ≥ 0.
b) Write the equations defining the complementarity slackness for the given
problem (Notice that the problem and its dual are in symmetric form).
Solution
Part a)
Page 7
Practice exercise set Linear Programming
Part b)
The equations of complementary slackness are:
(−2x1 − x2 + 1)y1 =0
(x1 − x2 − 3)y2 =0
(4x1 + x2 − 17)y3 =0
(x2 − 5)y4 =0
(−x1 + x2 − 4)y5 =0
(−2y1 + y2 + 4y3 − y5 − 2)x1 =0
(−y1 − y2 + y3 + y4 + y5 − 1)x2 =0
Part c)
Point (3,5) is feasible for the primal problem. By using the equations of comple-
mentary slackness we have that:
(−2x1 − x2 + 1)y1 = 0 ⇒ y1 =0
(x1 − x2 − 3)y2 = 0 ⇒ y2 =0
(−x1 + x2 − 4)y5 = 0 ⇒ y5 =0
x1 > 0 ⇒ 4y3 =2
x2 > 0 ⇒ y 3 + y 4 =1
1 1
We get that y3 = , y4 = , which is a feasible solution to the dual problem and
2 2
thus (3,5) is optimal.
Point (4,1) is feasible for the primal problem. By using the equations of comple-
mentary slackness we have that:
(−2x1 − x2 + 1)y1 = 0 ⇒ y1 =0
(x2 − 5)y4 = 0 ⇒ y4 =0
(−x1 + x2 − 4)y5 = 0 ⇒ y5 =0
x1 > 0 ⇒ y2 + 4y3 =2
x2 > 0 ⇒ −y2 + y3 =1
Page 8
Practice exercise set Linear Programming
Exercise 7
Consider the following problem:
x1 − 2x2 ≤ −1
4x1 + 3x2 ≤ 4
−x1 + 2x2 ≤ 3
2x1 − x2 ≤ −4
Solution
The dual problem is:
y1 + 4y2 − y3 + 2y4 = 9
−2y1 + 3y2 + 2y3 − y4 = 8
yi ≥ 0 ∀i
Point (-3,-1) is feasible for the primal problem (z = −35). By using the equations
of complementary slackness we infer that the dual variable y2 , y3 and y4 are equal
to 0. Therefore,
y1 = 9
−2y1 = 8
Page 9
Practice exercise set Linear Programming
−y3 + 2y4 = 9
+2y3 − y4 = 8
25 26
We get that y3 = , y4 = , which is a feasible solution to the dual problem
3 3
5 2
and thus (− 3 , 3 ) is optimal.
Exercise 8
Consider the following Linear Programming problem:
Without applying any problem transformation, write the dual problem and the
complementary slackness conditions (for both problems).
Page 10
Practice exercise set Linear Programming
Solution
Note that y2 ≤ 0 dominates the constraint that y2 is free. Therefore, the con-
straint that y2 is free is not necessary.
The complementary slackness conditions are the following:
(−x1 + x2 − 2)y1 =0
(x1 + x3 − 3)y2 =0
(2x1 + x2 − 1)y3 =0
(2x1 − 6x2 − 15)y4 =0
(−y1 + y2 + 2y3 + 2y4 + 1)x1 =0
(y1 + y3 − 6y4 − 2)x2 =0
y 2 x3 =0
• Constraint 1: −(3) + (− 32 ) − 2 = − 13
2
=⇒ y1 = 0
• Constraint 2: (3 − 3) = 0
• Constraint 3: (2 · 3 − 23 − 1) = 7
2
=⇒ y3 = 0
• Constraint 4: (2 · 3 + 6 · 23 − 15) = 0.
y2 + 2y4 = −1
−6y4 = 2
Page 11
Practice exercise set Linear Programming
2y3 + 2y4 = −1
y3 − 6y4 = 2
5
The solution to the above system yields y4 = − 14 y3 = − 17 , which is not feasible
for the dual problem (y3 ≥ 0), therefore the considered solution is not optimal.
Exercise 9
Consider the following Linear Programming problem:
Solution
The dual problem is:
Page 12
Practice exercise set Linear Programming
x1 x2 x3 s1 22
0 -2 2 -2 0 0
s1 2 2 -2 -1 1 0
s2 3 -3 3 2 0 1
x1 x2 x3 s1 22
2 0 0 -3 1 0
x1 1 1 -1 -0.5 0.5 0
s2 6 0 0 0.5 1.5 1
6
Iteration 2: x3 enters the basis. θ = min{ 0.5 } = 12, thus s2 exists the basis.
The next tableau is
x1 x2 x3 s1 22
38 0 0 0 10 6
x1 7 1 -1 0 2 1
x3 12 0 0 1 3 2
All the reduced costs are nonnegative, then the optimal solution to the problem
is the basis (x1 , x3 ) with values:
7
xB =
12
Page 13