Title: Linear Programming
1Linear Programming
- Lecture 33
- Linear Programming
- Review Assignment problem and how it can help TSP
- The Simplex Method for solving general Linear
Programs
- Lecture 32 More TSP
- Another BB Problem Formulation
- State Space
- Cost function
- Bounds
- Lower Bounds
- Upper Bounds
- Example
2Announcements
- Cryptography Lab is now available on blackboard
for extra credit. - 5 points extra credit for participating in course
evaluation. You must turn in both the on-line
and paper forms, and you must enter your name
when you go on-line to get the extra credit. I
will get a list of names of participants, but
wont know which review was yours. - Sign up for final presentations Dec. 5th, 8th,
and 10th. Your attendance and participation on
those days is requiredyou need to support each
other. - We will expand the Branch-and-Cut extra credit to
include any LP Branch-and-Bound technique that
uses a general LP solution technique (such as the
simplex algorithm, an ellipsoidal method, or an
interior point method). We will show you one
approach today in class. A flash tutorial on LP
is available at http//commerce.concordia.ca/bourj
olly/lp.html, and some introductions to the
simplex method for solving LPs are available
from us.
3Another Formulation
- Consider the Assignment Problem
4Another TSP Formulation
- Consider the Assignment Problem
55
5Another TSP Formulation
- Consider the Assignment Problem
59
6Another TSP Formulation
- Consider the Assignment Problem
58
7Another TSP Formulation
- Consider the Assignment Problem
40
8Another TSP Formulation
- Consider the Assignment Problem
A solution is generally a collection of disjoint
cycles.
40
3
4
1
2
9Another TSP Formulation
- Consider the Assignment Problem
A solution is generally a collection of disjoint
cycles. But if solution happens to be one cycle,
it is an optimal tour.
40
3
4
1
2
10Another TSP Formulation
- Consider the Assignment Problem
A solution is generally a collection of disjoint
cycles. But if solution happens to be one cycle,
it is an optimal tour. The Assignment Problem is
a special Integer Programthe solution to the LP
relaxation is the solution to the IP!
40
We can compute it for the subgraph at each node
and use the solution for TSP
11Another TSP Formulation
- Consider the Assignment Problem
Not only does the value of the assignment problem
provide a lower bound to the optimal tour cost,
but it can define a useful state space. At each
node of the state space we identify a graph
H(V,A). The root node is associated with the
original graph.
40
12Another TSP Formulation
- Consider the Assignment Problem
Not only does the value of the assignment problem
provide a lower bound to the optimal tour cost,
but it can define a useful state space. At each
node of the state space we identify a graph
H(V,A). The root node is associated with the
original graph.
To find the children nodes, we construct a set of
subgraphs by solving the assignment problem,
choosing one of the resulting cylces (suppose the
cycle contains r nodes), then building a graph
for each of the r nodes. These r subgraphs
define the children nodes in the state space.
13Another TSP Formulation
- Consider the Assignment Problem
Let Ww1, w2, , wr be the nodes of the cycle.
Define Now define the edge sets
To find the children nodes, we construct a set of
subgraphs by solving the assignment problem,
choosing one of the resulting cylces (suppose the
cycle contains r nodes), then building a graph
for each of the r nodes. These r subgraphs
define the children nodes in the state space.
14Another TSP Formulation
- Consider the Assignment Problem
Let Ww1, w2, , wr be the nodes of the cycle.
Define Now define the edge sets
The r children of the current node correspond to
the graphs (V, Ei), 1ltiltr. Compute the
assignment problem for each child, expand the
child with lowest score.
15Another TSP Formulation
- Consider the Assignment Problem
16Another TSP Formulation
- Consider the Assignment Problem
21
17Another TSP Formulation
- Consider the Assignment Problem
1
9
8
21
2
10
6
4
3
12
7
(1,4), (4,3), (3,2), (2,5), (5,1)
4
Assignment is a single cycle, so this method
finds the optimal tour for this instance in one
shot without expanding any children !
18Linear Programming
- We use graphs and trees as useful modeling
abstractions to help us develop computational
solutions for a wide variety of problems - A linear program is simply another modeling
abstraction (tool in your toolbox) - Developing routines that solve general linear
programs allows us to embed them in sophisticated
algorithmic solutions to difficult problems (e.g.
like we did for TSP) - The cutting edge algorithmic solutions to many
problems use the ideas from mathematical
programming, linear programming forming the
foundation
19Example A Linear Program
20Example A Linear Program
y
20
0
x
21Example A Linear Program
y
20
15
(5,5)
0
x
22Example A Linear Program
y
20
15
(5,5)
0
x
23Example A Linear Program
y
20
15
(5,5)
0
x
24Example A Linear Program
y
20
15
0
x
25Example A Linear Program
y
20
15
(5,5)
0
x
26Example A Linear Program
The linear inequalities form a simplex. The
linear cost function creates a hyperplane. The
solution to a general LP is either a unique
vertex or a face of the simplex, including more
than one vertex.
y
20
15
(5,5)
0
x
The simplex method is a greedy algorithm that
moves from one vertex of the feasible set to
another until an optimum is attained.
27The Simplex Method
Transform Linear Program into a system of linear
equations using slack variables
28The Simplex Method
x y s1 s2 P RHS
29The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2 P RHS
30The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2 P RHS
31The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2 P RHS
- At (0,0), P 0
- Increasing x can increase P
- the most (x coefficient has
- larger magnitude than the
- y coefficient)
32The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2 P RHS
- At (0,0), P 0
- Increasing x can increase P
- the most (x coefficient has
- larger magnitude than the
- y coefficient)
- Compute check ratios to find
- pivot row (smallest ratio)
33The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2 P RHS
- At (0,0), P 0
- Increasing x can increase P
- the most (x coefficient has
- larger magnitude than the
- y coefficient)
- Compute check ratios to find
- pivot row (smallest ratio)
34The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2 P RHS
- At (0,0), P 0
- Increasing x can increase P
- the most (x coefficient has
- larger magnitude than the
- y coefficient)
- Compute check ratios to find
- pivot row (smallest ratio)
35The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2 P RHS
- At (0,0), P 0
- Increasing x can increase P
- the most (x coefficient has
- larger magnitude than the
- y coefficient)
- Compute check ratios to find
- pivot row (smallest ratio)
- Pivot around the element in
- both pivot column and row
Pivoting means solve for that variable, Then
substitute into the other equations.
36The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2 P RHS
- At (0,0), P 0
- Increasing x can increase P
- the most (x coefficient has
- larger magnitude than the
- y coefficient)
- Compute check ratios to find
- pivot row (smallest ratio)
- Pivot around the element in
- both pivot column and row
Pivoting means solve for that variable, Then
substitute into the other equations.
37The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2 P
RHS
- At (0,0), P 0
- Increasing x can increase P
- the most (x coefficient has
- larger magnitude than the
- y coefficient)
- Compute check ratios to find
- pivot row (smallest ratio)
- Pivot around the element in
- both pivot column and row
Pivoting means solve for that variable, Then
substitute into the other equations.
38The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2
P RHS
- At (0,0), P 0
- Increasing x can increase P
- the most (x coefficient has
- larger magnitude than the
- y coefficient)
- Compute check ratios to find
- pivot row (smallest ratio)
- Pivot around the element in
- both pivot column and row
Pivoting means solve for that variable, Then
substitute into the other equations.
39The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2
P RHS
- At (0,0), P 0
- Increasing x can increase P
- the most (x coefficient has
- larger magnitude than the
- y coefficient)
- Compute check ratios to find
- pivot row (smallest ratio)
- Pivot around the element in
- both pivot column and row
We have moved from (0,0) to (20/3,0) and
increased the profit from 0 to 400/3. Can we do
better?
40The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2
P RHS
- At (0,0), P 0
- Increasing x can increase P
- the most (x coefficient has
- larger magnitude than the
- y coefficient)
- Compute check ratios to find
- pivot row (smallest ratio)
- Pivot around the element in
- both pivot column and row
We have moved from (0,0) to (20/3,0) and
increased the profit from 0 to 400/3. Can we do
better? Yes! Repeat the procedure.
41The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2
P RHS
- At (0,0), P 0
- Increasing y can increase P
- the most (s1 can only hurt
- the total profit P).
We have moved from (0,0) to (20/3,0) and
increased the profit from 0 to 400/3. Can we do
better? Yes! Repeat the procedure.
42The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2
P RHS
20
- At (0,0), P 0
- Increasing y can increase P
- the most (s1 can only hurt
- the total profit P).
- Compute check ratios to find
- pivot row (smallest ratio)
5
43The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2
P RHS
- At (0,0), P 0
- Increasing y can increase P
- the most (s1 can only hurt
- the total profit P).
- Compute check ratios to find
- pivot row (smallest ratio)
5
44The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2
P RHS
- At (0,0), P 0
- Increasing y can increase P
- the most (s1 can only hurt
- the total profit P).
- Compute check ratios to find
- pivot row (smallest ratio)
- Pivot around the element in
- both pivot column and row
5
Pivoting means solve for that variable, Then
substitute into the other equations.
45The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2
P RHS
- At (0,0), P 0
- Increasing y can increase P
- the most (s1 can only hurt
- the total profit P).
- Compute check ratios to find
- pivot row (smallest ratio)
- Pivot around the element in
- both pivot column and row
Pivoting means solve for that variable, Then
substitute into the other equations.
46The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2 P RHS
- At (0,0), P 0
- Increasing y can increase P
- the most (s1 can only hurt
- the total profit P).
- Compute check ratios to find
- pivot row (smallest ratio)
- Pivot around the element in
- both pivot column and row
Pivoting means solve for that variable, Then
substitute into the other equations.
47The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2 P RHS
- At (0,0), P 0
- Increasing y can increase P
- the most (s1 can only hurt
- the total profit P).
- Compute check ratios to find
- pivot row (smallest ratio)
- Pivot around the element in
- both pivot column and row
We have moved from (0,0) to (20/3,0) and
increased the profit from 0 to 400/3. We then
moved from (20/3,0) to (5,5), Increasing the
profit from 400/3 to 145. Can we do better?
48The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2 P RHS
- At (0,0), P 0
- Increasing y can increase P
- the most (s1 can only hurt
- the total profit P).
- Compute check ratios to find
- pivot row (smallest ratio)
- Pivot around the element in
- both pivot column and row
We have moved from (0,0) to (20/3,0) and
increased the profit from 0 to 400/3. We then
moved from (20/3,0) to (5,5), Increasing the
profit from 400/3 to 145. Can we do better? No!
Increasing s1 or s2 will only make things
worse. We are optimal.
49The Simplex Method
Basic Idea Start from a vertex (x0, y0)
Move to next vertex that increases
profit as much as possible
x y s1 s2 P RHS
y
20
15
We have moved from (0,0) to (20/3,0) and
increased the profit from 0 to 400/3. We then
moved from (20/3,0) to (5,5), Increasing the
profit from 400/3 to 145. Can we do better? No!
Increasing s1 or s2 will only make things
worse. We are optimal.
(5,5)
0
x
50Weve Come Full Circle