Math 354 Summer 2004 Solutions
Review problems for Midterm #2
1 Find the dual of the following linear programming problem.
Maximize z = 3x1 + x2
subject to
x1 + 3x2 ≥ 10
3x1 + 2x2 = 20
x1 ≤ 5
x1 , x2 ≥ 0
Answer: First I would convert the problem to standard form:
Maximize z = 3x1 + x2
subject to
−x1 − 3x2 ≤ −10
3x1 + 2x2 ≤ 20
−3x1 − 2x2 ≤ −20
x1 ≤ 5
x1 , x2 ≥ 0
Then the dual is easy to find:
Minimize z ′ = −10w1 + 20w2 − 20w3 + 5w4
subject to
−w1 + 3w2 − 3w3 + w4 ≥ 3
−3w1 + 2w2 + −2w3 ≥ 1
w1 , w2 , w3 , w4 ≥ 0
2 Consider the following linear programming problem
Maximize z = 15x1 + 4x2
subject to
5x1 + 2x2 ≤ 10
x1 ≤ 32
4x1 + 4x2 ≤ 14
x1 , x2 ≥ 0
(a) Find the dual of this problem.
T
(b) Use the fact that 32 54 is an optimal solution to the primal problem and the Principle
of Complementary Slackness to find an optimal solution to the dual problem. (No points
will be given for solving the dual problem by any other method.)
Answer: Part (a):
Minimize z ′ = 10w1 + 23 w2 + 14w3
subject to
5w1 + w2 + 4w3 ≥ 15
2w1 + 4w3 ≥ 4
w1 , w2 , w3 , ≥ 0
Math 354 Summer 2004 Solutions
For part (b), we start by plugging the optimal solution for the primal problem into the
constraints there, and get:
5 32 + 2 54 = 10 inequality tight, doesn’t tell us anything
3 3
2
3 5
= 2 inequality tight, doesn’t tell us anything
4 2 + 4 4 = 11 inequality has slack, so the third dual variable, w3 , must be 0
So all that told us is that w3 = 0. Substituting this back into the dual problem constraints,
we get
5w1 + w2 ≥ 15
2w1 ≥ 4
We also know that x1 and x2 (in the optimal solution to the primal problem) are nonzero.
This means, again by the Principle of Complementary Slackness, that the first and second
constraints in the dual problem must be tight. This gives us enough information to solve for
w1 and w2 . Starting with the second constraint, which since it must be tight, is 2w1 = 4, we
get w1 = 2. Then we plug this into the first constraint to see that 10 + w2 = 15, so w2 = 5.
3 Consider the following primal problem
Maximize z = x1 + 3x2 + 5x3
subject to
2x1 − 5x2 + x3 ≤ 3
x1 + 4x2 ≤ 5
x1 , x2 , x3 ≥ 0
and its dual
Minimize z ′ = 3w1 + 5w2
subject to
2w1 + w2 ≥ 1
−5w1 + 4w2 ≥ 3
w1 ≥ 5
w1 , w2 ≥ 0
0
5 5
Show that x = is an optimal solution to the primal problem and that w = is an
4
37 7
4
optimal solution to the dual problem. (Hint: do not attempt to solve either problem. Instead
use a theorem from section 3.2.)
Solution: The applicable theorem from section 3.2 is the following, which is an easy
consequence of the Weak Duality Theorem:
Theorem 3.6: If x and w are feasible solutions to the primal problem and dual problem,
respectively, and if they give the same objective values, then they are both optimal solutions
to their respective problems.
To use this theorem you have to check it’s two hypotheses, which are
(1) x and w are both feasible,
Math 354 Summer 2004 Solutions
(2) x and w give the same objective value
Both of these can be checked quite easily. For (1), we just have to plug the solutions into the
constraints:
2 (0) − 5 45 + 37 4
= 3 ≤ 3
0 + 4 54 = 5 ≤ 5
5 37
0, 4
, 4
≥ 0
2(5) + 7 = 17 ≥ 1
−5(5) + 4(7) = 3 ≥ 3
5 = 5 ≥ 5
5, 7 ≥ 0
So both solutions are feasible. Now we check the objective function values:
0 + 3 54 + 5 37
4
= 50,
3(5) + 5(7) = 50.
Therefore we have checked both hypotheses of the theorem, so it applies to tell us that both
x and w are optimal solutions.
4 Use the dual simplex method to restore feasibility in the following tableau.
x1 x2 u1 u2 u3 u4
x2 0 1 −2 0 3 0 2
x1 1 0 1 0 2 0 1
u2 0 0 −4 1 5 0 0
u4 0 0 1 0 −5 1 −1
0 0 2 0 4 0 5
Answer: There is only one negative entry in the right-most column, so we know that it’s
basic variable – u4 – must depart. Then there is only one negative entry in the u4 row, the
entry corresponding to u3 , so u3 enters. After pivoting, we get
x1 x2 u1 u2 u3 u4
x2 0 1 − 75 0 0 5
3 7
5
7 2 3
x1 1 0 5
0 0 5 5
u2 0 0 −3 1 0 1 −1
u3 0 0 − 15 0 1 − 51 1
5
0 0 145
0 0 4
5
21
5
But we’re not done! There is a new negative entry in the right-most column, so we need to
apply Dual Simplex again. This time u2 departs and u1 enters, and after pivoting, we get
x1 x2 u1 u2 u3 u4
7 2 28
x2 0 1 0 − 15 0 15 15
7 13 2
x1 1 0 0 15
0 15 15
u1 0 0 1 − 3 0 − 31
1 1
3
1 4 4
u3 0 0 0 − 15 1 − 15 15
14 26 49
0 0 0 15
0 15 15
Math 354 Summer 2004 Solutions
Now we’re done.
5 Consider again our saw mill problem, which corresponds to the linear programming problem
Maximize z = 120x1 + 100x2
subject to
2x1 + 2x2 ≤ 8
5x2 + 3x2 ≤ 15
x1 , x2 , ≥ 0
To solve it we introduce slack variables u1 and u2 to get the following initial tableau
120 100 0 0
cB x1 x2 u1 u2
0 u1 2 2 1 0 8
0 u2 5 3 0 1 15
−120 −100 0 0 0
Then we do two iterations of the Simplex Method and get the following final tableau
120 100 0 0
cB x1 x2 u1 u2
5
100 x2 0 1 4
− 12 5
2
3 1 3
120 x1 1 0 −4 2 2
0 0 35 10 430
(a) Suppose that we now decrease b2 from 15 to 10. Find an optimal solution for this new
problem. (No points will be given for starting again from scratch! The point of this
problem is for you to use the techniques from section 3.6.)
(a) Suppose that instead we increase c1 from 120 to 200. Find an optimal solution for this
problem. (Again, no points will be given for starting over.)
Answer: For (a) we have to update the right-most column and the objective value of our
final tableau and then possibly do a few iterations of the Dual Simplex Method to restore
feasibility. The formula for updating the right-most column is that we add to it the following
column vector:
∆b2 B −1 e2 ,
where
∆b2 = the change in b2 ,
B −1 = the matrix consisting of the columns in the final tableau corresponding
to basic variables in the initial tableau,
e2 = the 2nd elementary basis vector.
Math 354 Summer 2004 Solutions
In our case, this means that
∆b2 = −5,
5
− 12
B −1
= 4 ,
− 34 1
2
0
e2 = .
1
So we add
5
− 12 5
0
−5 4 = 2
− 34 1
2
1 − 52
to the right-most column of the final tableau.
In addition, we have now have to update the objective value of this tableau to take into
account the changes we have made to the right-most column. The formula here is
cTB xB ,
where xB denote the right-most column. Since our xB is given by
5 5
5
xB = 23 + 2 = ,
2
− 52 −1
The new objective value is
5
100 120 = 380.
−1
Making these replacements, we get the tableau
120 100 0 0
cB x1 x2 u1 u2
5
100 x2 0 1 4
− 12 5
3 1
120 x1 1 0 −4 2
−1
0 0 35 10 380
Since there is now a negative entry in the right-most column, this tableau represents an
infeasible solution. We must apply the Dual Simplex Method to restore feasibility. Our
departing variable will be x1 and our entering variable will be u1 . After pivoting, we have
x1 x2 u1 u2
5 1 10
x2 3
1 0 3 3
4 2 4
u1 −3 0 1 −3 3
140
3
0 0 100
3
1000
3
This tableau represents the feasible solution x1 = 0, x2 = 10/3, with a profit of 1000/3.
Math 354 Summer 2004 Solutions
Part (b) is similar, only this time we update the last row instead of the last column. The
formula here is that the jth entry in the last row is equal to
cTB tj − cj ,
where
cB = the entries of the cost vector corresponding to the basic variables,
tj = the jth column, without the objective row entry,
cj = the entry of the cost vector corresponding to the jth variable.
(Remember that all references to c really mean “the changed c.”)
In our case we have
100
cB =
200
0
t1 =
1
1
t2 =
0
5
t3 = 4
− 34
− 12
t4 = 1
2
c1 = 200
c2 = 100
c3 = 0
c4 = 0
So we get
0
new first entry in objective row = 100 200 − 200 = 0
1
1
new second entry in objective row = 100 200 − 100 = 0
0
5
new third entry in objective row = 100 200 4 − 0 = −25
− 34
− 12
new fourth entry in objective row = 100 200 1 − 0 = 50
2
Math 354 Summer 2004 Solutions
We also have to recompute the new objective value. It is given by the dot product of the
right-most column with cB . In our case it is
5
100 200 2
3 = 550.
2
Finally, the updated tableau is shown below.
200 100 0 0
cB x1 x2 u1 u2
5
100 x2 0 1 4
− 12 5
2
200 x1 1 0 − 34 1
2
3
2
0 0 −25 50 550
Notice that this tableau corresponds to a feasible solution but does not satisfy the Optimality
Condition, so we need to apply the Simplex Method to get an optimal solution out of it.
Our entering variable is u1 and our departing variable is x2 and after pivoting we obtain the
following tableau.
200 100 0 0
cB x1 x2 u1 u2
4
0 u1 0 5
1 − 25 2
3 1
200 x1 1 5
0 5
3
0 20 0 40 600
6 Suppose that there are three jobs to be assigned and we have three workers available, and so
we want to match each of these three workers to exactly one of the three jobs. A point scale
has been set up rating the value of assigning a particular worker to a particular job, which is
presented in the following chart:
Worker Job 1 Job 2 Job 3
1 6 9 5
2 5 5 5
3 7 3 7
Formulate, but do not solve, an integer linear programming problem whose solution would
reveal how to assign each worker to a job in such a way to maximize the total number of value
points.
Answer: First we need to introduce variables. I will set
1 if worker i is assigned job j,
xij =
0 otherwise.
We want to maximize the total value of the assignment, which is
z = 9x11 + 9x12 + 5x13 + 5x21 + 5x22 + 5x23 + 7x31 + 3x32 + 7x33 .
Math 354 Summer 2004 Solutions
Then our constraints are that each person can work only one job and each job can be worked
by only one person. For example, the first person can work only one job means
x11 + x12 + x13 = 1,
and the fact that the second job can be worked by only one person means
x12 + x22 + x32 = 1.
Putting this all together gives the following integer programming problem.
Maximize z = 9x11 + 9x12 + 5x13 + 5x21 + 5x22 + 5x23 + 7x31 + 3x32 + 7x33
subject to
x11 + x12 + x13 = 1
x21 + x22 + x23 = 1
x31 + x32 + x33 = 1
x11 + x21 + x31 = 1
x12 + x22 + x32 = 1
x13 + x23 + x33 = 1
xij ≤ 1
xij ≥ 0 integral
7 Solve the following integer programming problem using the Cutting Plane Method.
Maximize z = x + 4y
subject to
x + 6y ≤ 36
3x + 8y ≤ 60
x, y, ≥ 0, integral.
Answer: First we solve the problem using the simplex method and forgetting about the
integer requirement. The initial tableau is
x y u1 u2
u1 1 6 1 0 36
u2 3 8 0 1 60
−1 −4 0 0 0
After one iteration:
x y u1 u2
1 1
y 6
1 6
0 6
5 4
u2 3
0 − 3 1 12
− 31 0 2
3
0 24
After another iteration we have the final tableau:
Math 354 Summer 2004 Solutions
x y u1 u2
3 1 24
y 0 1 10 − 10 5
4 3 36
x 1 0 −5 5 5
2 1 132
0 0 5 5 5
Now we choose one of the constraints with a fractional right-hand-side and round it down.
Let’s choose the second constraint in this tableau, which corresponds to
4 3 36
x − u1 + u2 = .
5 5 5
Then we round everything and replace the “=” by an “≤” (remind yourself why we are allowed
to do this!):
4 3 36
⌊1⌋x + ⌊− ⌋u1 + ⌊ ⌋u2 ≤ ⌊ ⌋.
5 5 5
This gives
x − u1 ≤ 7.
Now we have to add a new slack variable and put this constraint into our tableau. So we add
in u3 and our constraint is
x − u1 + u3 = 7.
After adding it to our tableau, we have
x y u1 u2 u3
3 1 24
y 0 1 10 − 10 0 5
4 3 36
x 1 0 −5 5
0 5
u3 1 0 −1 0 1 7
2 1 132
0 0 5 5
0 5
Now we have to clean up the column corresponding to x, because x is a basic variable. To do
this we subtract the x row from the u3 row, leaving
x y u1 u2 u3
3 1
y 0 1 10 − 10 0 245
x 1 0 − 45 3
5
0 365
1 3 1
u3 0 0 5
− 5
1 − 5
2 1 132
0 0 5 5
0 5
Now we need to restore feasibility with the Dual Simplex Method. The departing variable is
u3 and the entering variable is u2 . After pivoting, we have
x y u1 u2 u3
4
y 0 1 15 0 − 61 29
6
3
x 1 0 −5 0 1 7
u2 0 1
0 − 3 1 − 35 1
3
7 1 79
0 0 15 0 3 3
Math 354 Summer 2004 Solutions
And still we have fractions, so we repeat. We choose the first constraint,
4 1 29
y+ u1 − u3 = ,
15 6 6
round it down to give
y − u3 ≤ 4,
add a new slack variable to get
y − u3 + u4 = 4,
and add it to our tableau:
x y u1 u2 u3 u4
4
y 0 1 15 0 − 61 0 29
6
x 1 0 − 35 0 1 0 7
u2 0 0 − 3 1 − 35 0
1 1
3
u4 0 1 0 0 −1 1 4
7 1 79
0 0 15 0 3
0 3
clean up the y column:
x y u1 u2 u3 u4
4
y 0 1 15
0 − 61 0 29
6
x 1 0 − 35 0 1 0 7
1 5 1
u2 0 0 −3 1 −3 0 3
4 5 5
u4 0 0 − 15 0 − 6 1 − 6
7 1
0 0 15
0 3
0 79
3
Now we need to apply the Dual Simplex Method to restore feasibility. The departing variable
will be u4 , but we have to compute ratios to figure out the entering variable. The ratio for
the u1 column is
7
15 7
4 = − ,
− 15 4
and the ratio for the u3 column is
1
3 2
=− .
−5
6
5
Since we want to choose the least negative ratio, we will have u3 enter. After pivoting, we get
x y u1 u2 u3 u4
8
y 0 1 25
0 0 − 51 5
x 1 0 − 23
25
0 0 6
5
6
1
u2 0 0 5
1 0 −2 2
8
u3 0 0 25
0 1 − 56 1
9 2
0 0 25
0 0 5
26
Finally, we have an integer solution, and we can stop! The optimal solution is x = 6 and
y = 5, which gives an optimal objective value of 26.
Math 354 Summer 2004 Solutions
8 Solve the following integer linear programming problem using the Branch and Bound Method.
Maximize z = 2x1 + 2x2 + 3x3
subject to
2x1 + 3x2 + 2x3 ≤ 5
x1 , x2 , x3 ≥ 0, integral.
Answer: Coming soon.