Linear Programming
Computational Geometry, WS 2007/08Lecture 7
Prof. Dr. Thomas Ottmann
Algorithmen & Datenstrukturen, Institut für InformatikFakultät für Angewandte WissenschaftenAlbert-Ludwigs-Universität Freiburg
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 2
Overview
• Problem formulation and example.• Incremental, deterministic algorithm.• Randomized algorithm.• Unbounded linear programs.• Linear programming in higher dimensions.
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 3
Problem Description
Maximize c1x1 + c2x2 + ... + cdxd
Subject to the conditions: a1,1x1 + ... a1,dxd b1
a2,1x1 + ... a2,dxd b2
: : :an,1x1 + ... an,dxd bn
Linear program of dimension d: c = (c1,c2,...,cd)hi = {(x1,...,xd) ; ai,1x1 + ... + ai,dxd bi}
li = hyperplane that bounds hi ( straight lines, if d=2 )H = {h1, ... , hn}
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 4
Example
• Production of two goods A and B using four raw materials • Value of A: 6 CU, value of B: 3 CU
Rm1 Rm2 Rm3 Rm4
Prod A
Prod B
Reserve
2
4
5
2 1
2
6 2
4
2 2
3
Maximize profit: fc (x) = 6xA + 3xB under the conditions:
xA = 0, xB xA, xB = 02xA + 4xB 52xA + 1xB 26xA + 2xB 42xA + 2xB 3 xA, xB 0
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 5
Chart
Ii (xA, xB) (xA, xB)
1 (0, 5/4) (5/2, 0)
2 (0, 2) (1, 0)
3 (0, 2) (2/3, 0)
4 (0, 3/2) (3/2, 0)
2
3/2
5/41
1/2
1/22/3 1 3/2 2 5/2xB
xA
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 7
Structure of Feasible Region
1. Bounded
2. Unbounded
3. Empty
C
C
C
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 8
Result
Four possibilities for the solution of a linear program
1. A vertex of the feasible region is the only solution. 2. One edge of the feasible region contains all
solutions. 3. There are no solutions. 4. The feasible region is unbounded toward the
direction of optimization.
In case 2: Choose the lexicographically minimum solution corner
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 9
Bounded Linear Programs
Assumption :
Algorithm UnboundedLP(H, c) yields either
a) a ray in H, which is unbounded towards c, or
b) two half planes h1 and h2, so that h1 h2 is bounded towards c, or
c) the answer, that LP(H, c) has no solution, because the feasible region is empty.
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 10
Incremental Algorithm
Let C2 = h1 h2
Remaining half planes: h3,..., hn
Ci = Ci-1 hi = h1 ... hi
Compute-optimal-vertex (H, c)
v2 := l1 l2 ; C2 := h1 h2
for i := 3 to n do
Ci := Ci-1 hi
vi := optimal vertex of Ci
C2 C3 C4 ... Cn = C
Ci = C =
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 11
Optimal Vertex
Lemma 1: Let 2 < i n, then we have :
1.If vi-1 hi, then vi = vi-1.
2.If vi-1 hi, then either Ci = or vi li, where li is the line bounding hi.
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 12
Optimal Vertex
h1
h2
h3
h4
v3= v4
c
h1
h2
h3
h4
h5
c
v4 v5
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 13
Next Optimal Vertex
fc(x) = c1x1 + c2x2
vi-1
Ci-1
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 14
Algorithm: 2D-LPInput: A 2-dimensional Linear Program (H, c )Output: Either one optimal vertex or or a ray
along which (H, c ) is unbounded.
if UnboundedLP(H, c ) reports (H, c ) is unbounded or infeasible then return UnboundedLP(H, c )
else report h1 := h; h2 := h´ ; v2 := l1 l2 let h3,...,hn be the remaining half-planes of Hfor i:= 3 to n do if vi-1 hi then vi := vi-1
else Si-1 := Hi-1 * livi := 1-dim-LP(Si-1, c )
if vi not exists then return return vn
Running time: O(n²)
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 16
Algorithm: 1D-LP
Find the point x on li that maximizes fc(x) , subject to
the constraints x hj, for 1 j i –1
Observation: li hj is a ray
Let si-1 := { h1 li, ..., hi-1 li}
Algorithm 1D-LP{si-1, c }
p1 = s1
for j := 2 to i-1 do pj = pj-1 sj
if pi-1 then return the optimal vertex of pi-1 else return
Time: O(i)
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 17
Addition of Halfplanes in Different Orders
1 23 4
5 67 89 10
11 12
vi
Good
1 23 4
5 67 8
9 1011 12
Bad
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 18
Optimal Vertex
h1
h2
h3
h4
v3= v4
c
h1
h2
h3
h4
h5
c
v4 v5
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 19
Randomized Algorithm: 2D-LPInput: A 2-dimensional Linear Program (H, c )Output: Either one optimal vertex or or a ray
along which (H, c ) is unbounded.
if UnboundedLP(H, c ) reports (H, c ) is unbounded or infeasible then return UnboundedLP(H, c )
else report h1 := h; h2 := h´ ; v2 := l1 l2 let h3,...,hn be the remaining half-planes of H
compute a random permutation h3, ..., hn
for i:= 3 to n do if vi-1 hi then vi := vi-1
else Si-1 := Hi-1 * livi := 1-dim-LP(Si-1, c )
if vi not exists then return return vn
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 20
Randomization
Theorem:
The 2-dimensional linear programming problem with nconstraints can be solved in O(n) randomizedexpected time using worst-case linear storage.
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 21
Random Variable Xi
n
i
XiO3
i)(
n
i
i
n
i
i XEiXiE33
)()(
E[xi] is the probability that vi-1 hi
Xi = 1, if vi-1 hi, and Xi = 0, otherwise
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 22
Unbounded Linear Programs
imin, an index with i min = min j,1 j n
i := The smaller angle that i makes with c
i : The outward normal of hi
hi
i
i
c
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 23
Unbounded Linear Programs
Hmin := { hj H | j = i min}
Hpar := { hj H | j = - i min}
Hpar {
Hmin {
hi*c
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 24
Lemma
Let H = {h1,h2,...,hn} be a set of half-planes.
Assuming that (Hmin Hpar) is not empty.
1. If li* hj is unbounded in the direction c for every half-plane hj
in the set H \ (Hmin Hpar), then (H, c ) is unbounded along a ray contained in li* .
2. If li* hj* is bounded in the direction c for some hj* in
H \ (Hmin Hpar), then the linear program ({hi* , hj*}, c )
is bounded.
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 25
Algorithm: Unbounded-LP
Input: A 2-Dimensional Linear Program (H, c )
Output: Either a pair of halfplanes bounding the LP or or a ray along which (H, c) is unbounded.
1. For each half plane hi H compute j 2. Let hi be half plane with i = min j,1 j n3. Hmin := { hj H | j = min}4. Hpar := { hj H | j = - min}5. Ĥ = H \ (Hmin Hpar), compute intersection in Hmin Hpar
6. If the intersection is empty then report (H, c ) is infeasible
else Let hi Hmin be the half-plane whose line bounds the intersection
if there is half plane hj* Ĥ such that li*hj* bounded in cthen report ({hi* , hj*}, c ) is boundedelse report is bounded along li* ( Ĥ )
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 26
Higher Dimensions
Let h1,...,hd H be the d certificate half-spaces that UnboundedLP returns.
Ci := h1 h2 ... hi
Lemma: Let d < i n, and let Ci be defined as above.
1. If vi-1 hi, then vi = vi-1
2. If vi-1 hi, then either Ci= or vi gi, where gi is the
hyperplane that bounds hi.
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 27
Algorithm: Randomized-LPInput : A linear program (H, c ).
Output : Either one optimal vertex or or a ray along which (H, c ) is unbounded.
if UnboundedLP(H, c ) reports (H, c ) is unbounded
then Report a ray along which (H, c ) unbounded.
else Let h1,...,hd H be the certificate halfplanes returned by UnboundedLP, and let vd be their vertex of intersection
Compute a random permutation hd+1,...,hn
for i = d+1 to n do if vi-1 hi
then vi = vi-1
else Si-1:= Hi-1 * bd(hi)
vi:= d-1-dim-LP(Si-1, c ) if vi not exists then return
return vn
Top Related