Linear Programming Duality, Reductions, and Bipartite Matching

Slides:



Advertisements
Similar presentations
1 LP Duality Lecture 13: Feb Min-Max Theorems In bipartite graph, Maximum matching = Minimum Vertex Cover In every graph, Maximum Flow = Minimum.
Advertisements

Introduction to Approximation Algorithms Lecture 12: Mar 1.
Computational problems, algorithms, runtime, hardness
Instructor Neelima Gupta Table of Contents Lp –rounding Dual Fitting LP-Duality.
Duality Lecture 10: Feb 9. Min-Max theorems In bipartite graph, Maximum matching = Minimum Vertex Cover In every graph, Maximum Flow = Minimum Cut Both.
Approximation Algorithms
The Theory of NP-Completeness
Linear Programming – Max Flow – Min Cut Orgad Keller.
1 Introduction to Approximation Algorithms Lecture 15: Mar 5.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
MCS312: NP-completeness and Approximation Algorithms
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
NP-Complete problems.
Approximation Algorithms Department of Mathematics and Computer Science Drexel University.
CPS 173 Linear programming, integer linear programming, mixed integer linear programming
CSE 589 Part V One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important. Bertrand Russell.
Lecture.6. Table of Contents Lp –rounding Dual Fitting LP-Duality.
CPS Computational problems, algorithms, runtime, hardness (a ridiculously brief introduction to theoretical computer science) Vincent Conitzer.
NP Completeness Piyush Kumar. Today Reductions Proving Lower Bounds revisited Decision and Optimization Problems SAT and 3-SAT P Vs NP Dealing with NP-Complete.
CSC 413/513: Intro to Algorithms
Introduction to NP Instructor: Neelima Gupta 1.
Approximation Algorithms based on linear programming.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
Timetable Problem solving using Graph Coloring
Introduction to computation
The Theory of NP-Completeness
The NP class. NP-completeness
NP-Complete Problems.
More NP-Complete and NP-hard Problems
P & NP.
Chapter 10 NP-Complete Problems.
Introduction to Approximation Algorithms
Mathematical Foundations of AI
Lap Chi Lau we will only use slides 4 to 19
Computational problems, algorithms, runtime, hardness
EMIS 8373: Integer Programming
Richard Anderson Lecture 26 NP-Completeness
Optimization problems such as
Topics in Algorithms Lap Chi Lau.
Richard Anderson Lecture 26 NP-Completeness
integer linear programming, mixed integer linear programming
Lecture 22 Complexity and Reductions
NP-Completeness Yin Tat Lee
3.3 Applications of Maximum Flow and Minimum Cut
ICS 353: Design and Analysis of Algorithms
Parameterised Complexity
Instructor: Shengyu Zhang
Coping With NP-Completeness
Coverage Approximation Algorithms
1. for (i=0; i < n; i+=2) if (A[i] > A[i+1]) swap(A[i], A[i+1])
Problem Solving 4.
NP-Complete Problems.
integer linear programming, mixed integer linear programming
CPS 173 Computational problems, algorithms, runtime, hardness
Dilworth theorem and Duality in graph
NP-Completeness Yin Tat Lee
CSE 6408 Advanced Algorithms.
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
The Theory of NP-Completeness
Trevor Brown DC 2338, Office hour M3-4pm
More NP-Complete Problems
Coping With NP-Completeness
Dominating Set By Eric Wengert.
Lecture 22 Complexity and Reductions
Presentation transcript:

Linear Programming Duality, Reductions, and Bipartite Matching CPS 223 Linear Programming Duality, Reductions, and Bipartite Matching Yu Cheng

Linear Programming Duality

Example linear program We make reproductions of two paintings maximize 3x + 2y subject to 4x + 2y ≤ 16 x + 2y ≤ 8 x + y ≤ 5 x ≥ 0 y ≥ 0 Painting 1 sells for $30, painting 2 sells for $20 Painting 1 requires 4 units of blue, 1 green, 1 red Painting 2 requires 2 blue, 2 green, 1 red We have 16 units blue, 8 green, 5 red

Solving the linear program graphically maximize 3x + 2y subject to 4x + 2y ≤ 16 x + 2y ≤ 8 x + y ≤ 5 x ≥ 0 y ≥ 0 8 6 4 optimal solution: x=3, y=2 2 2 4 6 8

Proving optimality maximize 3x + 2y Recall: optimal solution: x=3, y=2 subject to 4x + 2y ≤ 16 x + 2y ≤ 8 x + y ≤ 5 x ≥ 0 y ≥ 0 Recall: optimal solution: x=3, y=2 Solution value = 9+4 = 13 How do we prove this is optimal (without the picture)?

Proving optimality… We can rewrite the blue constraint as 2x + y ≤ 8 If we add the red constraint x + y ≤ 5 we get 3x + 2y ≤ 13 Matching upper bound! (Really, we added .5 times the blue constraint to 1 times the red constraint) maximize 3x + 2y subject to 4x + 2y ≤ 16 x + 2y ≤ 8 x + y ≤ 5 x ≥ 0 y ≥ 0

Linear combinations of constraints maximize 3x + 2y subject to 4x + 2y ≤ 16 x + 2y ≤ 8 x + y ≤ 5 x ≥ 0 y ≥ 0 b(4x + 2y ≤ 16) + g(x + 2y ≤ 8) + r(x + y ≤ 5) = (4b + g + r)x + (2b + 2g + r)y ≤ 16b + 8g + 5r 4b + g + r must be at least 3 2b + 2g + r must be at least 2 Given this, minimize 16b + 8g + 5r

Using LP for getting the best upper bound on an LP maximize 3x + 2y subject to 4x + 2y ≤ 16 x + 2y ≤ 8 x + y ≤ 5 x ≥ 0 y ≥ 0 minimize 16b + 8g + 5r subject to 4b + g + r ≥ 3 2b + 2g + r ≥ 2 b ≥ 0 g ≥ 0 r ≥ 0 the dual of the original program Duality theorem: any linear program has the same optimal value as its dual!

Another View 4b + g + r ≥ 3 2b + 2g + r ≥ 2 b ≥ 0 g ≥ 0 r ≥ 0 Painting 1: 4 blue, 1 green, 1 red, sells for $30 Painting 2: 2 blue, 2 green, 1 red, sells for $20 We have 16 units blue, 8 green, 5 red Suppose Vince wants to buy paints from us. Pay $b for a unit of blue, $g for green, $r for red. We can choose to sell the paints, or produce paintings and sell the paintings, or both. He really likes b ≥ 0 g ≥ 0 r ≥ 0 4b + g + r ≥ 3 2b + 2g + r ≥ 2

Another View 4b + g + r ≥ 3 2b + 2g + r ≥ 2 b ≥ 0 g ≥ 0 r ≥ 0 Vince pays $(16b + 8g + 5r) in total. We have 16 units blue, 8 green, 5 red Suppose Vince wants to buy paints from us. Pay $b for a unit of blue, $g for green, $r for red. We can choose to sell the paints, or produce paintings and sell the paintings, or both. He really likes b ≥ 0 g ≥ 0 r ≥ 0 4b + g + r ≥ 3 2b + 2g + r ≥ 2

Using LP for getting the best upper bound on an LP maximize 3x + 2y subject to 4x + 2y ≤ 16 x + 2y ≤ 8 x + y ≤ 5 x ≥ 0 y ≥ 0 minimize 16b + 8g + 5r subject to 4b + g + r ≥ 3 2b + 2g + r ≥ 2 b ≥ 0 g ≥ 0 r ≥ 0 primal dual

Duality Weak duality: Optimal value of primal ≥ Optimal value of dual (when primal LP is max and dual LP is min) We can make $13 if we produce paintings Vince should pay at least as much Strong Duality Optimal value of primal = Optimal value of dual Vince is a good negotiator He really likes

Using LP for getting the best upper bound on an LP maximize 3x + 2y subject to 4x + 2y ≤ 16 x + 2y ≤ 8 x + y ≤ 5 x ≥ 0 y ≥ 0 minimize 16b + 8g + 5r subject to 4b + g + r ≥ 3 2b + 2g + r ≥ 2 b ≥ 0 g ≥ 0 r ≥ 0 primal dual

Reductions

NP (“nondeterministic polynomial time”) Recall: decision problems require a yes or no answer NP: the class of all decision problems such that if the answer is yes, there is a simple proof of that E.g., “does there exist a set cover of size k?” If yes, then just show which subsets to choose! Technically: The proof must have polynomial length The correctness of the proof must be verifiable in polynomial time

“Easy to verify” problems: NP All decision problems such that we can verify the correctness of a solution in polynomial time. input Prover Verifier: OK, that is indeed a solution.

NP-hardness A problem is NP-hard if it is at least as hard as all problems in NP So, trying to find a polynomial-time algorithm for it is like trying to prove P=NP Set cover is NP-hard Typical way to prove problem Q is NP-hard: Take a known NP-hard problem Q’ Reduce it to your problem Q (in polynomial time) E.g., (M)IP is NP-hard, because we have already reduced set cover to it (M)IP is more general than set cover, so it can’t be easier

Reductions Sometimes you can reformulate problem A in terms of problem B (i.e., reduce A to B) E.g., we have seen how to formulate several problems as linear programs or integer programs In this case problem A is at most as hard as problem B Since LP is in P, all problems that we can formulate using LP are in P Caveat: only true if the linear program itself can be created in polynomial time!

Independent Set In the below graph, does there exist a subset of vertices, of size 4, such that there is no edge between members of the subset?

Independent Set In the below graph, does there exist a subset of vertices, of size 4, such that there is no edge between members of the subset? General problem (decision variant): given a graph and a number k, are there k vertices with no edges between them? NP-complete

Set Cover (a computational problem) We are given: A finite set S = {1, …, n} A collection of subsets of S: S1, S2, …, Sm We are asked: Find a subset T of {1, …, m} such that Uj in TSj= S Minimize |T| Decision variant of the problem: we are additionally given a target size k, and asked whether a T of size at most k will suffice One instance of the set cover problem: S = {1, …, 6}, S1 = {1,2,4}, S2 = {3,4,5}, S3 = {1,3,6}, S4 = {2,3,5}, S5 = {4,5,6}, S6 = {1,3}

Visualizing Set Cover S = {1, …, 6}, S1 = {1,2,4}, S2 = {3,4,5}, S3 = {1,3,6}, S4 = {2,3,5}, S5 = {4,5,6}, S6 = {1,3} 2 3 4 1 6 5

Reducing independent set to set cover 2 1 3 , k=4 5 4 6 9 8 7 In set cover instance (decision variant), let S = {1,2,3,4,5,6,7,8,9} (set of edges), for each vertex let there be a subset with the vertex’s adjacent edges: {1,4}, {1,2,5}, {2,3}, {4,6,7}, {3,6,8,9}, {9}, {5,7,8} target size = #vertices - k = 7 - 4 = 3 Claim: answer to both instances is the same (why??)

Reducing independent set to set cover 2 1 3 , k=4 5 4 6 9 8 7 In set cover instance (decision variant), let S = {1,2,3,4,5,6,7,8,9} (set of edges), for each vertex let there be a subset with the vertex’s adjacent edges: {1,4}, {1,2,5}, {2,3}, {4,6,7}, {3,6,8,9}, {9}, {5,7,8} target size = #vertices - k = 7 - 4 = 3 Claim: answer to both instances is the same (why??) So which of the two problems is harder?

Reductions: To show problem Q is easy: Q reduce Problem known to be easy (e.g., LP) Q To show problem Q is (NP-)hard: Problem known to be (NP-)hard (e.g., set cover, (M)IP) reduce Q

Polynomial time reductions   A reduction B

Weighted Bipartite Matching

Weighted bipartite matching 3 4 5 2 1 6 1 3 7 Match each node on the left with one node on the right (can only use each node once) Minimize total cost (weights on the chosen edges)

Weighted bipartite matching… minimize cij xij subject to for every i, Σj xij = 1 for every j, Σi xij = 1 for every i, j, xij ≥ 0 Theorem [Birkhoff-von Neumann]: this linear program always has an optimal solution consisting of just integers and typical LP solving algorithms will return such a solution So weighted bipartite matching is in P

Weighted bipartite matching 3 4 5 2 1 6 1 3 7 Match each node on the left with one node on the right (can only use each node once) Minimize total cost (weights on the chosen edges)