HW 02 Sol
HW 02 Sol
1. Use the Simplex Method with dictionaries to solve textbook problem 2.1(a), page 26. Show all
your work, then write a summary giving the optimal value, the optimal solution, and the sequence
of feasible basic solutions that the Simplex Method visits on its way to the maximizing point.
Problem statement:
Maximize f = 3x1 + 2x2 + 4x3
subject to x1 + x2 + 2x3 ≤ 4
2x1 + 3x3 ≤ 5
2x1 + x2 + 3x3 ≤ 7
x1 , x2 , x3 ≥ 0
Introduce slack variables w1 = x4 , w2 = x5 , w3 = x6 to define this initial dictionary:
x4 = 4 − x1 − x2 − 2x3
x5 = 5 − 2x1 − 3x3
x6 = 7 − 2x1 − x2 − 3x3
f = 0 + 3x1 + 2x2 + 4x3
Any nonbasic variable could enter the basis and improve the payoff, but the largest coefficient
inspires us to select x3 to enter. The largest permitted value for x3 is 5/3: this will make x5 = 0,
so the leaving variable must be x5 . The pivot equation is
Now either of x1 or x2 could enter, but x2 has the largest coefficient, so let’s pick that one. Increasing
x2 has no influence on x3 or x6 , but it will spoil the nonnegativity of x4 unless we choose x2 ≤ 2/3.
This identifies the leaving variable: x4 . The pivot equation is
Now increasing x4 will decrease the payoff, increasing x5 will make no difference, but increasing
x1 will be rewarding. So choose x1 to enter the basis. The rows involving x3 and x6 provide
restrictions on x1 , and the stricter of these is provided by x3 . So x3 leaves, via
Now any feasible assignment to the nonbasic variables other than 0 clearly makes our payoff worse,
so we have found the problem’s unique maximizer: fMAX = (21/2), attained at
5 3
(x∗1 , x∗2 , x∗3 ) = , ,0 .
2 2
File “hw02”, version of 17 May 2013, page 2. Typeset at 16:32 May 24, 2013.
UBC M340 Solutions for Problem Set #2 3
Use Anstee’s pivot-selection rules; report the maximum value and the point that attains it.
(b) Suppose the objective function f in the part (a) is replaced with
g = 3x1 + 2x2 + x3 .
Adjust the optimal final dictionary from part (a) to produce a feasible dictionary for the g-
problem. Then answer these questions. Is the maximizing point from part (a) still a maximizer
for g? If so, explain why; if not, find the new maximum value and all points that achieve it.
(c) [Much like (b).] Suppose the objective function f in part (a) is replaced with
h = 4x1 + 4x2 .
Adjust the optimal final dictionary from part (a) to produce a feasible dictionary for the h-
problem. Is the maximizing point from part (a) still a maximizer for h? If so, explain why; if
not, find the new maximum value and all points that achieve it.
Discussion: Parts (b)–(c) give you personal experience of re-using work you have already done to
save time when solving a new problem that is pretty similar to a known one.
(a) We have three constraints, so we define three slack variables. The definitions form the first
three lines of the initial dictionary:
x4 = 3 − x1 − 3x2 + 2x3
x5 = 4 − 4x1 − 2x2
x6 = 2 − x1 − x2 − x3
f= 4x1 + 2x2 + 2x3
The largest coefficient in the objective row is attached to x1 , so this variable will enter the
basis. Keeping x2 = 0 and x3 = 0, the increase in x1 is limited most strictly by the inequality
x5 ≥ 0, so x5 will leave the basis. The pivot equation comes from the second line above:
1 1 1
x1 = (4 − x5 − 2x2 ) = 1 − x5 − x2 .
4 4 2
It replaces the second line in the dictionary and influences the others:
Now the entering variable is x3 (check the bottom row) and the leaving variable is x6 ; we pivot
on the third equation in the dictionary, namely,
1 1
x3 = 1 + x5 − x2 − x6 .
4 2
The new dictionary is
x4 = 4 + (3/4)x5 − (7/2)x2 − 2x6
x1 = 1 − (1/4)x5 − (1/2)x2
x3 = 1 + (1/4)x5 − (1/2)x2 − x6
f = 6 − (1/2)x5 − x2 − 2x6
There are no positive coefficients in the objective row, so this dictionary encodes an optimal
solution. Setting the nonbasic variables x2 , x5 , and x6 to 0 reveals the solution:
(b) The new objective g = 3x1 + 2x2 + x3 can be expressed in terms of the variables basic in the
final dictionary above by using the equations it supplies:
1 1 1 1 1
g = 3 1 − x5 − x2 + 2x2 + 1 + x5 − x2 − x6 = 4 − x5 − x6 .
4 2 4 2 2
Replacing the bottom line of the dictionary above with this one gives a feasible dictionary for
the g-problem:
x4 = 4 + (3/4)x5 − (7/2)x2 − 2x6
x1 = 1 − (1/4)x5 − (1/2)x2
x3 = 1 + (1/4)x5 − (1/2)x2 − x6
g = 4 − (1/2)x5 − x6
This dictionary encodes a whole family of optimal solutions, because the objective row is
unaffected by changes in the non-basic variable x2 . We can use any x2 ≥ 0 compatible with
the nonnegativity constraints on the basic variables: the tightest of these is x4 ≥ 0, which
requires x2 ≤ 8/7. In summary,
8
gMAX = 4, attained at every point (x1 , x2 , x3 ) = (1 − 12 x2 , x2 , 1 − 12 x2 ) where 0 ≤ x2 ≤ .
7
(The endpoints of the segment of maximizing points are (1, 0, 1) and (3/7, 8/7, 3/7).
(c) As in part (b), we first express the new objective in terms of the current basis:
1 1
h = 4x1 + 4x2 = 4 1 − x5 − x2 + 4x2 = 4 − x5 + 2x2 .
4 2
Replacing the objective row of the current dictionary with this one gives a feasible dictionary
that is not optimal:
x4 = 4 + (3/4)x5 − (7/2)x2 − 2x6
x1 = 1 − (1/4)x5 − (1/2)x2
x3 = 1 − (1/4)x5 − (1/2)x2 − x6
h =4− x5 + 2x2
File “hw02”, version of 17 May 2013, page 4. Typeset at 16:32 May 24, 2013.
UBC M340 Solutions for Problem Set #2 5
Now x2 enters the basis (check the objective row), and x4 leaves (the tightest constraint on x2
comes from the x4 -equation). So we pivot on the x4 -equation:
2 3 8 3 2 4
x2 = 4 + x5 − x4 − 2x6 = + x5 − x4 − x6 .
7 4 7 14 7 7
File “hw02”, version of 17 May 2013, page 5. Typeset at 16:32 May 24, 2013.
6 UBC M340 Solutions for Problem Set #2
3. Read textbook problem 1.6 about the meat packing plant. The story in the question setup is
translated into a standard-form LP that appears on page 465. Look at that, too. Then . . .
(a) Explain the meaning of each variable in the given LP formulation. Show that your explanation
predicts a net profit of $9965 for the sample schedule in the question statement.
(b) Use a computer to solve the given LP. Find the maximum profit (it should be larger than
$9965!) and present a table showing the schedule that achieves it. Also hand in a computer
printout showing exactly what you typed into the solver and what it returned.
NOTES: Use any computer package you like—just say which one you choose. Possibilities:
1. Use LINDO, a special linear programming solver available on the machines in the Math/Stat
undergraduate computer lab, room LSK 121. Access instructions should have arrived in
your email last week. No special skills are required: just start LINDO, select “Help” from
the menu, and try things.
2. Use the online simplex method tool cited on the course web page. The tool has an
“example” button that shows you how it works, and another sample is posted on the
course web page.
Most of the work in part (b) is in figuring out how to communicate your mathematical problem to
the software, and how to interpret the results. These are skills worth learning now: once you have
them, you can check your manual calculations and/or solve larger problems with ease.
The total net profit for a production plan (x1 , . . . , x6 ) can be computed using the prices given
in the problem formulation:
The first line comes from selling three styles of ham, the second from three styles of bellies,
and the third from three styles of picnics. The bottom line comes from algebra. The constant
5880 represents he net profit from selling all products fresh (x = 0). The constant also spoils
the linearity property of the total profit P for inputs (x1 , . . . , x6 ), so we choose to maximize
just the number we can add to 6360 by smoking some products: this extra profit equals
Choosing x = (280, 35, 70, 35, 70, 105) gives f = 3605. Therefore the total profit for this
schedule is P = 3605 + 6360 = 9965, as asserted in the text.
(b) The online simplex solver returns the maximizing schedule
The improvement on selling eveything fresh is fMAX = 4550, so the total net profit with the
optimal schedule is
PMAX = $6360 + $4550 = $10 910.
File “hw02”, version of 17 May 2013, page 7. Typeset at 16:32 May 24, 2013.
8 UBC M340 Solutions for Problem Set #2
Notice that changing the value of k makes no difference to the feasible region.
(a) Suppose k = 1. Apply the Simplex Method and answer these questions:
(i) Is the problem bounded?
(ii) If the problem is bounded, find all maximizing points and their corresponding values.
(iii) If the problem is unbounded, find a feasible point whose f -value is larger than 10100 .
(b) Repeat part (a) with k = 2.
f = − 3x1 + x2 + x3
x4 = − x1 + x2
D0 : x5 = 1 + 2x1 − x3
x6 =2 + 2x2 − x3
x7 = 6 − x1 − x2 + x3
Choose x2 (coefficient tied with x3 , select by Anstee’s smallest subscript rule) to enter the
basis and x7 to leave: the pivot equation is x2 = 6 − x1 − x7 + x3 , leading to
f = 6 − 4x1 − x7 + 2x3
x4 = 6 − 2x1 − x7 + x3
D1 : x5 = 1 + 2x1 − x3
x6 = 14 − 2x1 − 2x7 + x3
x2 = 6 − x1 − x7 + x3
Now the entering variable is unambiguously x3 , and the leaving variable must be x5 . With
pivot equation x3 = 1 + 2x1 − x5 , we get
f= 8 − x7 − 2x5
x4 = 7 − x7 − x5
D2 : x3 = 1 + 2x1 − x5
x6 = 15 − 2x7 − x5
x2 = 7 + x1 − x7 − x5
(i) Since there are no positive coefficients left in the objective row, this problem is bounded.
File “hw02”, version of 17 May 2013, page 8. Typeset at 16:32 May 24, 2013.
UBC M340 Solutions for Problem Set #2 9
(ii) The coefficient of x1 in the objective row is 0, indicating that the maximizing point is
not unique. Any choice of x1 ≥ 0 is allowed, provided all equations in dictionary D2 are
respected. In particular, every point of the form
is feasible for the problem and gives the maximum value, fMAX = 8.
(iii) The problem is bounded, so there is nothing to do here.
(b) Changing k to 2 affects only the objective function, not the constraints. So we can simply
swap out the old objective row and swap in the new, taking care to respect dictionary D2 :
This leads to
f = 9 + 2x1 − x7 − 3x5
x4 = 7 − x7 − x5
e2 :
D x3 = 1 + 2x1 − x5
x6 = 15 − 2x7 − x5
x2 = 7 + x1 − x7 − x5
(i) The positive coefficient on x1 in the objective row indicates that increasing the value of
x1 will increase f . Earlier rows in the dictionary provide no limit on how much x1 can
increase, so this problem is unbounded.
(ii) This applies only for the bounded case, not here.
(iii) For any x1 ≥ 0, the input point (x1 , x2 , x3 ) = (x1 , 7 + x1 , 1 + 2x1 ) is feasible for the
problem and gives f = 9 + 2x1 . To get a value f > 10100 , we can choose x1 = 0.5 × 10100 :
the corresponding input point is
(Any point of the same form, with x1 > 0.5 × 10100 − 4.5, will do the job.)
File “hw02”, version of 17 May 2013, page 9. Typeset at 16:32 May 24, 2013.
10 UBC M340 Solutions for Problem Set #2
in which x1 , . . . xn are non-basic and xn+1 , . . . , xn+m are basic. Prove that if we can choose an
entering variable, but there are no leaving variables then the objective function can be made
arbitrarily large and so the problem is unbounded.
bi ≥ 0 for each i = 1, 2, . . . , m.
Suppose the entering variable is xk : this means that k ∈ {1, 2, . . . , j} is a nonbasic subscript for
which the corresponding coefficient obeys ck > 0. We choose the leaving variable by selecting the
tightest constraint in the following list:
The process breaks down if and only if the list has no tight constraints at all, i.e., if
Suppose this happens. Look at the solution of the given dictionary in which all nonbasic variables
except xk are stuck at 0:
xn+1 = b1 − a1k xk ,
xn+2 = b2 − a2k xk ,
..
.
xn+m = bm − amk xk ,
z = v + ck xk .
Line (∗∗) guarantees that the values of the basic variables xn+1 , . . . , xn+m will be nonnegative for
any value of xk ≥ 0, no matter how large. So the point below is a feasible solution for arbitrary
xk > 0:
(0, . . . , 0, xk , 0, . . . , 0, b1 − a1k xk , b2 − a2k xk , . . . , bn+m − a(n+m)k xk ).
The value of this point is shown above: z = v + ck xk . Since ck > 0, and there is no limit on how
large xk > 0 can be, the objective value z can be made arbitrarily large. That’s exactly what it
means to say the problem is unbounded.
File “hw02”, version of 17 May 2013, page 10. Typeset at 16:32 May 24, 2013.
UBC M340 Solutions for Problem Set #2 11
6. Find all maximizing points (if any) and their objective value:
maximize f = 3x1 + x2
subject to x1 + 2x2 ≤ 5,
x1 + x2 − x3 ≤ 2,
7x1 + 3x2 − 5x3 ≤ 20,
x1 , x2 , x3 ≥ 0.
g = 3x1 + x2
x4 = 5 − x1 − 2x2
D0 :
x5 = 2 − x1 − x2 + x3
x6 = 20 − 7x1 − 3x2 + 5x3
Choose x3 to enter the basis and x4 to leave (using the smaller subscript to break the tie between
leaving vars). The pivot equation is x3 = 3 + x5 − x2 − x4 , and it leads to
g = 15 − 5x2 − 3x4
x3 = 3 + x5 − x2 − x4
D2 :
x1 = 5 − 2x2 − x4
x6 = 5x5 + 6x2 + 2x4
File “hw02”, version of 17 May 2013, page 11. Typeset at 16:32 May 24, 2013.
12 UBC M340 Solutions for Problem Set #2
Maximize f = x1 + x2 + kx3
Subject to x1 ≤ 2
x2 ≤ 2
x3 ≤ 4
4x1 + 4x2 + x3 ≤ 16
x1 , x2 , x3 ≥ 0
(a) Use the simplex method to solve the problem when k = −1. Identify all maximizing points.
(b) Find all k-values for which this problem has a unique maximizing point. Identify the maximizer.
(c) Solve the problem when k = 1. Identify all maximizing points.
(d) Find all k for which the set of maximizers in the problem is a line segment in (x1 , x2 , x3 )-space.
Identify the endpoints of the segment.
(e) Find all k (if any) for which the set of maximizers includes 3 or more different basic feasible
solutions. Identify those points.
(a) Introduce slack variables named s1 , s2 , s3 , s4 to obtain this feasible dictionary when k = −1:
ζ= x1 + x2 − x3
s 1 = 2 − x1
s2 = 2 − x2
s3 = 4 − x3
s4 = 16 − 4x1 − 4x2 − x3
ζ = 2 + x2 − x3 − s1
x1 = 2 − s1
s 2 = 2 − x2
s3 = 4 − x3
s4 = 8 − 4x2 − x3 + 4s1
ζ = 4 − x3 − s 1 − s 2
x1 = 2 − s1
x2 = 2 − s2
s 3 = 4 − x3
s4 = − x3 + 4s1 + 4s2
(b) Plugging ζ = x1 + x2 + kx3 into the optimal dictionary in part (a) changes only the objective
row, which becomes
ζ = (2 − s1 ) + (2 − s2 ) + kx3 = 4 + kx3 − s1 − s2 .
Of course this agrees with the result in part (a) in the special case where k = −1, but now
it reveals that the point found in (a) actually gives the unique minimizer whenever k < 0.
If k = 0, increasing x3 will not subtract from the objective value. However, the final row in
the dictionary above shows that x3 cannot increase without breaking the feasibility condition
s4 ≥ 0. So the point found in (a) continues to be the unique maximizer when k = 0. What
if k > 0? Then the final dictionary from (a) is improvable: x3 should enter the basis and s4
must leave. This (degenerate) pivot leads to
The nonbasic coefficients in the objective row are all negative whenever 0 < k < 1/4, so in this
interval we also have the unique maximizer found in (a). But when k = 1/4, the coefficients
of both s1 and s2 in the objective become 0 and this allows nonuniqueness. Looking ahead to
parts (c)–(e), we conclude that the problem has a unique maximizer if and only if k < 1/4; for
all such k, the maximizing point is (2, 2, 0).
(c) Substituting k = 1 into the dictionary from (b) gives
ζ = 4 − s4 + 3s1 + 3s2
x1 = 2 − s1
x2 = 2 − s2
s3 = 4 + s4 − 4s1 − 4s2
x3 = − s4 + 4s1 + 4s2
Pivoting s1 into the basis will improve this; the leaving variable is s3 , and the updated dictio-
nary is
ζ = 7 − (1/4)s4 − (3/4)s3
x1 = 1 − (1/4)s4 + (1/4)s3 + s2
x2 = 2 − s2
s1 = 1 + (1/4)s4 − (1/4)s3 − s2
x3 = 4 − s3
This dictionary is optimal: it shows that ζmax = 7, and that the choices s4 = 0 and s3 = 0 are
essential to achieve it (because these nonbasic variables have negative objective coefficients).
But the choice of s2 is more flexible, because it has a zero coefficient in the objective row.
We can use any s2 ≥ 0 compatible with the nonnegativity constraints on the basic variables.
Of these, the most restrictive comes from s1 , and it shows that the interval of permissible
s2 -values is [0, 1]. In parametric form, showing original variables only, we have maximizers at
(x1 , x2 , x3 ) = (1 + s2 , 2 − s2 , 4), 0 ≤ s2 ≤ 1.
File “hw02”, version of 17 May 2013, page 13. Typeset at 16:32 May 24, 2013.
14 UBC M340 Solutions for Problem Set #2
ζ = 4 − (1/4)s4
x1 = 2 − s1
x2 = 2 − s2
s3 = 4 + s4 − 4s1 − 4s2
x3 = − s4 + 4s1 + 4s2
This is an optimal dictionary: ζmax = 4. Every maximizing point must have s4 = 0. However,
two nonbasic variables are allowed to vary without compromising the objective value. Choosing
s1 = 0 and s2 = 0 gives a basic maximizer where (x1 , x2 , x3 ) = (2, 2, 0). Choosing s1 = 1 and
s2 = 0 gives a basic maximizer at (x1 , x2 , x3 ) = (1, 2, 4). Choosing s1 = 0 and s2 = 1 gives a
basic maximizer at (x1 , x2 , x3 ) = (2, 1, 4). All points on the flying triangle in R3 with these
three corners are tied for the maximum when k = 1/4.
File “hw02”, version of 17 May 2013, page 14. Typeset at 16:32 May 24, 2013.