Algorithms for hard problems Introduction Juris Viksna, 2015.

Slides:



Advertisements
Similar presentations
Approximation Algorithms
Advertisements

1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell ( )
The Theory of NP-Completeness
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
Combinatorial Algorithms
CS774. Markov Random Field : Theory and Application Lecture 17 Kyomin Jung KAIST Nov
Lecture 21 Approximation Algorithms Introduction.
PCPs and Inapproximability Introduction. My T. Thai 2 Why Approximation Algorithms  Problems that we cannot find an optimal solution.
Complexity 16-1 Complexity Andrei Bulatov Non-Approximability.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Approximation Algorithms
1 Optimization problems such as MAXSAT, MIN NODE COVER, MAX INDEPENDENT SET, MAX CLIQUE, MIN SET COVER, TSP, KNAPSACK, BINPACKING do not have a polynomial.
1 Approximation Algorithms CSC401 – Analysis of Algorithms Lecture Notes 18 Approximation Algorithms Objectives: Typical NP-complete problems Approximation.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
1 Vertex Cover Problem Given a graph G=(V, E), find V' ⊆ V such that for each edge (u, v) ∈ E at least one of u and v belongs to V’ and |V’| is minimized.
The Theory of NP-Completeness
Chapter 11: Limitations of Algorithmic Power
Ch 13 – Backtracking + Branch-and-Bound
Vertex cover problem S  V such that for every {u,v}  E u  S or v  S (or both)
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
An introduction to Approximation Algorithms Presented By Iman Sadeghi.
Approximation Algorithms Motivation and Definitions TSP Vertex Cover Scheduling.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Programming & Data Structures
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Fixed Parameter Complexity Algorithms and Networks.
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
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.
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.
Chapter 15 Approximation Algorithm Introduction Basic Definition Difference Bounds Relative Performance Bounds Polynomial approximation Schemes Fully Polynomial.
Approximation Algorithms
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.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
Princeton University COS 423 Theory of Algorithms Spring 2001 Kevin Wayne Approximation Algorithms These lecture slides are adapted from CLRS.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Unit 9: Coping with NP-Completeness
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
NP-Complete problems.
Approximation Algorithms for TSP Tsvi Kopelowitz 1.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
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.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
Algorithms for hard problems Parameterized complexity – definitions, sample algorithms 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
Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Introduction to NP Instructor: Neelima Gupta 1.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
EMIS 8373: Integer Programming Combinatorial Optimization Problems updated 27 January 2005.
Hard Problems Some problems are hard to solve.  No polynomial time algorithm is known.  E.g., NP-hard problems such as machine scheduling, bin packing,
TU/e Algorithms (2IL15) – Lecture 11 1 Approximation Algorithms.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
The Theory of NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
Lecture 2-2 NP Class.
An introduction to Approximation Algorithms Presented By Iman Sadeghi
Algorithms for hard problems
Computability and Complexity
Analysis and design of algorithm
ICS 353: Design and Analysis of Algorithms
Approximation Algorithms
Chapter 11 Limitations of Algorithm Power
The Theory of NP-Completeness
Lecture 24 Vertex Cover and Hamiltonian Cycle
Presentation transcript:

Algorithms for hard problems Introduction Juris Viksna, 2015

Classical complexity - P and NP P = NPP  NP P = NP NP NP complete P

Vertex cover - how to solve this? VERTEX COVER Instance:A graph G=(V,E) and a positive integer k Question:Is there a subset S  V, such that |S|=k and for all {x,y}  E either x  S or y  S? For what values of n =|V | and k we can solve this problem in practice? [Adapted from R.Downey and M.Fellows]

Vertex cover - how to solve this? A "universal" approach: - problem is in NP, so we can try to search through all possible witnesses that vertex cover of the given size exists - the running time is n k, thus for n=100 we could probably deal with k<7 and for n=1000 with k<5... Can we do better?

Approaches to NP-hard problems Branch-and-bound algorithms Heuristic methods Approximation algorithms Probabilistic algorithms Pseudo-polynomial algorithms FPT algorithms

Branch-and-bound algorithms CLIQUE Instance:A graph G=(V,E) and a positive integer k Question:Is there a subset S  V, such that |S|=k and {x,y}  E for all x,y  S? [Adapted from D.Karabeg] Bron-Kerbosch algorithm 1971

Heuristic methods TSP (TRAVELING SALESMAN PROBLEM) Instance:A complete graph G=(V,E) with edge weights w: E  R + Problem:Find a cycle of minimum cost containing each of the vertices exactly once. Note, that in this case we consider an optimization problem and not a decision problem

Heuristic methods TSP tour of Sweden cities length km solved in 2004

Heuristic methods Idea - use a state space search algorithm (A*) with some reasonable heuristic: - states: partially completed cycles - production rules: all possible extensions of a partial cycle by adding one edge - if heuristic h will not exceed the minimum weight of extension to completed cycle, then A* guarantees to find an optimal solution (!)

Heuristic methods TSP. A legal tour is a (Hamiltonian) circuit: –It is a spanning tree (when an edge is removed) with the constraint that each node has at most 2 adjacent edges – Removing the adjacency constraint leads to h 1 : find the cheapest minimum spanning tree from the given graph (complexity O(n 2 log n)) The given graph A legal tour Other MST [Adapted from Y.Peng]

Heuristic methods TSP. A legal tour is a (Hamiltonian) circuit: –It is a connected second degree graph (each node has exactly two adjacent edges) – Removing the connectivity constraint leads to h 2 : find the cheapest second degree graph from the given graph (complexity O(n 3 )) The given complete graph A legal tour Other second degree graphs [Adapted from Y.Peng]

Approximation algorithms Approximation algorithm for VERTEX COVER problem: S   E  E[G] while E  let (u,v) be am arbitrary edge in E S  S  {u,v} remove from E every edge incident on either u or v return S VERTEX COVER Instance:A graph G=(V,E) Problem:Find a largest subset S  V, such for all {x,y}  E either x  S or y  S? Again, here we consider an optimization problem

Approximation algorithms Approximation algorithm for VERTEX COVER problem: S   E  E[G] while E  let (u,v) be am arbitrary edge in E S  S  {u,v} remove from E every edge incident on either u or v return S [Adapted from T.Cormen et al]

Approximation algorithms Approximation algorithm for VERTEX COVER problem: S   E  E[G] while E  let (u,v) be am arbitrary edge in E S  S  {u,v} remove from E every edge incident on either u or v return S C* - the size of vertex cover C - the size of set S returned by algorithm From each pair {u,v} added to S at least one vertex should belong to any vertex cover Thus C  2C* Algorithm finds a 2-approximation

Approximation algorithms Let C * be the cost of an optimal solution, and let C be the cost of the solution of an approximation algorithm. The algorithm has an approximation ratio of ρ(n) if, for all solutions max(C/C *,C * /C) ≤ ρ(n). We say that an approximation algorithm with an approximation ration of ρ(n) is a ρ(n)- approximation algorithm. [Adapted from S.Guattery]

Approximation algorithms MAX CUT Instance:A graph G=(V,E) Problem:Split V in 2 disjoint sets V 1 and V 2, such that {{x,y}  E | x  V 1 and y  V 2 } is maximal maximize Easy with  (n) = 2 [Erdös 1965] NP-hard for  (n) = 1.06 [Arora et al 1992] Polynomial for  (n) = 1.14 [Goemans,Williamson 1993] [Adapted from L.Lovász]

Approximation algorithms An approximation scheme is an approximation algorithm that takes an instance and an ε > 0, and produces a (1+ε) approximation. If an approximation scheme runs in polynomial time in both the size its input and ε, we say it is a polynomial-time approximation scheme (PTAS). [Adapted from S.Guattery]

Approximation algorithms KNAPSACK Instance:A finite set A of elements, with a size s: A  Z + and value v: A  Z + for each element, and integer K Problem:Find a subset S  A, such that  x  S s(x)  K and  x  S v(x) is maximal. There is a PTAS for KNAPSACK problem with a running time O(n 3 /  ). If P ≠ NP, the general TSP problem cannot be approximated within any constant ρ ≥ 1.

Probabilistic algorithms PRIMALITY TESTING Instance:A positive integer n Question:Is n a prime?

Probabilistic algorithms Miller-Rabin algorithm gives a correct answer with probability p in time O(log (1/ p) (log n) 3 ). If generalized Riemann hypothesis holds there is a O(log n) 5 ) time deterministic algorithm. There is a deterministic O(log n) 15/2 ) time algorithm (!) [Agarwal et al, 2004]. [Adapted from D.Harel]

Pseudo-polynomial algorithms PARTITION Instance:A finite set A={a 1,...,a n } of positive integers Question:Is there a subset S  A, such that  x  S x =  x  S x? A dynamic programming algorithm: B =  x  A x. For i  n and j  B/2 define T(i, j) to be true if and only if there is a subset Y  {a 1,...,a i }, such that  x  Y x = j. Formula: T(i,j) = true iff T(i-1, j)= true or T(i-1, j-a i )= true. Polynomial in nB (!), but not in n...

Pseudo-polynomial algorithms [Adapted from D.Karabeg]

Vertex cover revisited VERTEX COVER Instance:A graph G=(V,E) and a positive integer k Question:Is there a subset S  V, such that |S|=k and for all {x,y}  E either x  S or y  S? We already developed time n k algorithm for this problem... However, it is possible to do better:

Vertex cover revisited Algorithms for VERTEX COVER: O(f(k) n 3 ) [Fellows, Langston 1986] O(f(k) n 2 ) [Johnson 1987] O(2 k n) (polynomial for k=O(log n)) [Fellows 1988] O(kn + 2 k k 2k+2 ) [Buss 1989] O(kn + 2 k k 2 ) [Balasubramanian et al 1992] O(3 k n) [Papadimitriu 1993] O(kn + (4/3) k k 2 ) [Balasubramanian et al 1996]

Parametrized complexity Combinatorial "explosion" for NP-hard problems [Adapted from R.Downey and M.Fellows]

Parametrized complexity Parametrized complexity attempts to confine combinatorial "explosion" [Adapted from R.Downey and M.Fellows]

Parametrized complexity - Definitions Definition (FPT) A parametrized problem L   *  * is Fixed Parameter Tractable if there is an algorithm that for input (x,y)   *  * with |x| = k and |y| = n decides whether (x,y)  L in time f(k) n , where f is an arbitrary function and  is a constant. Definition does not change if f(k) n  is replaced by f(k) + n  (!)

Parametrized complexity - Definitions M k for every n solves the problem in time f(k) n  For each k there is a constant c k, such that f(k) n  > n  + 1 for n  c k M' k :- simulates M k for n  c k - looks up value from the table for n  c k M' k solves the problem in time f(k) c k + n a+1