cse 421
play

CSE 421 Project Selection / Reductions Shayan Oveis Gharan 1 - PowerPoint PPT Presentation

CSE 421 Project Selection / Reductions Shayan Oveis Gharan 1 Image Segmentation Foreground / background segmentation Label each pixel as foreground/background. V = set of pixels, E = pairs of neighboring pixels. # 0 is


  1. CSE 421 Project Selection / Reductions Shayan Oveis Gharan 1

  2. Image Segmentation

  3. Foreground / background segmentation Label each pixel as foreground/background. β€’ V = set of pixels, E = pairs of neighboring pixels. β€’ 𝑏 # β‰₯ 0 is likelihood pixel i in foreground. β€’ 𝑐 # β‰₯ 0 is likelihood pixel i in background. β€’ π‘ž #,) β‰₯ 0 is separation penalty for labeling one of i and j as foreground, and the other as background. Goals. Accuracy: if a i > b i in isolation, prefer to label i in foreground. Smoothness: if many neighbors of i are labeled foreground, we should be inclined to label i as foreground. Find partition (A, B) that maximizes: * 𝑏 # + * 𝑐 ) βˆ’ * π‘ž #,) Foreground #∈, )∈. #,) ∈0 #∈,,)∈. Background 3

  4. Image Seg: Min Cut Formulation Difficulties: β€’ Maximization (as opposed to minimization) β€’ No source or sink β€’ Undirected graph Step 1: Turn into Minimization * 𝑏 # + * 𝑐 ) βˆ’ * π‘ž #,) Maximizing #∈, )∈. #,) ∈0 #∈,,)∈. Equivalent to minimizing + * 𝑏 # + * 𝑐 βˆ’ * 𝑏 # βˆ’ * 𝑐 ) + * π‘ž #,) ) #∈1 )∈1 #∈, )∈. #,) ∈0 #∈,,)∈. Equivalent to minimizing + * 𝑏 ) + * 𝑐 # + * π‘ž #,) )∈. #∈, #,) ∈0 4 #∈,,)∈.

  5. Min cut Formulation (cont’d) G' = (V', E'). Add s to correspond to foreground; p ij Add t to correspond to background Use two anti-parallel edges p ij instead of undirected edge. p ij p ij a j i j s t b i 𝐻′ 5

  6. Min cut Formulation (cont’d) Consider min cut (A, B) in G’. (A = foreground.) π‘‘π‘π‘ž 𝐡, 𝐢 = * 𝑏 ) + * 𝑐 # + * π‘ž #,) )∈. #∈, #,) ∈0 #∈,,)∈. Precisely the quantity we want to minimize. p ij a j i j s t b i 𝐡 𝐻′ 6

  7. Project Selection

  8. Project Selection can be positive or negative Projects with prerequisites. β–  Set P of possible projects. Project v has associated revenue p v . – some projects generate money: create interactive e-commerce interface, redesign web page – others cost money: upgrade computers, get site license β–  Set of prerequisites E. If (v, w) Î E, can't do project v and unless also do project w. β–  A subset of projects A Í P is feasible if the prerequisite of every project in A also belongs to A. Project selection. Choose a feasible subset of projects to maximize revenue. 8

  9. Project Selection: Prerequisite Graph Prerequisite graph. β–  Include an edge from v to w if can't do v without also doing w. β–  {v, w, x} is feasible subset of projects. β–  {v, x} is infeasible subset of projects. w w v x v x feasible infeasible 9

  10. Project Selection: Min Cut Formulation Min cut formulation. β–  Assign capacity Β₯ to all prerequisite edge. β–  Add edge (s, v) with capacity -p v if p v > 0. β–  Add edge (v, t) with capacity -p v if p v < 0. β–  For notational convenience, define p s = p t = 0. u Β₯ w Β₯ Β₯ -p w p u Β₯ -p z p y y z s t p v Β₯ -p x Β₯ v x Β₯ 10

  11. Project Selection: Min Cut Formulation Claim. (A, B) is min cut iff A - { s } is optimal set of projects. β–  Infinite capacity edges ensure A - { s } is feasible. β–  Max revenue because: cap ( A , B ) p v ( βˆ’ p v ) = + βˆ‘ βˆ‘ v ∈ B : p v > 0 v ∈ A : p v < 0 p v p v = βˆ’ βˆ‘ βˆ‘ v : p v > 0 v ∈ A ο€± ο€² ο€³ constant w u A p u -p w s y z t p y Β₯ p v -p x Β₯ v x Β₯ 11

  12. Reductions & NP-Completeness

  13. Computational Complexity Goal: Classify problems according to the amount of computational resources used by the best algorithms that solve them Here we focus on time complexity Recall: worst-case running time of an algorithm β€’ max # steps algorithm takes on any input of size n 13

  14. Computational Complexity and Reduction In most cases, we cannot characterize the true hardness of a computational problem So? We only reduce the number of problems Want to be able to make statements of the form β€’ β€œIf we could solve problem B in polynomial time then we can solve problem A in polynomial time” β€’ β€œProblem B is at least as hard as problem A” 14

  15. Polynomial Time Reduction Def A Β£ P B: if there is an algorithm for problem A using a β€˜black box’ (subroutine) that solve problem B s.t., β€’ Algorithm uses only a polynomial number of steps β€’ Makes only a polynomial number of calls to a subroutine for B So, B is Polynomial A is Polynomial time solvable time solvable Conversely, No efficient No efficient Algorithm for B Algorithm for A In words, B is as hard as A (it can be even harder) 15

  16. : Reductions ≀ 9 In this lecture we see a restricted form of polynomial-time reduction often called Karp or many-to-one reduction : 𝐢: if and only if there is an algorithm for A given a 𝐡 ≀ 9 black box solving B that on input x β€’ Runs for polynomial time computing an input f(x) of B β€’ Makes one call to the black box for B for input f(x) β€’ Returns the answer that the black box gave We say that the function f(.) is the reduction 16

  17. Example 1: Indep Set ≀ 9 Clique Indep Set: Given G=(V,E) and an integer k, is there 𝑇 βŠ† π‘Š s.t. 𝑇 β‰₯ 𝑙 an no two vertices in S are joined by an edge? Clique: Given a graph G=(V,E) and an integer k, is there 𝑇 βŠ† π‘Š , |U| Β³ k s.t., every pair of vertices in S is joined by an edge? Claim: Indep Set ≀ 9 Clique Pf: Given 𝐻 = (π‘Š, 𝐹) and instance of indep Set. Construct a new graph 𝐻 C = (π‘Š, 𝐹 C ) where 𝑣, 𝑀 ∈ 𝐹′ if and only if 𝑣, 𝑀 βˆ‰ 𝐹. 1 1 2 5 2 5 3 4 3 4 S is an independ S is an Clique set in G in G’ 17

  18. Example 2: Vertex Cover ≀ 9 Indep Set Vertex Cover: Given a graph G=(V,E) and an integer k, is there a vertex cover of size at most k? Claim: For any graph 𝐻 = π‘Š, 𝐹 , S is an independent set iff π‘Š βˆ’ 𝑇 is a vertex cover Pf: => Let S be a independent set of G Then, 𝑇 has at most one endpoint of every edge of G So, π‘Š βˆ’ 𝑇 has at least one endpoint of every edge of G So, π‘Š βˆ’ 𝑇 is a vertex cover. <= Suppose π‘Š βˆ’ 𝑇 is a vertex cover Then, there is no edge between vertices of S (otherwise, π‘Š βˆ’ 𝑇 is not a vertex cover) So, 𝑇 is an independent set. 18

  19. Example 3: Vertex Cover ≀ 9 Set Cover Set Cover: Given a set U, collection of subsets 𝑇 : , … , 𝑇 I of U and an integer k, is there a collection of k sets that contain all elements of U ? Claim: Vertex Cover ≀ 9 Set Cover Pf: Given ( 𝐻 = π‘Š, 𝐹 , 𝑙) of vertex cover we construct a set cover input 𝑔(𝐻, 𝑙) β€’ 𝑉 = 𝐹 For each 𝑀 ∈ π‘Š we create a set 𝑇 M of all edges connected to 𝑀 β€’ This clearly is a polynomial-time reduction So, we need to prove it gives the right answer 19

  20. Example 3: Vertex Cover ≀ 9 Set Cover Claim: Vertex Cover ≀ 9 Set Cover Pf: Given ( 𝐻 = π‘Š, 𝐹 , 𝑙) of vertex cover we construct a set cover input 𝑔(𝐻, 𝑙) β€’ 𝑉 = 𝐹 For each 𝑀 ∈ π‘Š we create a set 𝑇 M of all edges connected to 𝑀 β€’ Vertex-Cover (G,k) is yes => Set-Cover f(G,k) is yes If a set 𝑋 βŠ† π‘Š covers all edges,, just choose 𝑇 M for all 𝑀 ∈ 𝑋 , it covers all 𝑉 . Set-Cover f(G,k) is yes => Vertex-Cover (G,k) is yes If (𝑇 M O , … , 𝑇 M P ) covers all 𝑉 , the set {𝑀 : , … , 𝑀 R } covers all edges of G. 20

  21. Decision Problems A decision problem is a computational problem where the answer is just yes/no Here, we study computational complexity of decision Problems. Why? β€’ much simpler to deal with β€’ Decision version is not harder than Search version, so it is easier to lower bound Decision version β€’ Less important, usually, you can use decider multiple times to find an answer . 21

Recommend


More recommend