93
CS 473: Algorithms Ruta Mehta University of Illinois, Urbana-Champaign Spring 2018 Ruta (UIUC) CS473 1 Spring 2018 1 / 45

CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

CS 473: Algorithms

Ruta Mehta

University of Illinois, Urbana-Champaign

Spring 2018

Ruta (UIUC) CS473 1 Spring 2018 1 / 45

Page 2: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

CS 473: Algorithms, Spring 2018

Simplex and LP DualityLecture 19March 29, 2018

Some of the slides are courtesy Prof. Chekuri

Ruta (UIUC) CS473 2 Spring 2018 2 / 45

Page 3: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Outline

Simplex: Intuition and Implementation Details

Computing starting vertex: equivalent to solving an LP!

Infeasibility, Unboundedness, and Degeneracy.

Duality: Bounding the objective value through weak-duality

Strong Duality, Cone view.

Ruta (UIUC) CS473 3 Spring 2018 3 / 45

Page 4: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Part I

Recall

Ruta (UIUC) CS473 4 Spring 2018 4 / 45

Page 5: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Feasible Region and Convexity

Canonical FormGiven A ∈ Rn×d , b ∈ Rn×1 and c ∈ R1×d , find x ∈ Rd×1

max : c · xs.t. Ax ≤ b

1 Each linear constraint defines a halfspace, a convex set.

2 Feasible region, which is an intersection of halfspaces, is aconvex polyhedron.

3 Optimal value attained at a vertex of the polyhedron.

Ruta (UIUC) CS473 5 Spring 2018 5 / 45

Page 6: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Feasible Region and Convexity

Canonical FormGiven A ∈ Rn×d , b ∈ Rn×1 and c ∈ R1×d , find x ∈ Rd×1

max : c · xs.t. Ax ≤ b

1 Each linear constraint defines a halfspace, a convex set.

2 Feasible region, which is an intersection of halfspaces, is aconvex polyhedron.

3 Optimal value attained at a vertex of the polyhedron.

Ruta (UIUC) CS473 5 Spring 2018 5 / 45

Page 7: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Ruta (UIUC) CS473 6 Spring 2018 6 / 45

Page 8: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Simplex Algorithm

Simplex: Vertex hoping algorithm

Moves from a vertex to its neighboring vertex

QuestionsWhich neighbor to move to?

When to stop?

How much time does it take?

Ruta (UIUC) CS473 7 Spring 2018 7 / 45

Page 9: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Simplex Algorithm

Simplex: Vertex hoping algorithm

Moves from a vertex to its neighboring vertex

QuestionsWhich neighbor to move to?

When to stop?

How much time does it take?

Ruta (UIUC) CS473 7 Spring 2018 7 / 45

Page 10: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

ObservationsFor Simplex

Suppose we are at a non-optimal vertex x and optimal is x∗, thenc · x∗ > c · x .

How does (c · x) change as we move from x to x∗ on the linejoining the two?

Strictly increases!

Ruta (UIUC) CS473 8 Spring 2018 8 / 45

Page 11: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

ObservationsFor Simplex

Suppose we are at a non-optimal vertex x and optimal is x∗, thenc · x∗ > c · x .

How does (c · x) change as we move from x to x∗ on the linejoining the two?

Strictly increases!

Ruta (UIUC) CS473 8 Spring 2018 8 / 45

Page 12: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

ObservationsFor Simplex

Suppose we are at a non-optimal vertex x and optimal is x∗, thenc · x∗ > c · x .

How does (c · x) change as we move from x to x∗ on the linejoining the two?

Strictly increases!

Ruta (UIUC) CS473 8 Spring 2018 8 / 45

Page 13: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Cone

DefinitionGiven a set of vectors D = {d1, . . . , dk}, the cone spanned bythem is just their positive linear combinations, i.e.,

cone(D) = {d | d =k∑

i=1

λidi , where λi ≥ 0, ∀i}

Ruta (UIUC) CS473 9 Spring 2018 9 / 45

Page 14: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Cone at a Vertex

Let z1, . . . , zk be the neighboring vertices of x . And let di = zi − xbe the direction from x to zi .

LemmaAny feasible direction ofmovement d from x is in thecone({d1, . . . , dk}).

Ruta (UIUC) CS473 10 Spring 2018 10 / 45

Page 15: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Improving Direction Implies Improving Neighbor

LemmaIf d ∈ cone({d1, . . . , dk}) and (c · d) > 0, then there exists disuch that (c · di) > 0.

Proof.To the contrary suppose (c · di) ≤ 0, ∀i ≤ k .Since d is a positive linear combination of di ’s,

(c · d) = (c ·∑k

i=1 λidi)

=∑k

i=1 λi(c · di)≤ 0 A contradiction!

TheoremIf vertex x is not optimal then it has a neighbor where cost improves.

Ruta (UIUC) CS473 11 Spring 2018 11 / 45

Page 16: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Improving Direction Implies Improving Neighbor

LemmaIf d ∈ cone({d1, . . . , dk}) and (c · d) > 0, then there exists disuch that (c · di) > 0.

Proof.To the contrary suppose (c · di) ≤ 0, ∀i ≤ k .Since d is a positive linear combination of di ’s,

(c · d) = (c ·∑k

i=1 λidi)

=∑k

i=1 λi(c · di)≤ 0 A contradiction!

TheoremIf vertex x is not optimal then it has a neighbor where cost improves.

Ruta (UIUC) CS473 11 Spring 2018 11 / 45

Page 17: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Improving Direction Implies Improving Neighbor

LemmaIf d ∈ cone({d1, . . . , dk}) and (c · d) > 0, then there exists disuch that (c · di) > 0.

Proof.To the contrary suppose (c · di) ≤ 0, ∀i ≤ k .Since d is a positive linear combination of di ’s,

(c · d) = (c ·∑k

i=1 λidi)

=∑k

i=1 λi(c · di)≤ 0 A contradiction!

TheoremIf vertex x is not optimal then it has a neighbor where cost improves.

Ruta (UIUC) CS473 11 Spring 2018 11 / 45

Page 18: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

How Many Neighbors a Vertex Has?Geometric view...

A ∈ Rn×d (n > d), b ∈ Rn, theconstraints are: Ax ≤ b

Geometry of facesr linearly independenthyperplanes forms (d − r)dimensional face.

Vertex: 0-D face. formed byd L.I. hyperplanes.

Edge: 1-D face. formed by(d − 1) L.I. hyperlanes.

In 2-dimension (d = 2)

x2

x1

300

200

Ruta (UIUC) CS473 12 Spring 2018 12 / 45

Page 19: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

How Many Neighbors a Vertex Has?Geometric view...

A ∈ Rn×d (n > d), b ∈ Rn, theconstraints are: Ax ≤ b

Geometry of facesr linearly independenthyperplanes forms (d − r)dimensional face.

Vertex: 0-D face. formed byd L.I. hyperplanes.

Edge: 1-D face. formed by(d − 1) L.I. hyperlanes.

In 2-dimension (d = 2)

x2

x1

300

200

Ruta (UIUC) CS473 12 Spring 2018 12 / 45

Page 20: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

How Many Neighbors a Vertex Has?Geometric view...

A ∈ Rn×d (n > d), b ∈ Rn, theconstraints are: Ax ≤ b

Geometry of facesr linearly independenthyperplanes forms (d − r)dimensional face.

Vertex: 0-D face. formed byd L.I. hyperplanes.

Edge: 1-D face. formed by(d − 1) L.I. hyperlanes.

In 2-dimension (d = 2)

x2

x1

300

200

Ruta (UIUC) CS473 12 Spring 2018 12 / 45

Page 21: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

How Many Neighbors a Vertex Has?Geometric view...

A ∈ Rn×d (n > d), b ∈ Rn, theconstraints are: Ax ≤ b

Geometry of facesr linearly independenthyperplanes forms (d − r)dimensional face.

Vertex: 0-D face. formed byd L.I. hyperplanes.

Edge: 1-D face. formed by(d − 1) L.I. hyperlanes.

In 2-dimension (d = 2)

x2

x1

300

200

Ruta (UIUC) CS473 12 Spring 2018 12 / 45

Page 22: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

How Many Neighbors a Vertex Has?Geometric view...

A ∈ Rn×d (n > d), b ∈ Rn, theconstraints are: Ax ≤ b

Geometry of facesr linearly independenthyperplanes forms (d − r)dimensional face.

Vertex: 0-dimensional face.formed by d L.I. hyperplanes.

Edge: 1-D face. formed by(d − 1) L.I. hyperlanes.

In 3-dimension (d = 3)

image source: webpage of Prof. Forbes W. Lewis

Ruta (UIUC) CS473 13 Spring 2018 13 / 45

Page 23: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

How Many Neighbors a Vertex Has?Geometry view...

One neighbor per tight hyperplane. Therefore typically d .

Suppose x ′ is a neighbor ofx , then on the edge joiningthe two d − 1 constraints aretight.

These d − 1 are also tight atboth x and x ′.One more constraints, say i ,is tight at x . “Relaxing” i atx leads to x ′.

x

Ruta (UIUC) CS473 14 Spring 2018 14 / 45

Page 24: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Simplex Algorithm

Simplex: Vertex hoping algorithm

Moves from a vertex to its neighboring vertex

Questions + AnswersWhich neighbor to move to? One where objective valueincreases.

When to stop? When no neighbor with better objective value.

How much time does it take? At most d neighbors to considerin each step.

Ruta (UIUC) CS473 15 Spring 2018 15 / 45

Page 25: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Simplex Algorithm

Simplex: Vertex hoping algorithm

Moves from a vertex to its neighboring vertex

Questions + AnswersWhich neighbor to move to? One where objective valueincreases.

When to stop? When no neighbor with better objective value.

How much time does it take? At most d neighbors to considerin each step.

Ruta (UIUC) CS473 15 Spring 2018 15 / 45

Page 26: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Simplex Algorithm

Simplex: Vertex hoping algorithm

Moves from a vertex to its neighboring vertex

Questions + AnswersWhich neighbor to move to? One where objective valueincreases.

When to stop? When no neighbor with better objective value.

How much time does it take? At most d neighbors to considerin each step.

Ruta (UIUC) CS473 15 Spring 2018 15 / 45

Page 27: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Simplex in Higher Dimensions

Simplex Algorithm1 Start at a vertex of the polytope.

2 Compare value of objective function at each of the d“neighbors”.

3 Move to neighbor that improves objective function, and repeatstep 2.

4 If no improving neighbor, then stop.

Simplex is a greedy local-improvement algorithm! Works because alocal optimum is also a global optimum — convexity of polyhedra.

Ruta (UIUC) CS473 16 Spring 2018 16 / 45

Page 28: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Solving Linear Programming in Practice

1 Naıve implementation of Simplex algorithm can be veryinefficient – Exponential number of steps!

Ruta (UIUC) CS473 17 Spring 2018 17 / 45

Page 29: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Solving Linear Programming in Practice

1 Naıve implementation of Simplex algorithm can be veryinefficient

1 Choosing which neighbor to move to can significantly affectrunning time

2 Very efficient Simplex-based algorithms exist3 Simplex algorithm takes exponential time in the worst case but

works extremely well in practice with many improvements overthe years

2 Non Simplex based methods like interior point methods workwell for large problems.

Ruta (UIUC) CS473 18 Spring 2018 18 / 45

Page 30: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Polynomial time Algorithm for Linear Programming

Major open problem for many years: is there a polynomial timealgorithm for linear programming?

Leonid Khachiyan in 1979 gave the first polynomial time algorithmusing the Ellipsoid method.

1 major theoretical advance

2 highly impractical algorithm, not used at all in practice

3 routinely used in theoretical proofs.

Narendra Karmarkar in 1984 developed another polynomial timealgorithm, the interior point method.

1 very practical for some large problems and beats simplex

2 also revolutionized theory of interior point methods

Following interior point method success, Simplex has been improvedenormously and is the method of choice.

Ruta (UIUC) CS473 19 Spring 2018 19 / 45

Page 31: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Polynomial time Algorithm for Linear Programming

Major open problem for many years: is there a polynomial timealgorithm for linear programming?Leonid Khachiyan in 1979 gave the first polynomial time algorithmusing the Ellipsoid method.

1 major theoretical advance

2 highly impractical algorithm, not used at all in practice

3 routinely used in theoretical proofs.

Narendra Karmarkar in 1984 developed another polynomial timealgorithm, the interior point method.

1 very practical for some large problems and beats simplex

2 also revolutionized theory of interior point methods

Following interior point method success, Simplex has been improvedenormously and is the method of choice.

Ruta (UIUC) CS473 19 Spring 2018 19 / 45

Page 32: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Polynomial time Algorithm for Linear Programming

Major open problem for many years: is there a polynomial timealgorithm for linear programming?Leonid Khachiyan in 1979 gave the first polynomial time algorithmusing the Ellipsoid method.

1 major theoretical advance

2 highly impractical algorithm, not used at all in practice

3 routinely used in theoretical proofs.

Narendra Karmarkar in 1984 developed another polynomial timealgorithm, the interior point method.

1 very practical for some large problems and beats simplex

2 also revolutionized theory of interior point methods

Following interior point method success, Simplex has been improvedenormously and is the method of choice.

Ruta (UIUC) CS473 19 Spring 2018 19 / 45

Page 33: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Polynomial time Algorithm for Linear Programming

Major open problem for many years: is there a polynomial timealgorithm for linear programming?Leonid Khachiyan in 1979 gave the first polynomial time algorithmusing the Ellipsoid method.

1 major theoretical advance

2 highly impractical algorithm, not used at all in practice

3 routinely used in theoretical proofs.

Narendra Karmarkar in 1984 developed another polynomial timealgorithm, the interior point method.

1 very practical for some large problems and beats simplex

2 also revolutionized theory of interior point methods

Following interior point method success, Simplex has been improvedenormously and is the method of choice.

Ruta (UIUC) CS473 19 Spring 2018 19 / 45

Page 34: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Issues

1 Starting vertex

2 The linear program could be infeasible: No point satisfy theconstraints.

3 The linear program could be unbounded: Polygon unbounded inthe direction of the objective function.

4 More than d hyperplanes could be tight at a vertex, formingmore than d neighbors.

Ruta (UIUC) CS473 20 Spring 2018 20 / 45

Page 35: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Computing the Starting VertexEquivalent to solving another LP!

Find an x such that Ax ≤ b.If b ≥ 0 then trivial!

x = 0. Otherwise.

min : ss.t.

∑j aijxj − s ≤ bi , ∀i

s ≥ 0

Trivial feasible solution: x = 0, s = |mini bi |.

If Ax ≤ b feasible then optimal value of the above LP is s = 0.

Checks Feasibility!

Ruta (UIUC) CS473 21 Spring 2018 21 / 45

Page 36: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Computing the Starting VertexEquivalent to solving another LP!

Find an x such that Ax ≤ b.If b ≥ 0 then trivial! x = 0. Otherwise.

min : ss.t.

∑j aijxj − s ≤ bi , ∀i

s ≥ 0

Trivial feasible solution: x = 0, s = |mini bi |.

If Ax ≤ b feasible then optimal value of the above LP is s = 0.

Checks Feasibility!

Ruta (UIUC) CS473 21 Spring 2018 21 / 45

Page 37: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Computing the Starting VertexEquivalent to solving another LP!

Find an x such that Ax ≤ b.If b ≥ 0 then trivial! x = 0. Otherwise.

min : ss.t.

∑j aijxj − s ≤ bi , ∀i

s ≥ 0

Trivial feasible solution:

x = 0, s = |mini bi |.

If Ax ≤ b feasible then optimal value of the above LP is s = 0.

Checks Feasibility!

Ruta (UIUC) CS473 21 Spring 2018 21 / 45

Page 38: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Computing the Starting VertexEquivalent to solving another LP!

Find an x such that Ax ≤ b.If b ≥ 0 then trivial! x = 0. Otherwise.

min : ss.t.

∑j aijxj − s ≤ bi , ∀i

s ≥ 0

Trivial feasible solution: x = 0, s = |mini bi |.

If Ax ≤ b feasible then optimal value of the above LP is s = 0.

Checks Feasibility!

Ruta (UIUC) CS473 21 Spring 2018 21 / 45

Page 39: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Computing the Starting VertexEquivalent to solving another LP!

Find an x such that Ax ≤ b.If b ≥ 0 then trivial! x = 0. Otherwise.

min : ss.t.

∑j aijxj − s ≤ bi , ∀i

s ≥ 0

Trivial feasible solution: x = 0, s = |mini bi |.

If Ax ≤ b feasible then optimal value of the above LP is s = 0.

Checks Feasibility!

Ruta (UIUC) CS473 21 Spring 2018 21 / 45

Page 40: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Computing the Starting VertexEquivalent to solving another LP!

Find an x such that Ax ≤ b.If b ≥ 0 then trivial! x = 0. Otherwise.

min : ss.t.

∑j aijxj − s ≤ bi , ∀i

s ≥ 0

Trivial feasible solution: x = 0, s = |mini bi |.

If Ax ≤ b feasible then optimal value of the above LP is s = 0.

Checks Feasibility!

Ruta (UIUC) CS473 21 Spring 2018 21 / 45

Page 41: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Unboundedness: Example

maximize x2

x1 + x2 ≥ 2

x1, x2 ≥ 0

Unboundedness depends on both constraints and the objectivefunction.

If unbounded in the direction of objective function, then the pivotingstep in the simplex will detect it.

Ruta (UIUC) CS473 22 Spring 2018 22 / 45

Page 42: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Unboundedness: Example

maximize x2

x1 + x2 ≥ 2

x1, x2 ≥ 0

Unboundedness depends on both constraints and the objectivefunction.

If unbounded in the direction of objective function, then the pivotingstep in the simplex will detect it.

Ruta (UIUC) CS473 22 Spring 2018 22 / 45

Page 43: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Degeneracy and Cycling

More than d constraints are tight at vertex x . Say d + 1.

Suppose, we pick first d to form A such that Ax = b, and computedirections d1, . . . , dd .

Then NextVertex(x, di ) will encounter (d + 1)th constraint tight atx and return the same vertex. Hence we are back to x !

Same phenomenon will repeat!

This can be avoided by adding small random perturbation to bi s.

Ruta (UIUC) CS473 23 Spring 2018 23 / 45

Page 44: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Degeneracy and Cycling

More than d constraints are tight at vertex x . Say d + 1.

Suppose, we pick first d to form A such that Ax = b, and computedirections d1, . . . , dd .

Then NextVertex(x, di ) will encounter (d + 1)th constraint tight atx and return the same vertex. Hence we are back to x !

Same phenomenon will repeat!

This can be avoided by adding small random perturbation to bi s.

Ruta (UIUC) CS473 23 Spring 2018 23 / 45

Page 45: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Degeneracy and Cycling

More than d constraints are tight at vertex x . Say d + 1.

Suppose, we pick first d to form A such that Ax = b, and computedirections d1, . . . , dd .

Then NextVertex(x, di ) will encounter (d + 1)th constraint tight atx and return the same vertex. Hence we are back to x !

Same phenomenon will repeat!

This can be avoided by adding small random perturbation to bi s.

Ruta (UIUC) CS473 23 Spring 2018 23 / 45

Page 46: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Degeneracy and Cycling

More than d constraints are tight at vertex x . Say d + 1.

Suppose, we pick first d to form A such that Ax = b, and computedirections d1, . . . , dd .

Then NextVertex(x, di ) will encounter (d + 1)th constraint tight atx and return the same vertex. Hence we are back to x !

Same phenomenon will repeat!

This can be avoided by adding small random perturbation to bi s.

Ruta (UIUC) CS473 23 Spring 2018 23 / 45

Page 47: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Feasible Solutions and Lower Bounds

Consider the program

maximize 4x1+ 2x2

subject to x1+ 3x2 ≤ 52x1− 4x2 ≤ 10x1+ x2 ≤ 7

x1 ≤ 5

1 (0, 1) satisfies all the constraints and gives value 2 for theobjective function.

2 Thus, optimal value σ∗ is at least 4.

3 (2, 0) also feasible, and gives a better bound of 8.

4 How good is 8 when compared with σ∗?

Ruta (UIUC) CS473 24 Spring 2018 24 / 45

Page 48: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Feasible Solutions and Lower Bounds

Consider the program

maximize 4x1+ 2x2

subject to x1+ 3x2 ≤ 52x1− 4x2 ≤ 10x1+ x2 ≤ 7

x1 ≤ 5

1 (0, 1) satisfies all the constraints and gives value 2 for theobjective function.

2 Thus, optimal value σ∗ is at least 4.

3 (2, 0) also feasible, and gives a better bound of 8.

4 How good is 8 when compared with σ∗?

Ruta (UIUC) CS473 24 Spring 2018 24 / 45

Page 49: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Feasible Solutions and Lower Bounds

Consider the program

maximize 4x1+ 2x2

subject to x1+ 3x2 ≤ 52x1− 4x2 ≤ 10x1+ x2 ≤ 7

x1 ≤ 5

1 (0, 1) satisfies all the constraints and gives value 2 for theobjective function.

2 Thus, optimal value σ∗ is at least 4.

3 (2, 0) also feasible, and gives a better bound of 8.

4 How good is 8 when compared with σ∗?

Ruta (UIUC) CS473 24 Spring 2018 24 / 45

Page 50: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Feasible Solutions and Lower Bounds

Consider the program

maximize 4x1+ 2x2

subject to x1+ 3x2 ≤ 52x1− 4x2 ≤ 10x1+ x2 ≤ 7

x1 ≤ 5

1 (0, 1) satisfies all the constraints and gives value 2 for theobjective function.

2 Thus, optimal value σ∗ is at least 4.

3 (2, 0) also feasible, and gives a better bound of 8.

4 How good is 8 when compared with σ∗?

Ruta (UIUC) CS473 24 Spring 2018 24 / 45

Page 51: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Feasible Solutions and Lower Bounds

Consider the program

maximize 4x1+ 2x2

subject to x1+ 3x2 ≤ 52x1− 4x2 ≤ 10x1+ x2 ≤ 7

x1 ≤ 5

1 (0, 1) satisfies all the constraints and gives value 2 for theobjective function.

2 Thus, optimal value σ∗ is at least 4.

3 (2, 0) also feasible, and gives a better bound of 8.

4 How good is 8 when compared with σ∗?

Ruta (UIUC) CS473 24 Spring 2018 24 / 45

Page 52: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Obtaining Upper Bounds

maximize 4x1+ 2x2

subject to x1+ 3x2 ≤ 52x1− 4x2 ≤ 10x1+ x2 ≤ 7

x1 ≤ 5

1 Let us multiply the first constraint by 2 and the and add it tosecond constraint

2( x1+ 3x2 ) ≤ 2(5)+1( 2x1− 4x2 ) ≤ 1(10)

4x1+ 2x2 ≤ 20

2 Thus, 20 is an upper bound on the optimum value!

Ruta (UIUC) CS473 25 Spring 2018 25 / 45

Page 53: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Obtaining Upper Bounds

maximize 4x1+ 2x2

subject to x1+ 3x2 ≤ 52x1− 4x2 ≤ 10x1+ x2 ≤ 7

x1 ≤ 5

1 Let us multiply the first constraint by 2 and the and add it tosecond constraint

2( x1+ 3x2 ) ≤ 2(5)+1( 2x1− 4x2 ) ≤ 1(10)

4x1+ 2x2 ≤ 20

2 Thus, 20 is an upper bound on the optimum value!

Ruta (UIUC) CS473 25 Spring 2018 25 / 45

Page 54: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Obtaining Upper Bounds

maximize 4x1+ 2x2

subject to x1+ 3x2 ≤ 52x1− 4x2 ≤ 10x1+ x2 ≤ 7

x1 ≤ 5

1 Let us multiply the first constraint by 2 and the and add it tosecond constraint

2( x1+ 3x2 ) ≤ 2(5)+1( 2x1− 4x2 ) ≤ 1(10)

4x1+ 2x2 ≤ 20

2 Thus, 20 is an upper bound on the optimum value!

Ruta (UIUC) CS473 25 Spring 2018 25 / 45

Page 55: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Generalizing . . .

1 Multiply first equation by y1, second by y2, third by y3 andfourth by y4 (y1, y2, y3, y4 ≥ 0) and add

y1( x1+ 3x2 ) ≤ y1(5)+y2( 2x1− 4x2 ) ≤ y2(10)+y3( x1+ x2 ) ≤ y3(7)+y4( x1 ) ≤ y4(5)(y1 + 2y2 + y3 + y4)x1 + (3y1 − 4y2 + y3)x2 ≤ . . .

2 5y1 + 10y2 + 7y3 + 5y4 is an upper bound, provided coefficientsof xi are same as in the objective function (4x1 + 2x2),

y1 + 2y2 + y3 + y4 = 4 3y1 − 4y2 + y3 = 2

3 Subject to these constrains, the best upper bound ismin : 5y1 + 10y2 + 7y3 + 5y4!

Ruta (UIUC) CS473 26 Spring 2018 26 / 45

Page 56: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Generalizing . . .

1 Multiply first equation by y1, second by y2, third by y3 andfourth by y4 (y1, y2, y3, y4 ≥ 0) and add

y1( x1+ 3x2 ) ≤ y1(5)+y2( 2x1− 4x2 ) ≤ y2(10)+y3( x1+ x2 ) ≤ y3(7)+y4( x1 ) ≤ y4(5)(y1 + 2y2 + y3 + y4)x1 + (3y1 − 4y2 + y3)x2 ≤ . . .

2 5y1 + 10y2 + 7y3 + 5y4 is an upper bound,

provided coefficientsof xi are same as in the objective function (4x1 + 2x2),

y1 + 2y2 + y3 + y4 = 4 3y1 − 4y2 + y3 = 2

3 Subject to these constrains, the best upper bound ismin : 5y1 + 10y2 + 7y3 + 5y4!

Ruta (UIUC) CS473 26 Spring 2018 26 / 45

Page 57: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Generalizing . . .

1 Multiply first equation by y1, second by y2, third by y3 andfourth by y4 (y1, y2, y3, y4 ≥ 0) and add

y1( x1+ 3x2 ) ≤ y1(5)+y2( 2x1− 4x2 ) ≤ y2(10)+y3( x1+ x2 ) ≤ y3(7)+y4( x1 ) ≤ y4(5)(y1 + 2y2 + y3 + y4)x1 + (3y1 − 4y2 + y3)x2 ≤ . . .

2 5y1 + 10y2 + 7y3 + 5y4 is an upper bound, provided coefficientsof xi are same as in the objective function (4x1 + 2x2),

y1 + 2y2 + y3 + y4 = 4 3y1 − 4y2 + y3 = 2

3 Subject to these constrains, the best upper bound ismin : 5y1 + 10y2 + 7y3 + 5y4!

Ruta (UIUC) CS473 26 Spring 2018 26 / 45

Page 58: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Generalizing . . .

1 Multiply first equation by y1, second by y2, third by y3 andfourth by y4 (y1, y2, y3, y4 ≥ 0) and add

y1( x1+ 3x2 ) ≤ y1(5)+y2( 2x1− 4x2 ) ≤ y2(10)+y3( x1+ x2 ) ≤ y3(7)+y4( x1 ) ≤ y4(5)(y1 + 2y2 + y3 + y4)x1 + (3y1 − 4y2 + y3)x2 ≤ . . .

2 5y1 + 10y2 + 7y3 + 5y4 is an upper bound, provided coefficientsof xi are same as in the objective function (4x1 + 2x2),

y1 + 2y2 + y3 + y4 = 4 3y1 − 4y2 + y3 = 2

3 Subject to these constrains, the best upper bound ismin : 5y1 + 10y2 + 7y3 + 5y4!

Ruta (UIUC) CS473 26 Spring 2018 26 / 45

Page 59: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Dual LP: Example

Thus, the optimum value of program

maximize 4x1 + 2x2

subject to x1 + 3x2 ≤ 52x1 − 4x2 ≤ 10

x1 + x2 ≤ 7x1 ≤ 5

is upper bounded by the optimal value of the program

minimize 5y1 + 10y2 + 7y3 + 5y4

subject to y1 + 2y2 + y3 + y4 = 43y1 − 4y2 + y3 = 2

y1, y2 ≥ 0

Ruta (UIUC) CS473 27 Spring 2018 27 / 45

Page 60: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Dual Linear Program

Given a linear program Π in canonical form

maximize∑d

j=1 cjxj

subject to∑d

j=1 aijxj ≤ bi i = 1, 2, . . . n

the dual Dual(Π) is given by

minimize∑n

i=1 biyisubject to

∑ni=1 yiaij = cj j = 1, 2, . . . d

yi ≥ 0 i = 1, 2, . . . n

Proposition

Dual(Dual(Π)) is equivalent to Π

Ruta (UIUC) CS473 28 Spring 2018 28 / 45

Page 61: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Dual Linear Program

Given a linear program Π in canonical form

maximize∑d

j=1 cjxj

subject to∑d

j=1 aijxj ≤ bi i = 1, 2, . . . n

the dual Dual(Π) is given by

minimize∑n

i=1 biyisubject to

∑ni=1 yiaij = cj j = 1, 2, . . . d

yi ≥ 0 i = 1, 2, . . . n

Proposition

Dual(Dual(Π)) is equivalent to Π

Ruta (UIUC) CS473 28 Spring 2018 28 / 45

Page 62: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Dual Linear ProgramSuccinct representation..

Given a A ∈ Rn×d , b ∈ Rn and c ∈ Rd , linear program Π

maximize c · xsubject to Ax ≤ b

the dual Dual(Π) is given by

minimize y · bsubject to yA = c

y ≥ 0

Proposition

Dual(Dual(Π)) is equivalent to Π

Ruta (UIUC) CS473 29 Spring 2018 29 / 45

Page 63: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Duality Theorem

Theorem (Weak Duality)

If x is a feasible solution to Π and y is a feasible solution toDual(Π) then c · x ≤ y · b.

Theorem (Strong Duality)

If x∗ is an optimal solution to Π and y∗ is an optimal solution toDual(Π) then c · x∗ = y∗ · b.

Many applications! Maxflow-Mincut theorem can be deduced fromduality.

Ruta (UIUC) CS473 30 Spring 2018 30 / 45

Page 64: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Duality Theorem

Theorem (Weak Duality)

If x is a feasible solution to Π and y is a feasible solution toDual(Π) then c · x ≤ y · b.

Theorem (Strong Duality)

If x∗ is an optimal solution to Π and y∗ is an optimal solution toDual(Π) then c · x∗ = y∗ · b.

Many applications! Maxflow-Mincut theorem can be deduced fromduality.

Ruta (UIUC) CS473 30 Spring 2018 30 / 45

Page 65: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Weak Duality

Theorem (Weak Duality)

If x is a feasible solution to Π and y is a feasible solution toDual(Π) then c · x ≤ y · b.

We already saw the proof by the way we derived it but we will do itagain formally.

Proof.Since y ′ is feasible in Dual(Π): y ′A = c

Therefore c · x ′ = y ′Ax ′

Since x ′ is feasible in Π, Ax ′ ≤ b and hence,

c · x ′ = y ′Ax ′ ≤ y ′ · b

Ruta (UIUC) CS473 31 Spring 2018 31 / 45

Page 66: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Weak Duality

Theorem (Weak Duality)

If x is a feasible solution to Π and y is a feasible solution toDual(Π) then c · x ≤ y · b.

We already saw the proof by the way we derived it but we will do itagain formally.

Proof.Since y ′ is feasible in Dual(Π): y ′A = c

Therefore c · x ′ = y ′Ax ′

Since x ′ is feasible in Π, Ax ′ ≤ b and hence,

c · x ′ = y ′Ax ′ ≤ y ′ · b

Ruta (UIUC) CS473 31 Spring 2018 31 / 45

Page 67: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Weak Duality

Theorem (Weak Duality)

If x is a feasible solution to Π and y is a feasible solution toDual(Π) then c · x ≤ y · b.

We already saw the proof by the way we derived it but we will do itagain formally.

Proof.Since y ′ is feasible in Dual(Π): y ′A = c

Therefore c · x ′ = y ′Ax ′

Since x ′ is feasible in Π, Ax ′ ≤ b and hence,

c · x ′ = y ′Ax ′ ≤ y ′ · bRuta (UIUC) CS473 31 Spring 2018 31 / 45

Page 68: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Strong Duality and Complementary Slackness

maximize : c · xsubject to Ax ≤ b

Dual−−→minimize : y · bsubject to yA = c

y ≥ 0

Definition (Complementary Slackness)

x feasible in Π and y feasible in Dual(Π), s.t.,∀i = 1..n, yi > 0 ⇒ (Ax)i = bi

Geoemetric Interpretation: c is in the cone of the normal vectorsof the tight hyperplanes at x .

Ruta (UIUC) CS473 32 Spring 2018 32 / 45

Page 69: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Strong Duality and Complementary Slackness

maximize : c · xsubject to Ax ≤ b

Dual−−→minimize : y · bsubject to yA = c

y ≥ 0

Definition (Complementary Slackness)

x feasible in Π and y feasible in Dual(Π), s.t.,∀i = 1..n, yi > 0 ⇒ (Ax)i = bi

Geoemetric Interpretation: c is in the cone of the normal vectorsof the tight hyperplanes at x .

Ruta (UIUC) CS473 32 Spring 2018 32 / 45

Page 70: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Strong Duality and Complementary Slackness

Definition (Complementary Slackness)

x feasible in Π and y feasible in Dual(Π), s.t.,∀i = 1..n, yi > 0 ⇒ (Ax)i = bi

Theorem(x∗, y∗) satisfies complementary Slackness if and only if strongduality holds, i.e., c · x∗ = y∗ · b.

Proof.

(⇒)

c · x∗ = (y∗A) · x∗= y∗ · (Ax∗)

=∑n

i=1 y∗i (Ax∗)i=

∑i :yi>0 y∗i (Ax∗)i

=∑

i y∗i bi = y∗ · b

Ruta (UIUC) CS473 33 Spring 2018 33 / 45

Page 71: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Strong Duality and Complementary Slackness

Definition (Complementary Slackness)

x feasible in Π and y feasible in Dual(Π), s.t.,∀i = 1..n, yi > 0 ⇒ (Ax)i = bi

Theorem(x∗, y∗) satisfies complementary Slackness if and only if strongduality holds, i.e., c · x∗ = y∗ · b.

Proof.

(⇒)

c · x∗ = (y∗A) · x∗= y∗ · (Ax∗)=

∑ni=1 y∗i (Ax∗)i

=∑

i :yi>0 y∗i (Ax∗)i

=∑

i y∗i bi = y∗ · b

Ruta (UIUC) CS473 33 Spring 2018 33 / 45

Page 72: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Strong Duality and Complementary Slackness

Definition (Complementary Slackness)

x feasible in Π and y feasible in Dual(Π), s.t.,∀i = 1..n, yi > 0 ⇒ (Ax)i = bi

Theorem(x∗, y∗) satisfies complementary Slackness if and only if strongduality holds, i.e., c · x∗ = y∗ · b.

Proof.

(⇒)

c · x∗ = (y∗A) · x∗= y∗ · (Ax∗)=

∑ni=1 y∗i (Ax∗)i

=∑

i :yi>0 y∗i (Ax∗)i

=∑

i y∗i bi = y∗ · b

Ruta (UIUC) CS473 33 Spring 2018 33 / 45

Page 73: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Strong Duality and Complementary Slackness

Definition (Complementary Slackness)

x feasible in Π and y feasible in Dual(Π), s.t.,∀i = 1..n, yi > 0 ⇒ (Ax)i = bi

Theorem(x∗, y∗) satisfies complementary Slackness if and only if strongduality holds, i.e., c · x∗ = y∗ · b.

Proof.(⇐)

Exercise

Ruta (UIUC) CS473 34 Spring 2018 34 / 45

Page 74: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Strong Duality and Complementary Slackness

Definition (Complementary Slackness)

x feasible in Π and y feasible in Dual(Π), s.t.,∀i = 1..n, yi > 0 ⇒ (Ax)i = bi

Theorem(x∗, y∗) satisfies complementary Slackness if and only if strongduality holds, i.e., c · x∗ = y∗ · b.

Proof.(⇐) Exercise

Ruta (UIUC) CS473 34 Spring 2018 34 / 45

Page 75: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Duality for another canonical form

maximize 4x1+ x2+ 3x3

subject to x1+ 4x2 ≤ 22x1− x2+ x3 ≤ 4

x1, x2, x3 ≥ 0

Choose non-negative y1, y2 and multiply inequalities

maximize 4x1+ x2+ 3x3

subject to y1(x1+ 4x2 ) ≤ 2y1

y2(2x1− x2+ x3) ≤ 4y2

x1, x2, x3 ≥ 0

Ruta (UIUC) CS473 35 Spring 2018 35 / 45

Page 76: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Duality for another canonical form

maximize 4x1+ x2+ 3x3

subject to x1+ 4x2 ≤ 22x1− x2+ x3 ≤ 4

x1, x2, x3 ≥ 0

Choose non-negative y1, y2 and multiply inequalities

maximize 4x1+ x2+ 3x3

subject to y1(x1+ 4x2 ) ≤ 2y1

y2(2x1− x2+ x3) ≤ 4y2

x1, x2, x3 ≥ 0

Ruta (UIUC) CS473 35 Spring 2018 35 / 45

Page 77: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Duality for another canonical form

Choose non-negative y1, y2 and multiply inequalities

maximize 4x1+ x2+ 3x3

subject to y1(x1+ 4x2 ) ≤ 2y1

y2(2x1− x2+ x3) ≤ 4y2

x1, x2, x3 ≥ 0

Adding the inequalities we get an inequality below that is valid forany feasible x and any non-negative y :

(y1 + 2y2)x1 + (4y1 − y2)x2 + y2x3 ≤ 2y1 + 4y2

Suppose we choose y1, y2 such thaty1 + 2y2 ≥ 4 and 4y2 − y2 ≥ 1 and y2 ≥ 3Then, since x1, x2, x3 ≥ 0, we have 4x1 + x2 + 3x3 ≤ 2y1 + 4y2

Ruta (UIUC) CS473 36 Spring 2018 36 / 45

Page 78: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Duality for another canonical form

Choose non-negative y1, y2 and multiply inequalities

maximize 4x1+ x2+ 3x3

subject to y1(x1+ 4x2 ) ≤ 2y1

y2(2x1− x2+ x3) ≤ 4y2

x1, x2, x3 ≥ 0

Adding the inequalities we get an inequality below that is valid forany feasible x and any non-negative y :

(y1 + 2y2)x1 + (4y1 − y2)x2 + y2x3 ≤ 2y1 + 4y2

Suppose we choose y1, y2 such thaty1 + 2y2 ≥ 4 and 4y2 − y2 ≥ 1 and y2 ≥ 3Then, since x1, x2, x3 ≥ 0, we have 4x1 + x2 + 3x3 ≤ 2y1 + 4y2

Ruta (UIUC) CS473 36 Spring 2018 36 / 45

Page 79: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Duality for another canonical form

maximize 4x1+ x2+ 3x3

subject to x1+ 4x2 ≤ 22x1− x2+ x3 ≤ 4

x1, x2, x3 ≥ 0

is upper bounded by

minimize 2y1+ 4y2

subject to y1+ 2y2 ≥ 44y1− y2 ≥ 1

y2 ≥ 3y1, y2 ≥ 0

Ruta (UIUC) CS473 37 Spring 2018 37 / 45

Page 80: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Duality for another canonical form

Compactly, for the primal LP Π

max c · xsubject to Ax ≤ b, x ≥ 0

the dual LP is Dual(Π)

min y · bsubject to yA ≥ c, y ≥ 0

Definition (Complementary Slackness)

x feasible in Π and y feasible in Dual(Π), s.t.,∀i = 1, . . . , n, yi > 0 ⇒ (Ax)i = bi∀j = 1, . . . , d , xj > 0 ⇒ (yA)j = cj

Ruta (UIUC) CS473 38 Spring 2018 38 / 45

Page 81: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Duality for another canonical form

Compactly, for the primal LP Π

max c · xsubject to Ax ≤ b, x ≥ 0

the dual LP is Dual(Π)

min y · bsubject to yA ≥ c, y ≥ 0

Definition (Complementary Slackness)

x feasible in Π and y feasible in Dual(Π), s.t.,∀i = 1, . . . , n, yi > 0 ⇒ (Ax)i = bi∀j = 1, . . . , d , xj > 0 ⇒ (yA)j = cj

Ruta (UIUC) CS473 38 Spring 2018 38 / 45

Page 82: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

In General...from Jeff’s notes

Ruta (UIUC) CS473 39 Spring 2018 39 / 45

Page 83: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Some Useful Duality Properties

Assume primal LP is a maximization LP.

For a given LP, Dual is another LP. The variables in the dualcorrespond to “tight” primal constraints and vice-versa.

Dual of the dual LP give us back the primal LP.

Weak and strong duality theorems.

If primal is unbounded (objective achieves infinity) then dual LPis infeasible. Why? If dual LP had a feasible solution it wouldupper bound the primal LP which is not possible.

If primal is infeasible then dual LP is unbounded.

Primal and dual optimum solutions satisfy complementaryslackness conditions (discussed soon).

Ruta (UIUC) CS473 40 Spring 2018 40 / 45

Page 84: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Some Useful Duality Properties

Assume primal LP is a maximization LP.

For a given LP, Dual is another LP. The variables in the dualcorrespond to “tight” primal constraints and vice-versa.

Dual of the dual LP give us back the primal LP.

Weak and strong duality theorems.

If primal is unbounded (objective achieves infinity) then dual LPis infeasible. Why? If dual LP had a feasible solution it wouldupper bound the primal LP which is not possible.

If primal is infeasible then dual LP is unbounded.

Primal and dual optimum solutions satisfy complementaryslackness conditions (discussed soon).

Ruta (UIUC) CS473 40 Spring 2018 40 / 45

Page 85: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Some Useful Duality Properties

Assume primal LP is a maximization LP.

For a given LP, Dual is another LP. The variables in the dualcorrespond to “tight” primal constraints and vice-versa.

Dual of the dual LP give us back the primal LP.

Weak and strong duality theorems.

If primal is unbounded (objective achieves infinity) then dual LPis infeasible. Why? If dual LP had a feasible solution it wouldupper bound the primal LP which is not possible.

If primal is infeasible then dual LP is unbounded.

Primal and dual optimum solutions satisfy complementaryslackness conditions (discussed soon).

Ruta (UIUC) CS473 40 Spring 2018 40 / 45

Page 86: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Some Useful Duality Properties

Assume primal LP is a maximization LP.

For a given LP, Dual is another LP. The variables in the dualcorrespond to “tight” primal constraints and vice-versa.

Dual of the dual LP give us back the primal LP.

Weak and strong duality theorems.

If primal is unbounded (objective achieves infinity) then dual LPis infeasible. Why? If dual LP had a feasible solution it wouldupper bound the primal LP which is not possible.

If primal is infeasible then dual LP is unbounded.

Primal and dual optimum solutions satisfy complementaryslackness conditions (discussed soon).

Ruta (UIUC) CS473 40 Spring 2018 40 / 45

Page 87: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Some Useful Duality Properties

Assume primal LP is a maximization LP.

For a given LP, Dual is another LP. The variables in the dualcorrespond to “tight” primal constraints and vice-versa.

Dual of the dual LP give us back the primal LP.

Weak and strong duality theorems.

If primal is unbounded (objective achieves infinity) then dual LPis infeasible. Why? If dual LP had a feasible solution it wouldupper bound the primal LP which is not possible.

If primal is infeasible then dual LP is unbounded.

Primal and dual optimum solutions satisfy complementaryslackness conditions (discussed soon).

Ruta (UIUC) CS473 40 Spring 2018 40 / 45

Page 88: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Some Useful Duality Properties

Assume primal LP is a maximization LP.

For a given LP, Dual is another LP. The variables in the dualcorrespond to “tight” primal constraints and vice-versa.

Dual of the dual LP give us back the primal LP.

Weak and strong duality theorems.

If primal is unbounded (objective achieves infinity) then dual LPis infeasible. Why? If dual LP had a feasible solution it wouldupper bound the primal LP which is not possible.

If primal is infeasible then dual LP is unbounded.

Primal and dual optimum solutions satisfy complementaryslackness conditions (discussed soon).

Ruta (UIUC) CS473 40 Spring 2018 40 / 45

Page 89: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Part II

Examples of Duality

Ruta (UIUC) CS473 41 Spring 2018 41 / 45

Page 90: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Max matching in bipartite graph as LP

Input:G = (V = L ∪ R, E)

max∑uv∈E

xuv

s.t.∑uv∈E

xuv ≤ 1 ∀v ∈ V .

xuv ≥ 0 ∀uv ∈ E

When one writes combinatorial problems as LPs one is writing asingle formulation in an abstract way that applies to all instances. Inthe above, for each fixed graph G one gets a fixed LP and hence theabove is sometimes called a “formulation”.

Ruta (UIUC) CS473 42 Spring 2018 42 / 45

Page 91: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Max matching in bipartite graph as LP

Input:G = (V = L ∪ R, E)

max∑uv∈E

xuv

s.t.∑uv∈E

xuv ≤ 1 ∀v ∈ V .

xuv ≥ 0 ∀uv ∈ E

Dual LP has one variable yv for each vertex v ∈ V .

min∑v∈V

yv

s.t. yu + yv ≥ 1 ∀uv ∈ E

yv ≥ 0 ∀v ∈ VRuta (UIUC) CS473 43 Spring 2018 43 / 45

Page 92: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Network flow

s-t flow in directed graph G = (V ,E) with capacities c . Assumefor simplicity that no incoming edges into s.

max∑

(s,v)∈E

x(s, v)

∑(u,v)∈E

x(u, v)−∑

(v ,w)∈E

x(v ,w) = 0 ∀v ∈ V \ {s, t}

x(u, v) ≤ c(u, v) ∀(u, v) ∈ E

x(u, v) ≥ 0 ∀(u, v) ∈ E.

Ruta (UIUC) CS473 44 Spring 2018 44 / 45

Page 93: CS 473: Algorithms · Narendra Karmarkar in 1984 developed another polynomial time algorithm, theinterior point method. 1 very practical for some large problems and beats simplex

Dual of Network Flow

Ruta (UIUC) CS473 45 Spring 2018 45 / 45