Lecture 27
Linear programming II
CSE 421 Autumn 2025
1
Previously…
2
Linear algebra/geometry review
3
A “halfspace” is a set of the following form:�
An affine subspace is a set of the following form:�
Linear algebra/geometry review
“Convex polytope” (generalization of polygon to n-dimensions)
Definition: A convex polytope is a set of the form
��where and .
4
Note: a convex polytope is the intersection of a bunch of halfspaces
Linear algebra/geometry review
“Convex polytope” (generalization of polygon to n-dimensions)
Equivalent definition: A convex polytope is a set of the form
��for some and .
5
the inequality is entry-wise
Why equivalent?
Linear programming
Standard form
6
This last constraint is without loss of generality: one can always convert to an LP of this form starting from one where entries of can be negative
Max flow as a linear program
7
Max flow as a linear program
8
Today
9
The value of expressing problems as LPs
10
Minimization LPs
11
Recall that we can easily turn a maximization LP into a minimization LP:
An example problem
12
You’re planning meals for the week.
There are different foods, e.g. rice, broccoli, beans, eggs,..
Each food has:
An example problem
13
We can cast the problem as an LP:
subject to
for each
Number of servings of food
Cost of food
Amount of nutrient in food
Minimum amount of nutrient needed
Another example: shortest path as an LP
Claim: The length of the shortest path is the solution to the following “flow-like” LP.
Proof (sketch):
A path of length corresponds to a flow of value (put flow 1 on every edge in the path). So, shortest path LP minimum.
Any flow is the sum of flows along paths . These flow paths can have non-integer value, but, since total flow is 1, the flow can be thought of as a probability distribution over paths! ���
14
Input: Directed graph and vertices
Output: (Length) of shortest path
Sum of flow on every edge (not just outgoing from )
Flow 1 must come out of
Another example: shortest path as an LP
Claim: The length of the shortest path is the solution to the following “flow-like” LP.
Proof (sketch):
A path of length corresponds to a flow of value (put flow 1 on every edge in the path). So, shortest path LP minimum.
Any flow is the sum of flows along paths . These flow paths can have non-integer value, but, since total flow is 1, the flow can be thought of as a probability distribution over paths! �The minimum value is always achieved by sending all flow along the best (i.e. minimal) individual path in this distribution. �
15
Input: Directed graph and vertices
Output: (Length) of shortest path
Sum of flow on every edge (not just outgoing from )
Flow 1 must come out of
Another example: shortest path as an LP
Claim: The length of the shortest path is the solution to the following “flow-like” LP.
Proof (sketch):
A path of length corresponds to a flow of value (put flow 1 on every edge in the path). So, shortest path LP minimum.
Any flow is the sum of flows along paths . These flow paths can have non-integer value, but, since total flow is 1, the flow can be thought of as a probability distribution over paths! �The minimum value is always achieved by sending all flow along the best (i.e. minimal) individual path in this distribution. �The flow value of this path is exactly its length. So, LP minimum shortest path.�
16
Input: Directed graph and vertices
Output: (Length) of shortest path
Sum of flow on every edge (not just outgoing from )
Flow 1 must come out of
Where are the optimums of LPs?
Theorem: A local optimum of an LP (if it exists) is a global optimum.
Proof: Recall we are maximizing subject to and is convex polytope. Assume is a local optimum but not a global optimum:
17
Optimum within some ball around it.
i.e. any point on this segment does better than . We always improve by putting more weight on .
Vertices of a convex polytope
Definition: A vertex of a convex polytope is any point such that is not the midpoint of any line segment for .
18
Lemma: Let be the vertices of a convex polytope . Then, every point equals for and (i.e. every point in is a “convex combination” of its vertices).
This is an intuitive but powerful fact! We won’t cover the proof in class though..
Vertices of a convex polytope
Theorem: If the optimum of an LP is finite, then the optimum must be achieved at some vertex.
Proof: Let be the vertices of the feasible region . Then, by the previous lemma, every point equals for and .
By linearity of the objective function,
, where
19
holds since
since
Vertices of a convex polytope
Theorem: If the optimum of an LP is finite, then the optimum must be achieved at some vertex.
Proof: Let be the vertices of the feasible region . Then, by the previous lemma, every point equals for and .
By linearity of the objective function,
, where
So one of the vertices must do better than .
20
The simplex method
How does one solve LPs?
We’ll look at an algorithm called the simplex method. It will be unique amongst the algorithms we study in this course:
Later on, we will take a high-level glance at an algorithm for solving LPs that is known to run in polynomial time.
21
The simplex method
The Simplex method is a greedy algorithm
High-level algorithm:
22
The simplex method
The Simplex method is a greedy algorithm
High-level algorithm:
23
The simplex method
The Simplex method is a greedy algorithm
High-level algorithm:
24
The simplex method
The Simplex method is a greedy algorithm
High-level algorithm:
25
The simplex method
The Simplex method is a greedy algorithm
High-level algorithm:
26
The simplex method
The Simplex method is a greedy algorithm
High-level algorithm:
27
More details next time..