Chapter 3 ended its traffic example (Example (Traffic in a town center))
by admitting what linear algebra alone cannot do:
“Non-negativity and street capacities turn the problem
into one about inequalities, which is the subject of
linear programming.” This section takes up that subject.
A linear program asks for the largest
value of a linear function on a region cut out by
finitely many linear inequalities. The theory is almost
entirely one idea. Every such maximum comes with a
companion minimum, the dual program,
and the two optimal values are equal. The proof of that
equality is Farkas’s lemma of §05, applied to one
combined system.
The equality has a practical meaning that goes beyond
the theorem. A feasible point proves a lower bound on
the maximum, a dual feasible point proves an upper
bound, and when the two bounds meet, the answer has been
certified: anyone can check it by
multiplying out, with no need to trust how it was
found.
Throughout, the field is , vectors are
columns, and , are the entrywise relations of §05.
Linear
programs
Here is a small instance of the kind of question we
want to answer. A workshop makes two products. Each unit
of the first uses
hours of machine time and hour of labor, each
unit of the second uses hour of machine time
and hours of
labor, and at most units of the first can
be sold. Machine time is limited to hours, labor to , and the profits are
and per unit. With units made, the
question is: The objective and every constraint are linear,
and there are finitely many constraints. In matrix form
it reads “maximize subject to , ”. That shape
deserves a name.
A linear program is the search for the best value
of a linear function over a region defined by finitely
many linear inequalities.
Definition
18.6.1 (Linear Program)
Let , and . The linear program with
these data, in inequality form, is the
problem A vector with and is a feasible point, and
the set of all of them is the feasible
region. The program is
feasible if it has a feasible point and
infeasible otherwise. It is
unbounded if it is feasible and takes
arbitrarily large values on the
feasible region. A feasible is an
optimal solution if for every feasible
, and then is the
optimal value.
Clause by clause. The function is the
objective. The rows of are the
constraints, and adds more. An optimal
solution is a feasible point at which the objective is
as large as anywhere on the feasible
region, and it need not be unique. The optimal value is
unique when it exists. A program can fail to have an
optimal solution in two ways: it can have no feasible
point, or its objective can be unbounded above. Whether
those are the only two ways is the
question the section’s second theorem settles.
Examples. The workshop problem is
(P) with
- One variable. With , “maximize
subject to , ” has the optimal
solution .
“Maximize subject
to , ” asks for the
largest ,
and it is unbounded. “Maximize subject to , ” is
infeasible.
- Degenerate case. If , every feasible
point is optimal, with value . The program then asks
only whether the system , has a solution. So the feasibility question
of Corollary 18.5.7 is
itself a linear program, the one with no objective.
Non-example by minimal change. Make
one inequality strict: “maximize subject to , ”. Everything is
still linear, but the supremum is not attained, and no
feasible point is optimal. The definition allows only
non-strict inequalities. They define
closed regions, and closedness will
again be what the proofs need.
Why this form. Every problem with a
linear objective and finitely many linear constraints
can be brought to the shape (P). To minimize , maximize . A constraint
is . An equation is the
pair , . A variable without a sign
constraint can be written with
. Exercise (C2: Free variables)
carries out the last conversion. The form (P), with its
sign constraints on , is chosen because its
dual, below, has the same shape, which makes the theory
symmetric.
Example
(The workshop problem, drawn)
Find the optimal solution of the workshop problem,
and explain why it is optimal.
Solution. The feasible region is
the pentagon with corners , , , and . For example,
is where
meets , and solves , :
subtracting twice the second equation from the first
gives .
The level sets are parallel lines, and the
value grows in the direction . Sliding the
line in that direction, the last point of the region it
meets appears to be , with value Comparing the corners supports this: they give
, , , and
.
A picture is not a proof, and neither is a list of
five corners, since we have not proved that an optimum
sits at a corner. Here is a proof. Multiply the first
constraint by and the second
by , both
non-negative, and add: The left side is . So every feasible
point has , and , which is
feasible ( as well), reaches this bound. It is optimal,
and the optimal value is .
The multipliers and are the heart of
the matter. They were chosen so that the combined
constraint had exactly the objective as its left side.
The best upper bound obtainable this way is itself the
answer to a linear program.
The dual
program
Multiply the -th constraint of (P) by
a number
and add. For every feasible this gives . If
the combination dominates the objective coefficient by
coefficient, , then, since , Each such proves an upper bound
on the
objective, and the natural question is how small that
bound can be made.
The dual program searches for the best upper
bound that non-negative combinations of the constraints
can prove.
Definition
18.6.2 (Dual Program)
The dual of the linear program (P)
of Definition 18.6.1 is the
problem with . The words feasible,
infeasible and optimal
are used as for (P). (D) is unbounded
if it is feasible and takes
arbitrarily negative values on its
feasible region. In this context (P) is called the
primal program.
The dual has one variable for each constraint of the
primal and one constraint for each variable of the
primal. The matrix is transposed, the roles of and are exchanged, and
maximization becomes minimization. The dual of (D),
written back in inequality form, is (P) again. Exercise (C1: The dual of the dual)
checks this, and it explains why a statement about (P)
always has a mirror statement about (D).
For the workshop problem the dual is and the multipliers of Example (The workshop problem, drawn)
form the dual feasible point , with . The dual has an economic reading
too. is a price
for one unit of the -th resource, and the
constraints say that at these prices the resources used
by one unit of each product are worth at least the
profit it brings.
Weak
duality
The computation that motivated (D) is the first
theorem, and it is one line long.
Theorem
18.6.1 (Weak Duality)
If is
feasible for (P) and is feasible for (D),
then
Proof. Since and
, the
number is a sum of products of non-negative
numbers, so . Since and
, in the
same way . Chaining the two
inequalities proves the theorem.
Corollary
18.6.2 (Certificates from Weak Duality)
- (a) If is feasible for (P),
is feasible for
(D), and , then is optimal for (P) and
is optimal for
(D).
- (b) If (P) is
unbounded, then (D) is infeasible. If (D) is unbounded,
then (P) is infeasible.
Idea. Weak duality makes every dual
value an upper bound for every primal value. A primal
value that meets one of these bounds cannot be beaten,
and neither can the bound; an unbounded program leaves
no room for any bound at all.
Proof.
(a) For every
feasible ,
Theorem 18.6.1 gives
, so is optimal. For every
dual feasible , it gives , so is optimal.
(b) If (D) had a
feasible point ,
Theorem 18.6.1 would
bound above
by for
every feasible ,
so (P) would not be unbounded. The second statement is
the same argument with the roles exchanged.
Part (a) is exactly what Example (The workshop problem, drawn)
did: , so both points
are optimal. It gives a certificate of optimality that
can be checked by arithmetic alone. The question is
whether such a certificate always
exists. Weak duality allows the best lower bound to stay
strictly below the best upper bound.
Quick check. Without solving
anything, give an upper bound for on the
workshop’s feasible region using only the second
constraint and . Which dual feasible point is that?
Solution. We need with and , so . Then , using . This is the
dual feasible point , with . It is a valid bound, but a poor one
compared with the optimal .
Strong
duality
The main theorem says that the gap allowed by weak
duality never occurs, and it gives the complete list of
what can happen.
Theorem
18.6.3 (Strong Duality for Linear
Programs)
Let , and , and let (P) and (D) be as in Definition 18.6.1 and Definition 18.6.2.
- (a) If (P) and (D)
are both feasible, then both have optimal solutions, and
their optimal values are equal: there
are feasible and with .
- (b) If (P) is
feasible and (D) is infeasible, then (P) is
unbounded.
- (c) If (D) is
feasible and (P) is infeasible, then (D) is
unbounded.
Idea. Parts (b) and (c) are each
one application of Corollary 18.5.7. The
infeasibility of one program yields a vector that the
other program can move along forever, with its objective
improving without bound.
For (a) we want a single pair that is feasible
for both programs and has . Weak
duality then forces equality, and Corollary 18.6.2 forces
optimality. The pair is a solution of one big system of
inequalities in , so we ask Farkas whether it has one. If it
had none, Farkas would hand us a certificate . The number
is the multiplier
on the row . If , rescaling the certificate by produces a primal and
a dual feasible point that violate weak duality. If
, the
certificate is a pair of directions along which one of
the two programs is unbounded, which contradicts weak
duality against a feasible point of the other.
Proof. (b) Let
be feasible
for (P). That (D) is infeasible says that the system
,
has no
solution. By Corollary 18.5.7,
applied with and , there is with , and . That is, and . For every
the point
is
feasible, since and . Its
objective value is , which is larger than any given
number once is
large enough, because . So (P) is
unbounded.
(c) Let be feasible for (D).
That (P) is infeasible says that , has no
solution. By Corollary 18.5.7 with
and , there is with , and . For the point is feasible
for (D), since and . Its
value is below any given number for large
. So (D) is
unbounded.
(a) Let be feasible for (P)
and feasible
for (D). Consider the matrix and the vector For with and , the system , says exactly
that
(18.6.1)
Suppose Eq. 18.6.1 has a
solution . Then is feasible
for (P) and is feasible
for (D), so Theorem 18.6.1 gives
. Together with , this gives equality, and by Corollary 18.6.2 (a)
both points are optimal. That is (a).
It remains to show that Eq. 18.6.1 has a
solution. Suppose not. By Corollary 18.5.7 there
is with
and
.
Write with , and , all . Since the conditions read
(18.6.2)
Case 1: . Dividing Eq. 18.6.2 by shows that is feasible
for (P), that is feasible for (D), and that . This contradicts Theorem 18.6.1.
Case 2: . Now , and , with . The strict inequality forces or , since
otherwise . If , then, exactly as in the proof of (b),
the points with are feasible for (P) with objective values
tending to .
That contradicts the bound
that Theorem 18.6.1 gives for
every feasible .
If ,
then, as in the proof of (c), the points are feasible
for (D) with values tending to , which
contradicts .
Both cases are impossible, so Eq. 18.6.1 has a
solution, and (a) is proved. This proves the
theorem.
Together with Corollary 18.6.2 (b),
the theorem sorts every pair (P), (D) into exactly one
of four cases:
| feasible |
feasible |
both optimal, equal values (a) |
| feasible |
infeasible |
(P) unbounded (b) |
| infeasible |
feasible |
(D) unbounded (c) |
| infeasible |
infeasible |
nothing more to say |
All four occur. The workshop problem is the first.
The one-variable program “maximize subject to , ” is the second:
its dual, “minimize subject to , ”, is infeasible.
“Maximize
subject to , ” is the third: its dual, “minimize subject to ”, is unbounded.
For the fourth, take Adding the two primal constraints gives , and adding the
two dual constraints gives , so neither program is feasible.
The table has a consequence that is easy to state and
not at all obvious.
Corollary
18.6.4 (Bounded Linear Programs Attain Their
Optimum)
If (P) is feasible and its objective is bounded above
on the feasible region, that is, for some
and every
feasible , then
(P) has an optimal solution. The same holds for (D) with
“bounded below”.
Proof. Since (P) is feasible and
not unbounded, part (b) of Theorem 18.6.3 shows
that (D) is not infeasible. So both programs are
feasible, and part (a) gives an optimal solution of (P).
The statement for (D) follows in the same way from part
(c).
Why is this not obvious? The feasible region is
closed, but it may be unbounded, so the extreme value
theorem (A4) of Chapter 16’s introduction does not apply
to it. And a linear function that is bounded above on a
closed convex set need not attain its supremum. On the
region , bounded by a
branch of a hyperbola, the linear function is negative
everywhere, and it takes values arbitrarily close to
at the points
, so its
supremum is . That
supremum is never reached. The region is the set of Example (A hyperbola and its asymptote),
since
and
force ,
and that example shows it is closed and convex. But it
is not cut out by finitely many linear
inequalities. That finiteness is what made the cones in
the proof finitely generated, and hence closed, by Theorem 18.5.4. The
corollary is where finite generation pays off.
Warning. Strong duality is
a theorem about linear programs, not about optimization
in general. For programs whose objective or
constraints are convex but not linear, one can still
write down a dual problem, and weak duality still holds,
but the two optimal values may differ: a duality
gap. Extra hypotheses are needed to close it,
of which the best known is a strictly feasible point
(Slater’s condition). That theory belongs to convex
optimization and is not developed in this book. For
linear programs no hypothesis beyond feasibility is
needed, as Theorem 18.6.3
shows.
Complementary slackness
Strong duality says that at the optimum the two
chains of inequalities in the proof of Theorem 18.6.1 are
equalities. Reading that off term by term gives a test
that locates the dual solution once the primal one is
known.
Theorem
18.6.5 (Complementary Slackness)
Let be
feasible for (P) and feasible for (D). Then
and are
both optimal if and only if
- (i) for every , implies ; and
- (ii) for every , implies .
Idea. The gap is a
sum of products of non-negative numbers, one product for
each constraint of either program. Optimality means the
gap is zero, which means every product is zero.
Proof. Expanding and using ,
(18.6.3)
The first term on the right is ,
a sum of products of non-negative numbers, and so is the
second. Condition (i) says that every product in the
first sum is zero, and (ii) says the same for the
second. So (i) and (ii) together hold exactly when the
right side of Eq. 18.6.3 is , because a sum of
non-negative numbers is zero only when every term
is.
If
(i) and (ii) hold, then , and
both points are optimal by Corollary 18.6.2
(a).
If
both are optimal, then both programs are feasible, and
by Theorem 18.6.3 (a) their
optimal values are equal. So , the
right side of Eq. 18.6.3 is , and (i) and (ii)
hold.
In words: a constraint with a positive price must be
tight, and a product that is actually made must exactly
pay for its resources. For the workshop problem, has both entries positive,
so (ii) requires both dual constraints to be tight:
The third primal constraint is slack at , since , so
(i) forces .
The two equations then give and , both
, which
recovers the multipliers of Example (The workshop problem, drawn).
So the multipliers were not a lucky guess: complementary
slackness finds them from the primal
solution.
Traffic,
with inequalities
We return to Chapter 3’s town center, to answer the
remark made there. Recall from Example (Traffic in a town center)
the four intersections, the five one-way streets , , , , with flows , and the
incidence matrix . Conservation of cars
is with
, and the flows that conserve cars are
Chapter 3 asked, with street closed, for the
largest possible flow on the diagonal , and found by inspecting the one
remaining parameter. That was already a linear program:
maximize
subject to , , . Its answer has a one-line certificate. The
first row of , the balance at intersection 1, reads , so
because .
Example
(Capacities on every street)
Suppose street is open again, but every street can carry at
most cars per
minute. What is the smallest flow the
diagonal street can carry, and how would you convince someone
that it cannot be smaller?
Solution. The linear program is:
minimize
subject to and . In the parameters, the capacity
of street
reads , so , since . The
value is
achieved: with the flow is every entry of which lies between and . So the minimum is
.
The certificate, in the spirit of the dual, is a
non-negative combination of the constraints. Add the
balance equations at intersections 1 and 2, and
:
using the capacity and the sign
constraint . In words: at least sixty cars per minute
arrive at the pair of intersections (sixty from
outside, plus whatever street brings), and only
two streets leave that pair, and the diagonal.
The first can take at most , so the diagonal must
take at least .
This is a cut argument, and it is
exactly what the dual program of a flow problem
computes. The balance equations carry multipliers of
either sign, the “potentials” of the intersections, and
here they are at
intersections 1 and 2 and at the others.
This is the answer to Chapter 3’s remark. Linear
algebra describes the conserving flows as a coset of the
null space of .
Linear programming chooses among them, and duality
explains each choice with a certificate that can be read
as a statement about the network.
Exercises
A. Check your
understanding
Exercise
(A1)
- (a) Write down the
dual of: maximize subject to , , .
- (b) State weak
duality and strong duality.
- (c) Determine
whether the following is correct, and justify your
answer: if (P) is infeasible, then (D) is
unbounded.
- (d) Determine
whether the following is correct, and justify your
answer: if (P) is feasible and for every
feasible , then
(P) has an optimal solution.
- (e) At an optimal
pair ,
suppose .
What does complementary slackness say about the second
constraint of (D)?
Solution.
(a) Minimize
subject
to ,
,
. The
columns of
become the rows of , and and exchange
roles.
(b) Weak duality
(Theorem 18.6.1): if
is feasible for
(P) and for (D),
then . Strong duality (Theorem 18.6.3): if both
are feasible, both have optimal solutions with equal
values. If exactly one is feasible, that one is
unbounded.
(c) Incorrect.
Both programs can be infeasible, as for , , in this
section. What is true, by Theorem 18.6.3 (c), is
that if (P) is infeasible and (D) is
feasible, then (D) is unbounded.
(d) Correct, by
Corollary 18.6.4. The
bound shows that (P) is not unbounded, so by Theorem 18.6.3 (b) the
dual is feasible, and then (a) gives an optimal
solution.
(e) By Theorem 18.6.5 (ii), the
second dual constraint is tight: .
B. Practice
Exercise
(B1: Solve and certify)
Consider: maximize subject to
- (a) Sketch the
feasible region and guess an optimal solution.
- (b) Write down the
dual, and use complementary slackness to find a
candidate dual solution.
- (c) Prove that both
candidates are optimal, and state the optimal
value.
Solution.
(a) The region is
the pentagon with corners , , , and , where the
objective takes the values . The guess
is , where meets .
(b) The dual is:
minimize subject to , ,
. At the third
constraint is slack, since ,
so (i) of Theorem 18.6.5 requires
. Both , so
(ii) requires both dual constraints to be tight: and . Hence
.
(c) is feasible:
, , , and . is feasible:
,
and . The objective values are
and . They are equal, so both points
are optimal by Corollary 18.6.2 (a),
and the optimal value is .
Exercise
(B2: Which case?)
For each program, write down its dual, and determine
which of the four cases of Theorem 18.6.3 occurs.
Justify your answer, giving the optimal values where
they exist.
- (a) Maximize subject to
,
.
- (b) Maximize subject to , , .
- (c) Maximize subject to , .
Solution.
(a) The dual is:
minimize subject
to , , . The last two
constraints conflict, so the dual is infeasible. The
primal is feasible, with a feasible point, so
by Theorem 18.6.3 (b) it is
unbounded. Directly, is feasible for every , with value .
(b) The dual is:
minimize
subject to , . Both programs are feasible: and . Their values
are and , which
are equal, so both are optimal by Corollary 18.6.2 (a),
with optimal value . This is the first
case.
(c) The primal is
infeasible, since for . The dual is:
minimize subject
to , , . It is feasible,
and takes
arbitrarily negative values, so it is unbounded, as Theorem 18.6.3 (c)
predicts.
Exercise
(B3: A network with one flow)
In the traffic network of this section, close street
and give
every other street a capacity of cars per minute. Show
that there is exactly one feasible flow. For its
diagonal flow , give a certificate, in the style of Example (Capacities on every street),
that for
every feasible flow, and one that .
Solution. With the
conserving flows are . The
capacity of street gives , so . The capacity of the diagonal gives
. So
, and the
only candidate is , which satisfies for
every street. It is the unique feasible flow.
Lower bound: adding the balance equations at
intersections 1 and 2 gives , so
by the capacity , using . Upper bound:
is
itself a capacity constraint. Each certificate is a
non-negative combination of constraints, with free
multipliers on the balance equations, as in the
example.
C. Going deeper
Exercise
(C1: The dual of the dual)
- (a) Rewrite (D) as a
program in the inequality form of Definition 18.6.1, with
data . Show that the dual of that program,
rewritten as a maximization, is (P).
- (b) Deduce part (c)
of Theorem 18.6.3 from part
(b).
Solution.
(a) Minimizing
is
maximizing , and is . So
(D) is the inequality-form program (D): maximize subject to
,
, whose
data are , , . By Definition 18.6.2 its
dual is: minimize subject to , . That is: maximize subject to , , which is (P).
Its optimal value is the negative of the minimum
above.
(b) Suppose (D)
is feasible and (P) is infeasible. Then (D) is feasible, with
the same feasible points, and its dual, which by (a) has
the same feasible points as (P), is infeasible. By Theorem 18.6.3 (b)
applied to (D), the objective
takes
arbitrarily large values on the feasible region. So
takes
arbitrarily negative values, and (D) is
unbounded.
Exercise
(C2: Free variables)
Let , , , and consider the program with no
sign constraint on :
- (a) Prove weak
duality between (P) and
(D):
minimize
subject to , .
- (b) Writing with , show that
(P)
has the same values as an inequality-form program whose
dual is (D). Deduce
that if both are feasible, both have optimal solutions
with equal values.
Solution.
(a) If and with , then , the last step because
and . No sign
condition on is
needed, because the first step is an equality.
(b) Every can be
written as
with :
take and . So (P) has the
same feasible objective values as the inequality-form
program with an optimal giving an
optimal , and conversely. By Definition 18.6.2 its
dual is: minimize subject to , . The constraint
reads and , that is, . So the dual
is (D).
If both programs are feasible, Theorem 18.6.3 (a) gives
optimal and with equal
values, and is optimal for (P).