CSE 589 Applied Algorithms Spring 1999 3-Colorability Branch and Bound.

Slides:



Advertisements
Similar presentations
Great Theoretical Ideas in Computer Science
Advertisements

Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
Great Theoretical Ideas in Computer Science for Some.
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.
1 NP-completeness Lecture 2: Jan P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many.
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 
© The McGraw-Hill Companies, Inc., Chapter 8 The Theory of NP-Completeness.
Algorithm Strategies Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
FUNDAMENTAL PROBLEMS AND ALGORITHMS Graph Theory and Combinational © Giovanni De Micheli Stanford University.
Great Theoretical Ideas in Computer Science.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
Approximation Algorithms Lecture for CS 302. What is a NP problem? Given an instance of the problem, V, and a ‘certificate’, C, we can verify V is in.
Transitivity of  poly Theorem: Let ,  ’, and  ’’ be three decision problems such that   poly  ’ and  ’  poly  ’’. Then  poly  ’’. Proof:
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
A general approximation technique for constrained forest problems Michael X. Goemans & David P. Williamson Presented by: Yonatan Elhanani & Yuval Cohen.
The Theory of NP-Completeness
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2006 Lecture 7 Monday, 4/3/06 Approximation Algorithms.
88- 1 Chapter 8 The Theory of NP-Completeness P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class.
Chapter 11: Limitations of Algorithmic Power
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Backtracking Reading Material: Chapter 13, Sections 1, 2, 4, and 5.
9-1 Chapter 9 Approximation Algorithms. 9-2 Approximation algorithm Up to now, the best algorithm for solving an NP-complete problem requires exponential.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
CSE 589 Applied Algorithms Course Introduction. CSE Lecture 1 - Spring Instructors Instructor –Richard Ladner –206.
Approximation Algorithms Motivation and Definitions TSP Vertex Cover Scheduling.
Approximation Algorithms
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
MCS312: NP-completeness and Approximation Algorithms
Chapter 11 Limitations of Algorithm Power. Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples:
CSCE350 Algorithms and Data Structure
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.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
Approximation Algorithms
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.
CSE332: Data Abstractions Lecture 24.5: Interlude on Intractability Dan Grossman Spring 2012.
Lecture 19 Greedy Algorithms Minimum Spanning Tree Problem.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
Design and Analysis of Algorithms - Chapter 101 Our old list of problems b Sorting b Searching b Shortest paths in a graph b Minimum spanning tree b Primality.
NP-Complete Problems Algorithm : Design & Analysis [23]
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
Fundamentals of Informatics Lecture 14 Intractability and NP-completeness Bas Luttik.
LIMITATIONS OF ALGORITHM POWER
CSE 340: Review (at last!) Measuring The Complexity Complexity is a function of the size of the input O() Ω() Θ() Complexity Analysis “same order” Order.
Solving the Logic Satisfiability problem Solving the Logic Satisfiability problem Jesus De Loera.
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.
ICS 353: Design and Analysis of Algorithms Backtracking King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Approximation Algorithms by bounding the OPT Instructor Neelima Gupta
CSE 589 Applied Algorithms Spring 1999 Prim’s Algorithm for MST Load Balance Spanning Tree Hamiltonian Path.
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.
Mathematical Foundations of AI
Great Theoretical Ideas in Computer Science
Discrete Mathematics for Computer Science
ICS 353: Design and Analysis of Algorithms
Richard Anderson Lecture 28 Coping with NP-Completeness
NP-Complete Problems.
CSE 589 Applied Algorithms Spring 1999
ICS 353: Design and Analysis of Algorithms
Richard Anderson Lecture 5 Graph Theory
Our old list of problems
Presentation transcript:

CSE 589 Applied Algorithms Spring Colorability Branch and Bound

CSE Lecture 5 - Spring Colorability Input: Graph G = (V,E) and a number k. Output: Determine if all vertices can be colored with 3 colors such that no two adjacent vertices have the same color. 3-colorable Not 3-colorable

CSE Lecture 5 - Spring CNF-Sat < P 3-Color Given a 3-CNF formula F we have to show how to construct in polynomial time a graph G such that: –F is satisfiable implies G is 3-colorable –G is 3-colorable implies F is satisfiable

CSE Lecture 5 - Spring The Gadget This is a classic reduction that uses a “gadget”. Assume the outer vertices are colored at most two colors. The gadget is 3-colorable if and only if the outer vertices are not all the same color.

CSE Lecture 5 - Spring Properties of the Gadget Not 3 colorableIs 3 colorable Three colorable if and only if outer vertices not all the same color.

CSE Lecture 5 - Spring Reduction by Example x-xy-y-zz b g r

CSE Lecture 5 - Spring Satisfaction Example x-xy-y-zz b g r

CSE Lecture 5 - Spring Satisfaction Example x-xy-y-zz b g r

CSE Lecture 5 - Spring Non-Satisfaction Example x-xy-y-zz b g r

CSE Lecture 5 - Spring Naming the Gadget IN R T UO

CSE Lecture 5 - Spring General Construction where

CSE Lecture 5 - Spring Reductions CNF-Sat 3-CNF-SatClique 3-Color Exact Cover Subset Sum 3-Partition Bin Packing

CSE Lecture 5 - Spring Exact Cover Input: A set and subsets Output: Determine if there is set of pairwise disjoint set that union to U, that is, a set X such that:

CSE Lecture 5 - Spring Example of Exact Cover Exact Cover

CSE Lecture 5 - Spring Partition Input: A set of numbers and number B with the properties that B/4 < a i < B/2 and Output: Determine if A can be partitioned into S 1, S 2,…, S m such that for all i Note: each S i must contain exactly 3 elements.

CSE Lecture 5 - Spring Example of 3-Partition A = {26, 29, 33, 33, 33, 34, 35, 36, 41} B = 100, m = 3 3-Partition –26, 33, 41 –29, 36, 35 –33, 33, 34

CSE Lecture 5 - Spring Bin Packing Input: A set of numbers and numbers B (capacity) and K (number of bins). Output: Determine if A can be partitioned into S 1, S 2,…, S K such that for all i

CSE Lecture 5 - Spring Bin Packing Example A = {2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5} B = 10, K = 4 Bin Packing –3, 3, 4 –2, 3, 5 –5, 5 –2, 4, 4 Perfect fit!

CSE Lecture 5 - Spring Coping with NP-Completeness Given a problem appears to be hard what do you do? –Try to find a good algorithm for it. –Try to show its decision version is NP-complete or NP-hard. –Failing both, the problem probably is a hard one. –For a hard problem there are many things to try. Branch-and-bound algorithm - for exact solution Approximate algorithm - heuristic

CSE Lecture 5 - Spring Load Balanced Spanning Tree Cost Criteria Given a graph G = (V,E) and a spanning tree T. –d(T) = max degree of any vertex of T –c(T) = sum of the squares of the degrees d(T) = 3 c(T) = 4*1 + 1*4 + 2*9 = 26 Advantage of c(T) is that it has finer gradations.

CSE Lecture 5 - Spring Deriving c(T) Every spanning tree on n vertices has n-1 edges. Hence, the average number of edges per vertex is d = 2(n-1)/n, about 2. Let d i be the degree of vertex i. The variance in degree is Minimizing the variance is equivalent to minimizing

CSE Lecture 5 - Spring Examples of c(T) c(T) = 9* *9 2 = 90 c(T) = 2* *2 2 = 34

CSE Lecture 5 - Spring Another Example c(T) = 2*1 + 5*4 = 22c(T) = 3*1 + 3*4 + 1*9 = 24

CSE Lecture 5 - Spring Load Balanced Spanning Tree with Minimum Variance Input: Undirected graph G = (V,E). Ouput: A spanning tree that minimizes the sum of the squares of the degrees of the vertices in the tree.

CSE Lecture 5 - Spring Branch and Bound Start with an initial tree T with cost c(T). Systematically search through all forests by recursively (branching) adding new edges to the current forest. Discontinue a search if the forest cannot be contained in a spanning tree of smaller cost. (This is the bounding step). This is better than exhaustive search, but it is still only valuable on very small problems.

CSE Lecture 5 - Spring Example of Branch and Bound Initial cost

CSE Lecture 5 - Spring Bounding Condition Let c(F) be the cost of the current forest of k trees where tree T i had minimum degree vertex d i sorted smallest to largest. Let B be the best cost of any tree so far. The lowest possible cost of any tree containing F is If m(F) > B then do not continue searching from F.

CSE Lecture 5 - Spring Graphic of Bounding Condition d1d1 d3d3 d2d2 d4d4 d5d5 d 1 < d 2 < d 3 < d 4 < d 5

CSE Lecture 5 - Spring Example of Bounding d i = 0,1,1,1 c(F) = 1*0 + 8*1 + 1*16 = 24 m(F) = (1*1 + 1*4) - 2(1*0 + 1*1) + (1*1 +1*4) - (1*0 + 1*1) = 36 F

CSE Lecture 5 - Spring Branch and Bound Control The edges of G are in an array E[1..m] F is a set of indices of edges, initially empty There is an initial Best-Tree with Best-Cost LBST-Search(F) if F is a tree then if c(F) < Best-Cost then Best-Tree := F; Best-Cost := c(F); else {F is not a tree} for i = last-index-in(F) + 1 to m do if not(cycle(F,i)) and m(F,i) < Best-Cost then F := union(F,i); LBST-Search(F);

CSE Lecture 5 - Spring Notes on Branch and Bound Branch and bound is still an exponential search. To make it work well many efficiencies should be made. –Eliminate copy of the partial solution F on the recursive call. –Maintain cost of partial solution F and its sequence of minimum degrees to make computation of m(F,i) fast. –Use up tree for cycle checking. –Reduce use of expensive bounding checks when possible. –Add more bounding checks