Backtracking Reading Material: Chapter 13, Sections 1, 2, 4, and 5.

Slides:



Advertisements
Similar presentations
Triangle partition problem Jian Li Sep,2005.  Proposed by Redstar in Algorithm board in Fudan BBS.  Motivated by some network design strategy.
Advertisements

Approximation Algorithms Chapter 14: Rounding Applied to Set Cover.
Backtrack Algorithm for Listing Spanning Trees R. C. Read and R. E. Tarjan (1975) Presented by Levit Vadim.
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.
Algorithms + L. Grewe.
Techniques for Dealing with Hard Problems Backtrack: –Systematically enumerates all potential solutions by continually trying to extend a partial solution.
The Theory of NP-Completeness
Graphs Chapter 12. Chapter Objectives  To become familiar with graph terminology and the different types of graphs  To study a Graph ADT and different.
© The McGraw-Hill Companies, Inc., Chapter 8 The Theory of NP-Completeness.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
61 Nondeterminism and Nodeterministic Automata. 62 The computational machine models that we learned in the class are deterministic in the sense that the.
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
Implicit Hitting Set Problems Richard M. Karp Harvard University August 29, 2011.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
Constraint Satisfaction Problems
The Theory of NP-Completeness
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Using Search in Problem Solving
Chapter 11: Limitations of Algorithmic Power
Ch 13 – Backtracking + Branch-and-Bound
Fall 2007CS 2251 Graphs Chapter 12. Fall 2007CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs To.
Backtracking.
Hardness Results for Problems
CSE 589 Applied Algorithms Spring Colorability Branch and Bound.
Busby, Dodge, Fleming, and Negrusa. Backtracking Algorithm Is used to solve problems for which a sequence of objects is to be selected from a set such.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
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.
Design Techniques for Approximation Algorithms and Approximation Classes.
Topology aggregation and Multi-constraint QoS routing Presented by Almas Ansari.
INTRODUCTION TO THE THEORY OF COMPUTATION INTRODUCTION MICHAEL SIPSER, SECOND EDITION 1.
Lecture 2: General Problem-Solving Methods. Greedy Method Divide-and-Conquer Backtracking Dynamic Programming Graph Traversal Linear Programming Reduction.
Design and Analysis of Algorithms - Chapter 111 How to tackle those difficult problems... There are two principal approaches to tackling NP-hard problems.
Chapter 12 Coping with the Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Contents of Chapter 7 Chapter 7 Backtracking 7.1 The General method
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
Christopher Moh 2005 Competition Programming Analyzing and Solving problems.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Algorithm Design Methods (II) Fall 2003 CSE, POSTECH.
COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Linear Program Set Cover. Given a universe U of n elements, a collection of subsets of U, S = {S 1,…, S k }, and a cost function c: S → Q +. Find a minimum.
Basic Problem Solving Search strategy  Problem can be solved by searching for a solution. An attempt is to transform initial state of a problem into some.
Approximation Algorithms Department of Mathematics and Computer Science Drexel University.
Implicit Hitting Set Problems Richard M. Karp Erick Moreno Centeno DIMACS 20 th Anniversary.
Graphs and MSTs Sections 1.4 and 9.1. Partial-Order Relations Everybody is not related to everybody. Examples? Direct road connections between locations.
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
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.
LIMITATIONS OF ALGORITHM POWER
Solving the Logic Satisfiability problem Solving the Logic Satisfiability problem Jesus De Loera.
Chapter 13 Backtracking Introduction The 3-coloring problem
CSCE350 Algorithms and Data Structure Lecture 21 Jianjun Hu Department of Computer Science and Engineering University of South Carolina
Algorithms for hard problems Introduction Juris Viksna, 2015.
ICS 353: Design and Analysis of Algorithms Backtracking King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Chapter 11. Chapter Summary  Introduction to trees (11.1)  Application of trees (11.2)  Tree traversal (11.3)  Spanning trees (11.4)
Theory of Computational Complexity Probability and Computing Chapter Hikaru Inada Iwama and Ito lab M1.
More NP-Complete and NP-hard Problems
8.3.2 Constant Distance Approximations
Hard Problems Some problems are hard to solve.
Backtracking And Branch And Bound
Design and Analysis of Algorithm
Computability and Complexity
Richard Anderson Lecture 28 Coping with NP-Completeness
Chapter 11 Limitations of Algorithm Power
Algorithms for Budget-Constrained Survivable Topology Design
Backtracking and Branch-and-Bound
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
Complexity Theory in Practice
ICS 353: Design and Analysis of Algorithms
Complexity Theory: Foundations
Presentation transcript:

Backtracking Reading Material: Chapter 13, Sections 1, 2, 4, and 5.

Coping with Hard Problems There are three useful methodologies that could be used to cope with problems having no efficient algorithm to solve: –A methodic examination of the implicit state space induced by the problem instance under study. suitable for problems that exhibit good average time complexity. –A probabilistic notion of accuracy where a solution is a simple decision maker or test that can accurately perform one task (either passing or failing the alternative) and not say much about the complementary option. An iteration through this test will enable the construction of the solution or the increase in the confidence level in the solution to the desired degree. –Obtain an approximate solution Only some classes of hard problems admit such polynomial time approximations. We will study the first one.

Backtracking A systematic technique of searching –To reduce the search space –Can be considered as an “organized” exhaustive search

3-Coloring Problem Optimization Problem –Input: G = (V, E), an undirected graph with n vertices and m edges. –Output: A 3-coloring of G, if possible. A coloring can be represented as an n-tuple (c 1, c 2,..., c n ) The number of different possible colorings for a graph is These possibilities can be represented as a complete ternary tree

3-Coloring: Search Tree Search tree of all possible colorings of a graph with 4 vertices (When could this be for a graph with 5 vertices?)

Example a bc de

In the example –Nodes are generated in a depth-first search manner –No need to store the whole search tree, just the current active path –What is the time complexity of the algorithm in the worst case

Algorithm 3-ColorRec

Algorithm 3-ColorIter 3

The General Backtracking Method Assume that the solution is of the form (x 1, x 2,..., x i ) where 0  i  n and n is a constant that depends on the problem formulation. –Here, the solution is assumed to satisfy certain constraints. –i in the case of the 3-coloring problem is fixed. –i may vary from one solution to another.

The General Backtracking Method: Example Consider the following version of the Partition Problem Input: X = {x 1, x 2,..., x n } a set of n integers, and an integer y. Output: Find a subset Y  X such that the sum of its elements is equal to y. –For example, consider X = {10, 20, 30, 40, 50, 60} and y = 60. There is more than one solution to this problem: What are they and what is their length?

The General Backtracking Algorithm (1) Each x i in the solution vector belongs to a finite linearly ordered set X i. The backtracking algorithm considers the elements of the Cartesian product X 1  X 2 ...  X n in lexicographic order. –Initially starting with the empty vector. Suppose that the algorithm has detected the partial solution (x 1, x 2,..., x j ). It then considers the vector v = (x 1, x 2,..., x j, x j+1 ). We have the following cases: 1.If v represents a final solution to the problem, the algorithm records it as a solution and either terminates in case only one solution is desired or continues to find other solutions. 2.(The advance Step): If v represents a partial solution, the algorithm advances by choosing the least element in the set X j+2.

The General Backtracking Algorithm (2) 3.If v is neither a final nor a partial solution, we have two sub-cases: a. If there are still more elements to choose from in the set X j+1, the algorithm sets x j+1 to the next member of X j+1. b.(The Backtrack Step): If there are no more elements to choose from in the set X j+1, the algorithm backtracks by setting x j to the next member of X j. If again there are no more elements to choose from in the set X j, the algorithm backtracks by setting x j  1 to the next member of X j  1, and so on.

BacktrackRec

BacktrackIter