Dynamic programming. Trivial problems are solved first More complex solutions are composed from the simpler solutions already computed

Similar documents
Theorem 2.9: nearest addition algorithm

Approximation Algorithms

Exact Algorithms for NP-hard problems

COMP 355 Advanced Algorithms Approximation Algorithms: VC and TSP Chapter 11 (KT) Section (CLRS)

val(y, I) α (9.0.2) α (9.0.3)

CMSC 451: Lecture 22 Approximation Algorithms: Vertex Cover and TSP Tuesday, Dec 5, 2017

Module 6 NP-Complete Problems and Heuristics

Introduction to Combinatorial Algorithms

1 Variations of the Traveling Salesman Problem

Better approximations for max TSP

arxiv:cs/ v1 [cs.ds] 20 Feb 2003

Dynamic Programming II

Traveling Salesman Problem (TSP) Input: undirected graph G=(V,E), c: E R + Goal: find a tour (Hamiltonian cycle) of minimum cost

Algorithm Design and Analysis

Module 6 P, NP, NP-Complete Problems and Approximation Algorithms

Lecture 8: The Traveling Salesman Problem

CAD Algorithms. Categorizing Algorithms

The k-center problem Approximation Algorithms 2009 Petros Potikas

Introduction to Graph Theory

Chapter 9 Graph Algorithms

Treewidth and graph minors

Chapter 6. Dynamic Programming

Unit-5 Dynamic Programming 2016

Greedy algorithms Or Do the right thing

Domination, Independence and Other Numbers Associated With the Intersection Graph of a Set of Half-planes

The Parameterized Complexity of the Rainbow Subgraph Problem. Falk Hüffner, Christian Komusiewicz *, Rolf Niedermeier and Martin Rötzschke

arxiv: v2 [cs.ds] 30 Nov 2012

Department of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I

Chapter 9 Graph Algorithms

Decision Problems. Observation: Many polynomial algorithms. Questions: Can we solve all problems in polynomial time? Answer: No, absolutely not.

1 The Traveling Salesperson Problem (TSP)

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

Chapter 9 Graph Algorithms

Algorithms for Euclidean TSP

Assignment 4 Solutions of graph problems

Traveling Salesperson Problem (TSP)

P and NP CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang

Best known solution time is Ω(V!) Check every permutation of vertices to see if there is a graph edge between adjacent vertices

Lecture Notes: Euclidean Traveling Salesman Problem

CSCE 350: Chin-Tser Huang. University of South Carolina

NP-complete Reductions

Analysis of Algorithms Prof. Karen Daniels

P and NP CISC5835, Algorithms for Big Data CIS, Fordham Univ. Instructor: X. Zhang

Methods and Models for Combinatorial Optimization Exact methods for the Traveling Salesman Problem

Faster parameterized algorithms for Minimum Fill-In

Reference Sheet for CO142.2 Discrete Mathematics II

Lecturer: Shuchi Chawla Topic: Euclidean TSP (contd.) Date: 2/8/07

Graph Algorithms. Chromatic Polynomials. Graph Algorithms

Complexity Results on Graphs with Few Cliques

Graph Theory S 1 I 2 I 1 S 2 I 1 I 2

1 Dynamic Programming

CS6402-DESIGN AND ANALYSIS OF ALGORITHM. TWO MARK QUESTION WITH ANSWERS Unit-I. Introduction

2. Optimization problems 6

CS 125 Section #10 Midterm 2 Review 11/5/14

PATH FINDING AND GRAPH TRAVERSAL

Bipartite Roots of Graphs

Lecture 7. s.t. e = (u,v) E x u + x v 1 (2) v V x v 0 (3)

APPROXIMATION ALGORITHMS FOR GEOMETRIC PROBLEMS

Questions? You are given the complete graph of Facebook. What questions would you ask? (What questions could we hope to answer?)

Modules. 6 Hamilton Graphs (4-8 lectures) Introduction Necessary conditions and sufficient conditions Exercises...

CME 305: Discrete Mathematics and Algorithms Instructor: Reza Zadeh HW#3 Due at the beginning of class Thursday 02/26/15

CSE 417 Branch & Bound (pt 4) Branch & Bound

Greedy algorithms is another useful way for solving optimization problems.

Faster parameterized algorithms for Minimum Fill-In

CS 598CSC: Approximation Algorithms Lecture date: March 2, 2011 Instructor: Chandra Chekuri

Graph Theory. Connectivity, Coloring, Matching. Arjun Suresh 1. 1 GATE Overflow

Part II. Graph Theory. Year

Artificial Intelligence

Graphs: Introduction. Ali Shokoufandeh, Department of Computer Science, Drexel University

Advanced Methods in Algorithms HW 5

Dominating Set on Bipartite Graphs

Solutions for the Exam 6 January 2014

HW Graph Theory SOLUTIONS (hbovik)

Problem Set 3. MATH 776, Fall 2009, Mohr. November 30, 2009

11.1. Definitions. 11. Domination in Graphs

CS 311 Discrete Math for Computer Science Dr. William C. Bulko. Graphs

11. APPROXIMATION ALGORITHMS

Introduction to Algorithms

Communication Networks I December 4, 2001 Agenda Graph theory notation Trees Shortest path algorithms Distributed, asynchronous algorithms Page 1

Parameterized graph separation problems

Kernelization Upper Bounds for Parameterized Graph Coloring Problems

6. Algorithm Design Techniques

Introduction to Approximation Algorithms

Ferianakademie 2010 Course 2: Distance Problems: Theory and Praxis. Distance Labelings. Stepahn M. Günther. September 23, 2010

Paths, Flowers and Vertex Cover

CS6402 Design and Analysis of Algorithm. 2 Marks Question & Answer UNIT I INTRODUCTION

Restricted Delivery Problems on a Network. December 17, Abstract

A graph is finite if its vertex set and edge set are finite. We call a graph with just one vertex trivial and all other graphs nontrivial.

Some Hardness Proofs

P and NP (Millenium problem)

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

Important separators and parameterized algorithms

Ton Kloks and Yue-Li Wang. Advances in Graph Algorithms. October 10, y X z

Chapter Design Techniques for Approximation Algorithms

Practice Final Exam 1

University of New Mexico Department of Computer Science. Final Examination. CS 362 Data Structures and Algorithms Spring, 2006

Notes for Lecture 24

Algebraic method for Shortest Paths problems

Module 6 NP-Complete Problems and Heuristics

CME 305: Discrete Mathematics and Algorithms Instructor: Reza Zadeh HW#3 Due at the beginning of class Thursday 03/02/17

Transcription:

Dynamic programming Solves a complex problem by breaking it down into subproblems Each subproblem is broken down recursively until a trivial problem is reached Computation itself is not recursive: problems are solved from simple to more complex Trivial problems are solved first More complex solutions are composed from the simpler solutions already computed

Dynamic programming Applicable efficiently when Composing more complex solutions from subproblems solutions is fast (linear time) Subproblems are overlapping: a single solution is required to solve several other subproblems Has a clear advantage over recursion Has optimal substructure Each level of subproblems is only slightly more complex than the lower level See Principle of optimality, Bellman equation etc.

Polynomial time algorithms Floyd-Warshall algorithm CYK algorithm Levenshtein distance Viterbi algorithm Several string algorithms

Exponential time algorithms Useful for many problems where search space is superexponential in the input size n Permutation problems, O*(n!) Example: Travelling salesman problem Partition problems, O*(n n) Example: Graph coloring problem Typically solved dynamically by identifying subproblems on subsets of the original problem The number of subsets is only exponential in n

Travelling salesman problem Given an undirected weighed graph (V, E) of n vertices, find a cycle of minimum weight that visits each vertex in V exactly once A permutation problem: brute-force search enumerates all permutations of vertices, running in time O*(n!) Associated decision problem is NP-complete With dynamic programming we can solve the problem in time O*(2 n )

Dynamic TSP We first choose an arbitrary starting vertex s V For each nonempty U V and e U we compute OPT[U,e], the length of the shortest tour starting in s, visiting all vertices in U and ending in e For U = {e} we trivially set OPT[U,e] = d(s,e) For U > 1, u U \ {e}, if a tour containing the edge (u,e) is optimal, the tour on U \ {e} ending in u must be optimal as well Thus, for U > 1, OPT[U,e] is the minimum of OPT[U \ {e},u] + d(u,e) over all u U \ {e}

Dynamic TSP

Dynamic TSP

Dynamic TSP

Dynamic TSP

Dynamic TSP

Dynamic TSP To compute OPT[U,e], we need the values OPT[U \ {e},u] for all u U \ {e} We compute OPT in the order of increasing size of U to ensure the values are already computed Computing a single value takes O(n) time Finally, OPT[V,s] is the solution to the problem The number of subsets is O(2 n) and for each we evaluate the recurrence O(n) times Total running time is O(2 nn 2 ) = O*(2 n )

TSP in bounded degree graphs Despite its age the dynamic solution is still the best we have It's unknown whether a faster algorithm exists In some interesting special cases we can can solve TSP in time O*((2 ε) n ) for some ε > 0 E.g. graphs with bounded maximum degree Δ For cubic graphs (Δ = 3) a branching algorithm solves TSP in time O*(1.251 n ) For Δ = 4 we can do it in O*(1.733 n)

TSP in bounded degree graphs For Δ > 4 a more recent result bounds the time by O*((2 ε) n ) where ε > 0 depends only on Δ Observation: the dynamic algorithm needs to evaluate only tours on connected sets U V is a connected set if G[U] is connected Connectedness can be checked in O(n) time This yields the running time O*( C ) where C is the family of connected sets of the graph Analysis is reduced to estimating the size of C

Connected sets

TSP in bounded degree graphs For an n-vertex graph of maximum degree Δ we can show that C = O((2 Δ + 1 1) n / (Δ + 1) ) A lemma derived from Shearer's inequality: Let V be a finite set with subsets A1,..., A k such that each v V is in at least δ subsets Let F be a family of subsets of V Let Fi = {S A i : S F} for all i = 1..k Then, F δ is at most the product of F i over i = 1..k

TSP in bounded degree graphs For each v V we (initially) define Av as the closed neighborhood of v For each u V with the degree d(u) < Δ we add u in Δ d(u) sets A v, chosen arbitrarily Now each v V is contained in Δ + 1 subsets Define C' = C \ {{v} : v V} And the projections Cv = {S A v : S C'} for each v V

Projection, Δ = 3

Projection, Δ = 3

Projection, Δ = 3

Projection, Δ = 3

Projection, Δ = 3

TSP in bounded degree graphs Observe that for each v V the set Cv does not contain {v} since all sets in C' are connected Thus, the size of Cv is at most 2 Av 1 Shearer: C' Δ + 1 is at most the product of 2 Av 1 over v V With Jensen's inequality we can bound the product (and thus C' Δ + 1 ) by (2 Δ + 1 1) n Thus, the size of C' is at most (2 Δ + 1 1) n / (Δ + 1) C = C' + n, yielding the claimed bound

Time-space tradeoff In practical applications space complexity is often a greater problem than time Dynamic TSP needs exponential space A recursive algorithm that finds similar subtours runs in O*(4 n n log n ) time and polynomial space By switching from recursion to dynamic programming for small subproblems we get a more balanced tradeoff Integer-TSP can also be solved in polynomial space and time within a polynomial factor of the number of connected dominating sets

Graph coloring A k-coloring of an undirected graph G = (V,E) assigns one of k colors to each v V such that all adjacent vertices have different colors The smallest k with a k-coloring is called the chromatic number of G and denoted by χ(g) The graph coloring problem asks for either χ(g) or an optimal coloring, using χ(g) colors A partition problem: brute-force search enumerates all partitions of vertices to color classes in O*(χ(G) n ) time In the worst case χ(g) = n and the running time is O*(n n) Dynamic programming solves the problem in O*(2.4423 n)

Optimal coloring of Petersen graph

Dynamic graph coloring Recall independent sets A subset of vertices I V is an independent set if I contains no adjacent vertices I is maximal if no proper superset of I is independent Observation: A k-coloring is a partition of V into independent sets Each k-coloring can be modified so that at least one set is maximally independent (without increasing k) Consequently, there is an optimal coloring with a maximally independent set

Dynamic graph coloring For each U V we find OPT[U] = χ(g[u]), the chromatic number of the subgraph induced by U Trivially, OPT[Ø] = 0 For U > 0, an optimal coloring consists of a maximal independent set I and an optimal coloring on the remaining vertices in G[U \ I] Thus, OPT[U] is the minimum of 1 + OPT[U \ I] over the maximally independent sets I of G[U] By computing in the order of increasing size of U, we ensure we already have the values OPT[U \ I]

Dynamic graph coloring To compute OPT[U] we also need to enumerate all maximal independent sets of G[U] This can be done within a polynomial factor of the number of such sets, which for a subgraph of i vertices is at most 3 i / 3 The total number of maximal independent sets over all induced subgraphs of an n-vertex graph is at most (1 + 3 1 / 3 ) n = O(2.4423 n ), and for each we need n O(1) steps, yielding the claimed bound Finally, OPT[V] = χ(g)

Conclusion Dynamic programming solves a complex problem by breaking it into simpler subproblems Subproblems overlap: we compute from simpler to more complex, storing solutions in memory to avoid recomputation We can sometimes solve problems with superexponential search space in exponential time, often running on subsets of the problem (e.g. TSP, graph coloring) Sometimes we can ignore special subsets and get a more efficient exponential time solution Space complexity is often the most restrictive factor