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 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
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 #β,,)β.
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
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
Project Selection
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
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
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
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
Reductions & NP-Completeness
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
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
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
: 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
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
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
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
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
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