Linear Programming Duality Eric Price UT Austin CS 331, Spring - - PowerPoint PPT Presentation

linear programming duality
SMART_READER_LITE
LIVE PREVIEW

Linear Programming Duality Eric Price UT Austin CS 331, Spring - - PowerPoint PPT Presentation

Linear Programming Duality Eric Price UT Austin CS 331, Spring 2020 Coronavirus Edition CS 331, Spring Eric Price (UT Austin) Linear Programming Duality / 19 Plan for the class Today: linear programming duality Tonight: problem set on LPs


slide-1
SLIDE 1

Linear Programming Duality

Eric Price

UT Austin

CS 331, Spring 2020 Coronavirus Edition

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-2
SLIDE 2

Plan for the class

Today: linear programming duality Tonight: problem set on LPs Last 2 weeks of class: complexity theory 1 problem set on complexity theory Final exam: given out after last class, due two days later.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-3
SLIDE 3

Class Outline

1

LP Duality

2

Reducing Problems to Linear Programs

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-4
SLIDE 4

Linear Programming

Maximize/minimize linear objective subject to linear constraints.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-5
SLIDE 5

Linear Programming

Maximize/minimize linear objective subject to linear constraints. Last class:

◮ Solution lies at a vertex of feasible region. ◮ Ways to translate between formulations (≤ / = / ≥, x ≥ 0 or not) ◮ Ways to solve (simplex) Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-6
SLIDE 6

Special Cases

Infeasible: no possible answer.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-7
SLIDE 7

Special Cases

Infeasible: no possible answer. Unbounded: infinitely good answer.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-8
SLIDE 8

Linear Programming Upper bound?

Cars & trucks example: maximize: C + 2T (value) subject to: 2C + 3T ≤ 12 (metal) C + 5T ≤ 15 (wood) C, T ≥ 0

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-9
SLIDE 9

Linear Programming Upper bound?

Cars & trucks example: maximize: C + 2T (value) subject to: 2C + 3T ≤ 12 (metal) C + 5T ≤ 15 (wood) C, T ≥ 0 Last class we solved it, but it took some effort.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-10
SLIDE 10

Linear Programming Upper bound?

Cars & trucks example: maximize: C + 2T (value) subject to: 2C + 3T ≤ 12 (metal) C + 5T ≤ 15 (wood) C, T ≥ 0 Last class we solved it, but it took some effort. Simple to prove a lower bound on answer OPT:

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-11
SLIDE 11

Linear Programming Upper bound?

Cars & trucks example: maximize: C + 2T (value) subject to: 2C + 3T ≤ 12 (metal) C + 5T ≤ 15 (wood) C, T ≥ 0 Last class we solved it, but it took some effort. Simple to prove a lower bound on answer OPT:

◮ OPT ≥ 6 because (6, 0) possible. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-12
SLIDE 12

Linear Programming Upper bound?

Cars & trucks example: maximize: C + 2T (value) subject to: 2C + 3T ≤ 12 (metal) C + 5T ≤ 15 (wood) C, T ≥ 0 Last class we solved it, but it took some effort. Simple to prove a lower bound on answer OPT:

◮ OPT ≥ 6 because (6, 0) possible.

Question: can you easily show an upper bound on OPT?

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-13
SLIDE 13

Linear Programming Upper bound?

Cars & trucks example: maximize: C + 2T (value) subject to: 2C + 3T ≤ 12 (metal) C + 5T ≤ 15 (wood) C, T ≥ 0 Last class we solved it, but it took some effort. Simple to prove a lower bound on answer OPT:

◮ OPT ≥ 6 because (6, 0) possible.

Question: can you easily show an upper bound on OPT?

◮ Is the answer larger than 20? Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-14
SLIDE 14

Linear Programming Upper bound?

Cars & trucks example: maximize: C + 2T (value) subject to: 2C + 3T ≤ 12 (metal) C + 5T ≤ 15 (wood) C, T ≥ 0 Last class we solved it, but it took some effort. Simple to prove a lower bound on answer OPT:

◮ OPT ≥ 6 because (6, 0) possible.

Question: can you easily show an upper bound on OPT?

◮ Is the answer larger than 20? ◮ No: C + 2T ≤ 2C + 3T ≤ 12. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-15
SLIDE 15

Linear Programming Upper bound?

Cars & trucks example: maximize: C + 2T (value) subject to: 2C + 3T ≤ 12 (metal) C + 5T ≤ 15 (wood) C, T ≥ 0 Last class we solved it, but it took some effort. Simple to prove a lower bound on answer OPT:

◮ OPT ≥ 6 because (6, 0) possible.

Question: can you easily show an upper bound on OPT?

◮ Is the answer larger than 20? ◮ No: C + 2T ≤ 2C + 3T ≤ 12. ◮ But also:

C + 2T ≤ C + 8 3T = 1 3((2C + 3T) + (C + 5T)) ≤ 1 3(12 + 15) = 9.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-16
SLIDE 16

Linear Programming Upper bound?

Primal maximize: C + 2T (value) subject to: 2C + 3T ≤ 12 (metal) C + 5T ≤ 15 (wood) C, T ≥ 0 Get an upper bound by combining the constraints: C + 2T ≤ C + 8 3T = 1 3((2C + 3T) + (C + 5T)) ≤ 1 3(12 + 15) = 9.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-17
SLIDE 17

Linear Programming Upper bound?

Primal maximize: C + 2T (value) subject to: 2C + 3T ≤ 12 (metal) C + 5T ≤ 15 (wood) C, T ≥ 0 Get an upper bound by combining the constraints: C + 2T ≤ C + 8 3T = 1 3((2C + 3T) + (C + 5T)) ≤ 1 3(12 + 15) = 9. The above is 1

3 of each. What is the best (α, β) combination?

Dual OPT ≤ 12α + 15β (value) where: 2α + β ≥ 1 (cars) 3α + 5β ≥ 2 (trucks) α, β ≥ 0

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-18
SLIDE 18

Linear Programming Duality

Primal maximize: C + 2T (value) subject to: 2C + 3T ≤ 12 (metal) C + 5T ≤ 15 (wood) C, T ≥ 0 Get an upper bound by combining the constraints: C + 2T ≤ C + 8 3T = 1 3((2C + 3T) + (C + 5T)) ≤ 1 3(12 + 15) = 9. The above is 1

3 of each. What is the best (α, β) combination?

Dual minimize: 12α + 15β (value) where: 2α + β ≥ 1 (cars) 3α + 5β ≥ 2 (trucks) α, β ≥ 0

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-19
SLIDE 19

Linear Programming Duality

Primal maximize: C + 2T (value) subject to: 2C + 3T ≤ 12 (metal) C + 5T ≤ 15 (wood) C, T ≥ 0 Get an upper bound by combining the constraints: C + 2T ≤ C + 8 3T = 1 3((2C + 3T) + (C + 5T)) ≤ 1 3(12 + 15) = 9. The above is 1

3 of each. What is the best (α, β) combination?

Dual minimize: 12α + 15β (value) where: 2α + β ≥ 1 (cars) 3α + 5β ≥ 2 (trucks) α, β ≥ 0

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-20
SLIDE 20

Linear Programming Duality

Primal Dual maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy ≥ c x ≥ 0 y ≥ 0

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-21
SLIDE 21

Linear Programming Duality

Primal Dual maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy ≥ c x ≥ 0 y ≥ 0 Primal solution ≤ Dual solution

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-22
SLIDE 22

Linear Programming Duality

Primal Dual maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy ≥ c x ≥ 0 y ≥ 0 Primal solution ≤ Dual solution By construction, the dual is an upper bound on the primal.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-23
SLIDE 23

Linear Programming Duality

Primal Dual maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy ≥ c x ≥ 0 y ≥ 0 Primal solution ≤ Dual solution By construction, the dual is an upper bound on the primal.

◮ And the primal is a lower bound on the dual. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-24
SLIDE 24

Linear Programming Duality

Primal Dual maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy ≥ c x ≥ 0 y ≥ 0 Primal solution ≤ Dual solution By construction, the dual is an upper bound on the primal.

◮ And the primal is a lower bound on the dual. ◮ Any feasible primal value is ≤ any feasible dual value. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-25
SLIDE 25

Linear Programming Duality

Primal Dual maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy ≥ c x ≥ 0 y ≥ 0 Primal solution ≤ Dual solution By construction, the dual is an upper bound on the primal.

◮ And the primal is a lower bound on the dual. ◮ Any feasible primal value is ≤ any feasible dual value. ◮ This is “weak duality” Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-26
SLIDE 26

Linear Programming Duality

Primal Dual maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy ≥ c x ≥ 0 y ≥ 0 Primal solution = Dual solution By construction, the dual is an upper bound on the primal.

◮ And the primal is a lower bound on the dual. ◮ Any feasible primal value is ≤ any feasible dual value. ◮ This is “weak duality”

Remarkable fact: the two are equal.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-27
SLIDE 27

Linear Programming Duality

Primal Dual maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy ≥ c x ≥ 0 y ≥ 0 Primal solution = Dual solution By construction, the dual is an upper bound on the primal.

◮ And the primal is a lower bound on the dual. ◮ Any feasible primal value is ≤ any feasible dual value. ◮ This is “weak duality”

Remarkable fact: the two are equal.

◮ This is “strong duality.” Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-28
SLIDE 28

Linear Programming Duality

Primal Dual maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy ≥ c x ≥ 0 y ≥ 0 Primal solution = Dual solution By construction, the dual is an upper bound on the primal.

◮ And the primal is a lower bound on the dual. ◮ Any feasible primal value is ≤ any feasible dual value. ◮ This is “weak duality”

Remarkable fact: the two are equal.

◮ This is “strong duality.”

Generalization of max flow-min cut theorem.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-29
SLIDE 29

Linear Programming Duality: alternative forms

C + 2T ≤ C + 8 3T = 1 3((2C + 3T) + (C + 5T)) ≤ 1 3(12 + 15) = 9.

Primal Dual maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy ≥ c x ≥ 0 y ≥ 0

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-30
SLIDE 30

Linear Programming Duality: alternative forms

C + 2T ≤ C + 8 3T = 1 3((2C + 3T) + (C + 5T)) ≤ 1 3(12 + 15) = 9.

Primal Dual maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy ≥ c x ≥ 0 y ≥ 0

Combine equations to get upper bound.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-31
SLIDE 31

Linear Programming Duality: alternative forms

C + 2T ≤ C + 8 3T = 1 3((2C + 3T) + (C + 5T)) ≤ 1 3(12 + 15) = 9.

Primal Dual maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy ≥ c x ≥ 0 y ≥ 0

Combine equations to get upper bound.

◮ If C, T are negative, first step doesn’t hold =

⇒ need equality. “Alternative primal” “Alternative dual” maximize: c · x minimize: b · y subject to: Ax ≤ b = ⇒ subject to: ATy = c c ≥ 0

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-32
SLIDE 32

Linear Programming Duality: alternative forms

C + 2T ≤ C + 8 3T = 1 3((2C + 3T) + (C + 5T)) ≤ 1 3(12 + 15) = 9.

Primal Dual maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy ≥ c x ≥ 0 y ≥ 0

Combine equations to get upper bound.

◮ If C, T are negative, first step doesn’t hold =

⇒ need equality.

◮ If equations are equalities, can subtract them =

⇒ α, β can be < 0. “Alternative primal” “Alternative dual” maximize: c · x minimize: b · y subject to: Ax ≤ b ⇐ ⇒ subject to: ATy = c c ≥ 0

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-33
SLIDE 33

Special cases

Primal = Dual if both feasible.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-34
SLIDE 34

Special cases

Primal = Dual if both feasible. Primal unbounded = ⇒ dual infeasible

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-35
SLIDE 35

Special cases

Primal = Dual if both feasible. Primal unbounded = ⇒ dual infeasible Dual unbounded = ⇒ primal infeasible

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-36
SLIDE 36

Special cases

Primal = Dual if both feasible. Primal unbounded = ⇒ dual infeasible Dual unbounded = ⇒ primal infeasible Both infeasible is possible.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-37
SLIDE 37

Special cases

Primal = Dual if both feasible. Primal unbounded = ⇒ dual infeasible Dual unbounded = ⇒ primal infeasible Both infeasible is possible. Either one feasible and bounded = ⇒ other is too.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-38
SLIDE 38

Linear programming duality

max: C + 2T min: 12α + 15β s.t.: 2C + 3T ≤ 12 s.t.: 2α + β ≥ 1 C + 5T ≤ 15 3α + 5β ≥ 2 C, T ≥ 0 α, β ≥ 0 Primal Dual Variables = ⇒ Constraints Constraints = ⇒ Variables Objective coefficients c = ⇒ Constraint values b Constraint values = ⇒ Objective coefficients Nonnegative vars = ⇒ Inequality constraints Unconstrained vars = ⇒ Equality constraints Unbounded = ⇒ Infeasible Infeasible = ⇒ unbounded or infeasible Nonzero variables = ⇒ tight constraints Slack constraints = ⇒ zero variables

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-39
SLIDE 39

What do dual variables mean?

max: C + 2T min: 12α + 15β s.t.: 2C + 3T ≤ 12 s.t.: 2α + β ≥ 1 C + 5T ≤ 15 3α + 5β ≥ 2 C, T ≥ 0 α, β ≥ 0 Solution: (C, T) = ( 15

7 , 18 7 ), (α, β) = ( 3 7, 1 7). Both give 51 7 .

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-40
SLIDE 40

What do dual variables mean?

max: C + 2T min: 12α + 15β s.t.: 2C + 3T ≤ 12 s.t.: 2α + β ≥ 1 C + 5T ≤ 15 3α + 5β ≥ 2 C, T ≥ 0 α, β ≥ 0 Solution: (C, T) = ( 15

7 , 18 7 ), (α, β) = ( 3 7, 1 7). Both give 51 7 .

Dual variable α corresponds to the metal constraint.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-41
SLIDE 41

What do dual variables mean?

max: C + 2T min: 12α + 15β s.t.: 2C + 3T ≤ 12 s.t.: 2α + β ≥ 1 C + 5T ≤ 15 3α + 5β ≥ 2 C, T ≥ 0 α, β ≥ 0 Solution: (C, T) = ( 15

7 , 18 7 ), (α, β) = ( 3 7, 1 7). Both give 51 7 .

Dual variable α corresponds to the metal constraint. Tells you marginal value of metal to the factory:

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-42
SLIDE 42

What do dual variables mean?

max: C + 2T min: 12α + 15β s.t.: 2C + 3T ≤ 12 s.t.: 2α + β ≥ 1 C + 5T ≤ 15 3α + 5β ≥ 2 C, T ≥ 0 α, β ≥ 0 Solution: (C, T) = ( 15

7 , 18 7 ), (α, β) = ( 3 7, 1 7). Both give 51 7 .

Dual variable α corresponds to the metal constraint. Tells you marginal value of metal to the factory:

◮ With ǫ more metal, OPT will rise by αǫ. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-43
SLIDE 43

What do dual variables mean?

max: C + 2T min: 12α + 15β s.t.: 2C + 3T ≤ 12 s.t.: 2α + β ≥ 1 C + 5T ≤ 15 3α + 5β ≥ 2 C, T ≥ 0 α, β ≥ 0 Solution: (C, T) = ( 15

7 , 18 7 ), (α, β) = ( 3 7, 1 7). Both give 51 7 .

Dual variable α corresponds to the metal constraint. Tells you marginal value of metal to the factory:

◮ With ǫ more metal, OPT will rise by αǫ. ◮ Check: 13 metal gives (C, T) = ( 20

7 , 17 7 ) for 54 7 = 51 7 + 3 7.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-44
SLIDE 44

What do dual variables mean? Shadow prices!

max: C + 2T min: 12α + 15β s.t.: 2C + 3T ≤ 12 s.t.: 2α + β ≥ 1 C + 5T ≤ 15 3α + 5β ≥ 2 C, T ≥ 0 α, β ≥ 0 Solution: (C, T) = ( 15

7 , 18 7 ), (α, β) = ( 3 7, 1 7). Both give 51 7 .

Dual variable α corresponds to the metal constraint. Tells you marginal value of metal to the factory:

◮ With ǫ more metal, OPT will rise by αǫ. ◮ Check: 13 metal gives (C, T) = ( 20

7 , 17 7 ) for 54 7 = 51 7 + 3 7.

These are known as shadow prices.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-45
SLIDE 45

Class Outline

1

LP Duality

2

Reducing Problems to Linear Programs

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-46
SLIDE 46

Writing old problems as linear programs

Write network flow as a linear program Write shortest paths as a linear program Write minimum cut as a linear program

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-47
SLIDE 47

Maximum flow as a linear program

Max flow is a linear program in the variables fuv = flow from u to v: maximize:

  • u

fsu − fus (flow out) subject to:

  • v

fuv − fvu = 0 ∀u = s, t (conservation) fuv ≤ Cuv ∀u, v (capacity) fuv ≥ 0

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-48
SLIDE 48

Maximum flow as a linear program

Max flow is a linear program in the variables fuv = flow from u to v: maximize:

  • u

fsu − fus (flow out) subject to:

  • v

fuv − fvu = 0 ∀u = s, t (conservation) fuv ≤ Cuv ∀u, v (capacity) fuv ≥ 0 Computing the dual is a bit messy, but gives a min-cut formulation

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-49
SLIDE 49

Dual of the maximum flow LP

Variables correspond to constraints: xu for conservation constraints, yuv for capacity (for all u, v).

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-50
SLIDE 50

Dual of the maximum flow LP

Variables correspond to constraints: xu for conservation constraints, yuv for capacity (for all u, v). A bit easier if we make the constraints include u = s, t.

maximize: F (flow out) subject to:

  • v

fuv − fvu =    ∀u = s, t F u = s −F u = t (conservation) fuv ≤ Cuv ∀u, v (capacity) fuv ≥ 0

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-51
SLIDE 51

Dual of the maximum flow LP

Variables correspond to constraints: xu for conservation constraints, yuv for capacity (for all u, v). A bit easier if we make the constraints include u = s, t.

maximize: F (flow out) subject to:

  • v

fuv − fvu =    ∀u = s, t F u = s −F u = t (conservation) fuv ≤ Cuv ∀u, v (capacity) fuv ≥ 0

Constraints correspond to variables: one per fuv, one for F.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-52
SLIDE 52

Dual of the maximum flow LP

Variables correspond to constraints: xu for conservation constraints, yuv for capacity (for all u, v). A bit easier if we make the constraints include u = s, t.

maximize: F (flow out) subject to:

  • v

fuv − fvu =    ∀u = s, t F u = s −F u = t (conservation) fuv ≤ Cuv ∀u, v (capacity) fuv ≥ 0

Constraints correspond to variables: one per fuv, one for F.

◮ Each fuv appears in 3 constraints, F appears in two. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-53
SLIDE 53

Dual of the maximum flow LP

Variables correspond to constraints: xu for conservation constraints, yuv for capacity (for all u, v). A bit easier if we make the constraints include u = s, t.

maximize: F (flow out) subject to:

  • v

fuv − fvu =    ∀u = s, t F u = s −F u = t (conservation) fuv ≤ Cuv ∀u, v (capacity) fuv ≥ 0

Constraints correspond to variables: one per fuv, one for F.

◮ Each fuv appears in 3 constraints, F appears in two.

minimize:

  • uv

Cuvyuv subject to: xu − xv + yuv ≥ 0 ∀u, v xt − xs = 1 yuv ≥ 0

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-54
SLIDE 54

Dual of the maximum flow LP is minimum cut

minimize:

  • uv

Cuvyuv subject to: xu − xv + yuv ≥ 0 ∀u, v xt − xs = 1 yuv ≥ 0

Intuition:

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-55
SLIDE 55

Dual of the maximum flow LP is minimum cut

minimize:

  • uv

Cuvyuv (total cut) subject to: xu − xv + yuv ≥ 0 ∀u, v xt − xs = 1 yuv ≥ 0

Intuition:

◮ yuv is 1 if edge uv is cut, 0 otherwise. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-56
SLIDE 56

Dual of the maximum flow LP is minimum cut

minimize:

  • uv

Cuvyuv (total cut) subject to: xu − xv + yuv ≥ 0 ∀u, v (if u ∈ S and v / ∈ S, uv is cut) xt − xs = 1 yuv ≥ 0

Intuition:

◮ yuv is 1 if edge uv is cut, 0 otherwise. ◮ xu is 0 if u ∈ S, 1 otherwise. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-57
SLIDE 57

Dual of the maximum flow LP is minimum cut

minimize:

  • uv

Cuvyuv (total cut) subject to: xu − xv + yuv ≥ 0 ∀u, v (if u ∈ S and v / ∈ S, uv is cut) xt − xs = 1 (s ∈ S, t / ∈ S) yuv ≥ 0

Intuition:

◮ yuv is 1 if edge uv is cut, 0 otherwise. ◮ xu is 0 if u ∈ S, 1 otherwise. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-58
SLIDE 58

Dual of the maximum flow LP is minimum cut

minimize:

  • uv

Cuvyuv (total cut) subject to: xu − xv + yuv ≥ 0 ∀u, v (if u ∈ S and v / ∈ S, uv is cut) xt − xs = 1 (s ∈ S, t / ∈ S) yuv ≥ 0

Intuition:

◮ yuv is 1 if edge uv is cut, 0 otherwise. ◮ xu is 0 if u ∈ S, 1 otherwise.

More precisely:

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-59
SLIDE 59

Dual of the maximum flow LP is minimum cut

minimize:

  • uv

Cuvyuv (total cut) subject to: xu − xv + yuv ≥ 0 ∀u, v (if u ∈ S and v / ∈ S, uv is cut) xt − xs = 1 (s ∈ S, t / ∈ S) yuv ≥ 0

Intuition:

◮ yuv is 1 if edge uv is cut, 0 otherwise. ◮ xu is 0 if u ∈ S, 1 otherwise.

More precisely:

◮ If yuv, xu ∈ {0, 1}, this equivalence works. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-60
SLIDE 60

Dual of the maximum flow LP is minimum cut

minimize:

  • uv

Cuvyuv (total cut) subject to: xu − xv + yuv ≥ 0 ∀u, v (if u ∈ S and v / ∈ S, uv is cut) xt − xs = 1 (s ∈ S, t / ∈ S) yuv ≥ 0

Intuition:

◮ yuv is 1 if edge uv is cut, 0 otherwise. ◮ xu is 0 if u ∈ S, 1 otherwise.

More precisely:

◮ If yuv, xu ∈ {0, 1}, this equivalence works. ◮ Not hard to argue that opt lies in [0, 1]. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-61
SLIDE 61

Dual of the maximum flow LP is minimum cut

minimize:

  • uv

Cuvyuv (total cut) subject to: xu − xv + yuv ≥ 0 ∀u, v (if u ∈ S and v / ∈ S, uv is cut) xt − xs = 1 (s ∈ S, t / ∈ S) yuv ≥ 0

Intuition:

◮ yuv is 1 if edge uv is cut, 0 otherwise. ◮ xu is 0 if u ∈ S, 1 otherwise.

More precisely:

◮ If yuv, xu ∈ {0, 1}, this equivalence works. ◮ Not hard to argue that opt lies in [0, 1]. ◮ But how come the solution can’t be fractional? Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-62
SLIDE 62

Dual of the maximum flow LP is minimum cut

minimize:

  • uv

Cuvyuv (total cut) subject to: xu − xv + yuv ≥ 0 ∀u, v (if u ∈ S and v / ∈ S, uv is cut) xt − xs = 1 (s ∈ S, t / ∈ S) yuv ≥ 0

Intuition:

◮ yuv is 1 if edge uv is cut, 0 otherwise. ◮ xu is 0 if u ∈ S, 1 otherwise.

More precisely:

◮ If yuv, xu ∈ {0, 1}, this equivalence works. ◮ Not hard to argue that opt lies in [0, 1]. ◮ But how come the solution can’t be fractional? ◮ This LP is special (“totally unimodular”): every vertex is integral. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-63
SLIDE 63

Shortest paths as a linear program

Stretching formulation: maximize: dt (distance) subject to: dv − du ≤ w(u → v) ∀uv ∈ E (triangle inequality) ds = 0 (start point)

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-64
SLIDE 64

Shortest paths as a linear program

Stretching formulation: maximize: dt (distance) subject to: dv − du ≤ w(u → v) ∀uv ∈ E (triangle inequality) ds = 0 (start point) Dual:

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-65
SLIDE 65

Shortest paths as a linear program

Stretching formulation: maximize: dt − ds (distance) subject to: dv − du ≤ w(u → v) ∀uv ∈ E (triangle inequality) Dual:

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-66
SLIDE 66

Shortest paths as a linear program

Stretching formulation: maximize: dt − ds (distance) subject to: dv − du ≤ w(u → v) ∀uv ∈ E (triangle inequality) Dual: one variable yuv per edge, one constraint per du.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-67
SLIDE 67

Shortest paths as a linear program

Stretching formulation: maximize: dt − ds (distance) subject to: dv − du ≤ w(u → v) ∀uv ∈ E (triangle inequality) Dual: one variable yuv per edge, one constraint per du. minimize:

  • uv

w(u → v)yuv subject to:

  • v

yvu − yuv =    ∀u = s, t −1 u = s 1 u = t

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-68
SLIDE 68

Shortest paths as a linear program

Stretching formulation: maximize: dt − ds (distance) subject to: dv − du ≤ w(u → v) ∀uv ∈ E (triangle inequality) Dual: one variable yuv per edge, one constraint per du. minimize:

  • uv

w(u → v)yuv subject to:

  • v

yvu − yuv =    ∀u = s, t −1 u = s 1 u = t is min-cost flow of 1 mass from s to t; yuv = 1 if uv on path.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-69
SLIDE 69

Shortest paths as a linear program

Stretching formulation: maximize: dt − ds (distance) subject to: dv − du ≤ w(u → v) ∀uv ∈ E (triangle inequality) Dual: one variable yuv per edge, one constraint per du. minimize:

  • uv

w(u → v)yuv subject to:

  • v

yvu − yuv =    ∀u = s, t −1 u = s 1 u = t is min-cost flow of 1 mass from s to t; yuv = 1 if uv on path. Again, totally unimodular implies integral vertices.

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-70
SLIDE 70

Conclusion

Every LP has a dual:

◮ Motivated by certifying an upper bound. ◮ Mechanically easy to write down ◮ Constraints ⇐

⇒ variables

◮ Dual variables are shadow prices: the marginal value of the constraint. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-71
SLIDE 71

Conclusion

Every LP has a dual:

◮ Motivated by certifying an upper bound. ◮ Mechanically easy to write down ◮ Constraints ⇐

⇒ variables

◮ Dual variables are shadow prices: the marginal value of the constraint.

Strong duality: the dual has the same value as the primal (if either exists and is finite).

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-72
SLIDE 72

Conclusion

Every LP has a dual:

◮ Motivated by certifying an upper bound. ◮ Mechanically easy to write down ◮ Constraints ⇐

⇒ variables

◮ Dual variables are shadow prices: the marginal value of the constraint.

Strong duality: the dual has the same value as the primal (if either exists and is finite). Sometimes linear programs are structured so the answers are integer

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-73
SLIDE 73

Conclusion

Every LP has a dual:

◮ Motivated by certifying an upper bound. ◮ Mechanically easy to write down ◮ Constraints ⇐

⇒ variables

◮ Dual variables are shadow prices: the marginal value of the constraint.

Strong duality: the dual has the same value as the primal (if either exists and is finite). Sometimes linear programs are structured so the answers are integer

◮ “Integral” LPs are ones that happen to have integer vertices. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-74
SLIDE 74

Conclusion

Every LP has a dual:

◮ Motivated by certifying an upper bound. ◮ Mechanically easy to write down ◮ Constraints ⇐

⇒ variables

◮ Dual variables are shadow prices: the marginal value of the constraint.

Strong duality: the dual has the same value as the primal (if either exists and is finite). Sometimes linear programs are structured so the answers are integer

◮ “Integral” LPs are ones that happen to have integer vertices. ◮ “Integer” LPs add a new constraint that x ∈ Zn. This is NP-hard. Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-75
SLIDE 75

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19

slide-76
SLIDE 76

Eric Price (UT Austin) Linear Programming Duality CS 331, Spring / 19