Exponential time algorithms Algorithms and networks.

Slides:



Advertisements
Similar presentations
Lecture 24 Coping with NPC and Unsolvable problems. When a problem is unsolvable, that's generally very bad news: it means there is no general algorithm.
Advertisements

1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Partition Into Triangles on Bounded Degree Graphs Johan M. M. van Rooij Marcel E. van Kooten Niekerk Hans L. Bodlaender.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
Approximation Algorithms Chapter 5: k-center. Overview n Main issue: Parametric pruning –Technique for approximation algorithms n 2-approx. algorithm.
Divide and Conquer. Recall Complexity Analysis – Comparison of algorithm – Big O Simplification From source code – Recursive.
Nattee Niparnan. Recall  Complexity Analysis  Comparison of Two Algos  Big O  Simplification  From source code  Recursive.
The number of edge-disjoint transitive triples in a tournament.
Last time: terminology reminder w Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Computational problems, algorithms, runtime, hardness
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch.
Randomized Algorithms and Randomized Rounding Lecture 21: April 13 G n 2 leaves
Reduction Techniques Restriction Local Replacement Component Design Examples.
Vertex Cover, Dominating set, Clique, Independent set
Measure and Conquer Exact algorithm for Minimum Dominating Set Presenter: Fenghui Zhang CPSC 669,TAMU 09/16/2005 F.V. Fomin, F. Grandoni and D. Kratsch.
Analysis of Algorithms CS 477/677
CSE 421 Algorithms Richard Anderson Lecture 4. What does it mean for an algorithm to be efficient?
2-Layer Crossing Minimisation Johan van Rooij. Overview Problem definitions NP-Hardness proof Heuristics & Performance Practical Computation One layer:
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Chapter 11: Limitations of Algorithmic Power
Coloring Algorithms and Networks. Coloring2 Graph coloring Vertex coloring: –Function f: V  C, such that for all {v,w}  E: f(v)  f(w) Chromatic number.
Exponential time algorithms Algorithms and networks.
Steiner trees Algorithms and Networks. Steiner Trees2 Today Steiner trees: what and why? NP-completeness Approximation algorithms Preprocessing.
The Traveling Salesperson Problem
Approximation Algorithms Motivation and Definitions TSP Vertex Cover Scheduling.
10/31/02CSE Greedy Algorithms CSE Algorithms Greedy Algorithms.
Coloring 3/16/121. Flight Gates flights need gates, but times overlap. how many gates needed? 3/16/122.
1 Traveling Salesman Problem Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
The Traveling Salesperson Problem Algorithms and Networks.
Fixed Parameter Complexity Algorithms and Networks.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Advanced Algorithm Design and Analysis (Lecture 13) SW5 fall 2004 Simonas Šaltenis E1-215b
Nattee Niparnan. Recall  Complexity Analysis  Comparison of Two Algos  Big O  Simplification  From source code  Recursive.
1 Exponential-time algorithms Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
Analysis of Algorithms
Edge-disjoint induced subgraphs with given minimum degree Raphael Yuster 2012.
The Selection Problem. 2 Median and Order Statistics In this section, we will study algorithms for finding the i th smallest element in a set of n elements.
1 Steiner Tree Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
Polynomial-time reductions We have seen several reductions:
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
Graph Colouring L09: Oct 10. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
The Dominating Set and its Parametric Dual  the Dominated Set  Lan Lin prepared for theory group meeting on June 11, 2003.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
1 Travelling Salesman Problem Algorithms and Networks 2015/2016 Hans L. Bodlaender Johan M. M. van Rooij.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
Introduction to Graph Theory
Chapter 13 Backtracking Introduction The 3-coloring problem
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
Algorithms for hard problems Introduction Juris Viksna, 2015.
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
1 Distributed Vertex Coloring. 2 Vertex Coloring: each vertex is assigned a color.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
Honors Track: Competitive Programming & Problem Solving Seminar Topics Kevin Verbeek.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
Theory of Computational Complexity Probability and Computing Chapter Hikaru Inada Iwama and Ito lab M1.
Fast Hamiltonicity Checking via Bases of Perfect Matchings
Haim Kaplan and Uri Zwick
Vertex Cover, Dominating set, Clique, Independent set
Richard Anderson Lecture 28 Coping with NP-Completeness
Graphs and Algorithms (2MMD30)
The Traveling Salesperson Problem
The Theory of NP-Completeness
The Selection Problem.
Presentation transcript:

Exponential time algorithms Algorithms and networks

Exponential time algorithms2 Today Exponential time algorithms: introduction Techniques 3-coloring 4-coloring Coloring Maximum Independent Set TSP

Exponential time algorithms3 What to do if a problem is NP-complete? Solve on special cases Heuristics and approximations Algorithms that are fast on average Good exponential time algorithms …

Exponential time algorithms4

5 Good exponential time algorithms Algorithms with a running time of c n.p(n) –c a constant –p() a polynomial –Notation: O*(c n ) Smaller c helps a lot!

Exponential time algorithms6 Important techniques Dynamic programming Branch and reduce –Measure and conquer (and design) Divide and conquer Clever enumeration Local search Inclusion-exclusion

A&N: TSP7 Held-Karp algorithm for TSP O(n 2 2 n ) algorithm for TSP Uses Dynamic programming Take some starting vertex s For set of vertices R (s  R), vertex w  R, let –B(R,w) = minimum length of a path, that Starts in s Visits all vertices in R (and no other vertices) Ends in w

A&N: TSP8 TSP: Recursive formulation B({s},s) = 0 If |X| > 1, then –B(X,w) = min v  X – {w} B(X-{w}, v}) + w(v,w) If we have all B(V,v) then we can solve TSP. Gives requested algorithm using DP- techniques.

Notation O*(f(n)): hides polynomial factors, i.e., O*(f(n)) = O(p(n)*f(n)) for some polynomial p Exponential time algorithms9

ETH Exponential Time Hypothesis (ETH): Satisability of n-variable 3-CNF formulas (3-SAT) cannot be decided in subexponential worst case time, e.g., it cannot be done in O*(2 o(n) ) time. Exponential time algorithms10

Exponential time algorithms11 Running example Graph coloring –Several applications: scheduling, frequency assignment (usually more complex variants) –Different algorithms for small fixed number of colors (3-coloring, 4-coloring, …) and arbitrary number of colors –2-coloring is easy in O(n+m) time

Exponential time algorithms12 3-coloring O*(3 n ) is trivial Can we do this faster?

Exponential time algorithms13 3-coloring in O*(2 n ) time G is 3-colorable, if and only if there is a set of vertices S with –S is independent –G[V-S] is 2-colorable Algorithm: enumerate all sets, and test these properties (2 n tests of O(n+m) time each)

Exponential time algorithms14 3-coloring Lawler, 1976: –We may assume S is a maximal independent set –Enumerating all maximal independent sets in O*(3 n/3 ) = O*( n ) time There are O*(3 n/3 ) maximal independent sets (will be proved later.) –Thus O*( n ) time algorithm for 3-coloring Schiermeyer, 1994; O*(1.398 n ) time Beigel, Eppstein, 1995: O*( n ) time

Exponential time algorithms15 4-coloring in O*(2 n ) time Lawler, 1976 G is 4-colorable, if and only if we can partition the vertices in two sets X and Y such that G[X] and G[Y] are both 2- colorable Enumerate all partitions –For each, check both halves in O(n+m) time

Exponential time algorithms16 4-coloring Using 3-coloring –Enumerate all maximal independent sets S –For each, check 3-colorability of G[V-S] – n * n = n Better: there is always a color with at least n/4 vertices –Enumerate all m.i.s. S with at least n/4 vertices –For each, check 3-colorability of G[V-S] – n * n/4 = n Byskov, 2004: O*( n ) time

Exponential time algorithms17 Coloring Next: coloring when the number of colors is some arbitrary number (not necessarily small) First: a dynamic program

Exponential time algorithms18 Coloring with dynamic programming Lawler, 1976: using DP for solving graph coloring.  (G) = min S is m.i.s. in G 1+X(G[V-S]) Tabulate chromatic number of G[W] over all subsets W –In increasing size –Using formula above –2 n * n = n

Exponential time algorithms19 Coloring Lawler 1976: n (improved analysis) Eppstein, 2003: n Byskov, 2004: n –All using O*(2 n ) memory –Improvements on DP method Björklund, Husfeld, 2005: n 2006: Inclusion/Exclusion

Exponential time algorithms20 Inclusion-exclusion Björklund and Husfeld, 2006, and independently Koivisto, 2006 O*(2 n ) time algorithm for coloring Expression: number of ways to cover all vertices with k independent sets

Exponential time algorithms21 First formula Let c k (G) be the number of ways we can cover all vertices in G with k independent sets, where the stable sets may be overlapping, or even the same –Sequences (V 1,…,V k ) with the union of the V i ’s = V, and each V i independent Lemma: G is k-colorable, if and only if c k (G) > 0

Exponential time algorithms22 Counting independent sets Let s(X) be the number of independent sets that do not intersect X, i.e., the number of independent sets in G(V-X). We can compute all values s(X) in O*(2 n ) time. –s(X) = s(X  {v}) + s(X  {v}  N(v)) for v  X Count IS’s with v and IS’s without v –Now use DP and store all values –Polynomial space slower algorithm also possible, by computing s(X) each time again

Exponential time algorithms23 Expressing c k in s s(X) k counts the number of ways to pick k independent sets from V-X If a pick covers all vertices, it is counted in s(  ) If a pick does not cover all vertices, suppose it covers all vertices in V-Y, then it is counted in all X that are a subset in Y –With a +1 if X is even, and a -1 if X is odd –Y has equally many even as odd subsets: total contribution is 0

Exponential time algorithms24 Explanations Consider the number of k-tuples (W(1), …, W(k)) with each W(i) an independent set in G If we count all these k-tuples, we count all colourings, but also some wrong k-tuples: those which avoid some vertices So, subtract from this number all k-tuples of independent sets that avoid a vertex v, for all v However, we now subtract too many, as k-tuples that avoid two or more vertices are subtracted twice So, add for all pairs {v,w}, the number of k-tuples that avoid both v and w But, then what happens to k-tuples that avoid 3 vertices??? Continue, and note that the parity tells if we add or subtract… This gives the formula of the previous slide

Exponential time algorithms25 The algorithm Tabulate all s(X) Compute values c k (G) with the formula Take the smallest k for which c k (G) > 0 O*(2 n )

Exponential time algorithms26 Maximum independent set Branch and reduce algorithm (folklore) Uses: –Branching rule –Reduction rules

Exponential time algorithms27 Two simple reduction rules Reduction rule 1: if v has degree 0, put v in the solution set and recurse on G-v Reduction rule 2: if v has degree 1, then put v in the solution set. Suppose v has neighbor w. Recurse on G – {v,w}. –If v has degree 1, then there is always a maximum independent set containing v

Exponential time algorithms28 Idea for branching rule Consider some vertex v with neighbors w 1, w 2, …, w d. Suppose S is a maximum independent set. One of the following cases must hold: 1.v  S. Then w 1, w 2, …, w d are not in S. 2.For some i, 1  i  d, v, w 1, w 2, …, w i-1 are not in S and w i  S. Also, no neighbor of w i is in S.

Exponential time algorithms29 Branching rule Take a vertex v of minimum degree. Suppose v has neighbors w 1, w 2, …, w d. Set best to 1 + what we get when we recurse on G – {v, w 1, w 2, …, w d }. (Here we put v in the solution set.) For i = 1 to d do –Recurse on G – {v, w 1, w 2, …, w i } – N(w i ). Say, it gives a solution of value x. (N(w i ) is set of neighbors of w i. Here we put w i in S.) –Set best = max (best, x+1). Return best Using some bookkeeping gives the corresponding set S

Exponential time algorithms30 Analysis Say T(n) is the number of leaves in the search tree when we have a graph with n vertices. If v has degree d, then we have T(n)  (d+1) T(n- d-1). –Note that each w i has degree d as v had minimum degree, so we always recurse on a graph with at least d- 1 fewer vertices. d > 1 (because of reduction rules). With induction: T(n)  3 n/3. Total time is O*( 3 n/3 ) = O*( n ).

Exponential time algorithms31 Number of maximal independent sets Suppose M(n) is maximum number of m.i.s.’s in graph with n vertices Choose v of minimum degree d. If v has degree 0: number of m.i.s.’s is at most 1* M(n) If v has degree 1: number of m.i.s.’s is at most 2* M(n-2) If v has degree d>1: number of m.i.s’s is at most (d+1)* M(n – d – 1) M(n)  3 n/3 with induction

Exponential time algorithms32 Some remarks Can be done without reduction step Bound on number of m.i.s.’s sharp: consider a collection of triangles

Exponential time algorithms33 A faster algorithm Reduction rule 3: if all vertices of G have degree at most two, solve problem directly. (Easy in O(n+m) time.) New branching rule: –Take vertex v of maximum degree –Take best of two recursive steps: v not in solution: recurse of G – {v} v in solution: recurse on G – {v} – N(v); add 1.

Exponential time algorithms34 Analysis Time on graph with n vertices T(n). We have T(n)  T(n – 1) + T(n – 4) + O(n+m) –As v has degree at least 3, we loose in the second case at least 4 vertices Induction: T(n) = O*( n ) –Solve (with e.g., Maple or Mathematica, SAGEmath ( or Solver from Excel) x 4 = x 3 + 1

Exponential time algorithms35 Maximum Independent Set Final remarks More detailed analysis gives better bounds Current best known: O( n ) (Robson, 2001) –Extensive, computer generated case analysis! –Includes memorization (DP) 2005: Fomin, Grandoni, Kratsch: the measure and conquer technique for better analysis of branch and reduce algorithms –Much simpler and only slightly slower compared to Robson

Exponential time algorithms36

Exponential time algorithms37 Final remarks Techniques for designing exponential time algorithms Other techniques, e.g., local search Combination of techniques Several interesting open problems