Professional Documents
Culture Documents
Why significant?
!Widely applicable.
!Fast commercial solvers: CPLEX, OSL.
!Powerful modeling languages: AMPL, GAMS.
!Ranked among most important scientific advances of 20th century.
!Dominates world of industry.
Hops Malt
Ale Beer 4A + 4B " 160 35A + 20B " 1190
Beer
5 6
Pr
of
it
n
(P) max c T x
(P) max "cj x j Standard form. !
s. t. Ax = b
Add slack variable for each inequality.
j=1
n !
!
max 13A + 23B
! s. t. 5A + 15B + SC = 480
Linear. No x2, xy, arccos(x), etc. 4 A + 4B + SH = 160
Programming. Planning (term predates computer programming). 35A + 20B + SM = 1190
A , B , SC , SH , SM " 0
9 10
!
Geometry Geometry
11 12
Simplex Algorithm Simplex Algorithm: Basis
max Z subject to
16 A " 23 SC " Z = "736 Basis = {B, SH, SM}
3 15 A = SC = 0
1 A + B + 1 SC = 32 Z = 736
3 15
8 4 B = 32
A " SC + SH = 32
3 15 SH = 32
85 4
3
A "
3
SC + SM = 550 SM = 550
A , B , SC , SH , SM # 0
15 16
!
Simplex Algorithm: Pivot 1 Simplex Algorithm: Pivot 2
max Z subject to
max Z subject to
Basis = {SC, SH, SM} Basis = {B, SH, SM}
13A + 23B " Z = 0 A=B=0
16
3
A " 23
15
SC " Z = "736 A = SC = 0
Z=0
1
3
A + B + 1
15
SC = 32 Z = 736
5A + 15B + SC = 480 B = 32
SC = 480 8 A " 4 SC + SH = 32
4A + 4B + SH = 160
SH = 160
3
85
15
4
SH = 32
A " SC + SM = 550
35A + 20B + SM = 1190 SM = 1190
3 3 SM = 550
A , B , SC , SH , SM # 0
A , B , SC , SH , SM # 0
!
! Substitute: A = 3/8 (32 + 4/15 SC – SH)
Why pivot on column 2?
!Each unit increase in B increases objective value by $23.
max Z subject to
!Pivoting on column 1 also OK. Basis = {A, B, SM}
" SC " 2 SH " Z = "800 SC = SH = 0
B + 1 SC + 18 SH = 28 Z = 800
Why pivot on row 2? 10
1 3 B = 28
A " SC + SH = 12
!Preserves feasibility by ensuring RHS $ 0. 10
25
8
85
A = 12
" SC " SH + SM = 110 SM = 110
Minimum ratio rule: min { 480/15, 160/4, 1190/20 }.
6 8
!
A , B , SC , SH , SM # 0
17 18
1 c 0 0
Q. Why is resulting solution optimal? n n 1
A. Any feasible solution satisfies system of equations in tableaux.
! In particular: Z = 800 – SC – 2 SH public class Simplex {
! Thus, optimal objective value Z* " 800 since SC, SH $ 0. private double[][] a; // simplex tableaux
private int M, N;
! Current BFS has value 800 ! optimal.
public Simplex(double[][] A, double[] b, double[] c) {
M = b.length;
N = c.length;
max Z subject to a = new double[M+1][M+N+1];
Basis = {A, B, SM} for (int i = 0; i < M; i++)
" SC " 2 SH " Z = "800 SC = SH = 0 for (int j = 0; j < N; j++)
B + 1 SC + 18 SH = 28 Z = 800 a[i][j] = A[i][j];
10
A " 1 SC + 3 SH = 12 B = 28 for (int j = N; j < M + N; j++) a[j-N][j] = 1.0;
10
25
8
85
A = 12 for (int j = 0; j < N; j++) a[M][j] = c[j];
" SC " SH + SM = 110 SM = 110
6 8
for (int i = 0; i < M; i++) a[i][M+N] = b[i];
A , B , SC , SH , SM # 0 }
19 20
!
Simplex Algorithm: Bare Bones Implementation Simplex Algorithm: Bare Bones Implementation
q q
Pivot on element (p, q). Simplex algorithm.
p p + +
Degeneracy. New basis, same extreme point. Remarkable property. In practice, simplex algorithm typically
terminates after at most 2(m+n) pivots.
"stalling" is common in practice
! No polynomial pivot rule known.
! Most pivot rules known to be exponential (or worse) in worst-case.
23 24
Simplex Algorithm: Implementation Issues LP Solvers
25 26
Brewer's problem. Find optimal mix of beer and ale to maximize profits. Primal and dual LPs. Given real numbers aij, bi, cj, find real numbers xj, yi
that optimize (P) and (D).
!
Entrepreneur's problem. Buy resources from brewer at min cost. ! !
! C, H, M = unit price for corn, hops, malt. Duality Theorem. [Gale-Kuhn-Tucker 1951, Dantzig-von Neumann 1947]
! Brewer won't agree to sell resources if 5C + 4H + 35M < 13. If (P) and (D) have feasible solutions, then max = min.
27 28
!
LP Duality: Sensitivity Analysis History
Q. How much should brewer be willing to pay (marginal price) for 1939. Production, planning. [Kantorovich]
additional supplies of scarce resources? 1947. Simplex algorithm. [Dantzig]
A. Corn $1, hops $2, malt $0. 1950. Applications in many fields.
1975. Nobel prize in Economics. [Kantorovich and Koopmans]
Q. How do I compute marginal prices (dual variables)? 1979. Ellipsoid algorithm. [Khachian]
A. Simplex solves primal and dual simultaneously. 1984. Projective scaling algorithm. [Karmarkar]
1990. Interior point methods.
objective row of final simplex tableaux 200x. Approximation algorithms, large scale optimization.
provides optimal dual solution!
29 30
31 32
Assignment Problem Assignment Problem: Applications
Non-obvious applications.
1' 2' 3' 4' 5' 1' 2' 3' 4' 5'
!Vehicle routing.
1 3 8 9 15 10 1 3 8 9 15 10 !Signal processing.
2 4 10 7 16 14 2 4 10 7 16 14
!Virtual output queueing.
!Multiple object tracking.
3 9 13 11 19 10 3 9 13 11 19 10 !Approximate string matching.
4 8 13 12 20 13 4 8 13 12 20 13 !Enhance accuracy of solving linear systems of equations.
5 1 7 5 11 9 5 1 7 5 11 9
33 34
35 36