Backtracking and Branch-and-Bound

Slides:



Advertisements
Similar presentations
Traveling Salesperson Problem
Advertisements

BackTracking Algorithms
Types of Algorithms.
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.
Techniques for Dealing with Hard Problems Backtrack: –Systematically enumerates all potential solutions by continually trying to extend a partial solution.
3.3 Spanning Trees Tucker, Applied Combinatorics, Section 3.3, by Patti Bodkin and Tamsen Hunter.
Branch & Bound Algorithms
B ACKTRACK SEARCH ALGORITHM. B ACKTRACKING Suppose you have to make a series of decisions, among various choices, where You don’t have enough information.
Algorithm Strategies Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Branch and Bound Similar to backtracking in generating a search tree and looking for one or more solutions Different in that the “objective” is constrained.
MAE 552 – Heuristic Optimization Lecture 26 April 1, 2002 Topic:Branch and Bound.
Ch 13 – Backtracking + Branch-and-Bound
Jin Zheng, Central South University1 Branch-and-bound.
Backtracking.
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.
CS 312: Algorithm Analysis
Artificial Intelligence Lecture 9. Outline Search in State Space State Space Graphs Decision Trees Backtracking in Decision Trees.
Lecture 5: Backtracking Depth-First Search N-Queens Problem Hamiltonian Circuits.
Fundamentals of Algorithms MCS - 2 Lecture # 7
HISTORY The problem was originally proposed in 1848 by the chess player Max Bezzel, and over the years, many mathematicians, including Gauss have worked.
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.
BackTracking CS335. N-Queens The object is to place queens on a chess board in such as way as no queen can capture another one in a single move –Recall.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
COPING WITH THE LIMITATIONS OF ALGORITHM POWER
CSCE350 Algorithms and Data Structure Lecture 19 Jianjun Hu Department of Computer Science and Engineering University of South Carolina
Types of Algorithms. 2 Algorithm classification Algorithms that use a similar problem-solving approach can be grouped together We’ll talk about a classification.
Analysis & Design of Algorithms (CSCE 321)
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
Optimization Problems The previous examples simply find a single solution What if we have a cost associated with each solution and we want to find the.
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
Brute Force and Exhaustive Search Brute Force and Exhaustive Search Traveling Salesman Problem Knapsack Problem Assignment Problem Selection Sort and Bubble.
Brute Force A straightforward approach, usually based directly on the problem’s statement and definitions of the concepts involved Examples: Computing.
Brute Force II.
CSG3F3/ Desain dan Analisis Algoritma
Brute Force A straightforward approach, usually based directly on the problem’s statement and definitions of the concepts involved Examples: Computing.
Traveling Salesperson Problem
Weighted Graphs and traveling Salesperson problem
Graphs Chapter 20.
BackTracking CS255.
Brute Force A straightforward approach, usually based directly on the problem’s statement and definitions of the concepts involved Examples: Computing.
Depth-First Search N-Queens Problem Hamiltonian Circuits
Greedy Technique.
Discrete Mathematicsq
Hard Problems Introduction to NP
Courtsey & Copyright: DESIGN AND ANALYSIS OF ALGORITHMS Courtsey & Copyright:
Design and Analysis of Algorithm
Types of Algorithms.
CS120 Graphs.
Back Tracking.
Types of Algorithms.
Branch and Bound.
Chapter 2: Business Efficiency Business Efficiency
Analysis & Design of Algorithms (CSCE 321)
Chapter 3 Brute Force Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Brute Force A straightforward approach, usually based directly on the problem’s statement and definitions of the concepts involved Examples: Computing.
Applied Combinatorics, 4th Ed. Alan Tucker
3. Brute Force Selection sort Brute-Force string matching
Haskell Tips You can turn any function that takes two inputs into an infix operator: mod 7 3 is the same as 7 `mod` 3 takeWhile returns all initial.
Branch and Bound Searching Strategies
Pruning 24-Feb-19.
3. Brute Force Selection sort Brute-Force string matching
Types of Algorithms.
Unit –VII Coping with limitations of algorithm power.
UNINFORMED SEARCH -BFS -DFS -DFIS - Bidirectional
Major Design Strategies
Major Design Strategies
Lecture 4: Tree Search Strategies
3. Brute Force Selection sort Brute-Force string matching
Presentation transcript:

Backtracking and Branch-and-Bound

Expected Outcomes Describe the ideas of backtracking and branch and bound techniques Solve some difficult problems by the backtracking technique

Exact Solutions exhaustive search (brute force) Generate ALL candidate solutions and identify one with a desired property useful only for small instances Improvement over exhaustive search: backtracking and branch-and-bound The idea construct candidate solutions one component at a time based on a certain rule. If no potential values of the remaining components can lead to a solution, the remaining components are not generated at all. Difference Apply to different problems (non-optimization and optimization problems) The way a new component is generated. Advantage and disadvantages cut down on the search space provide fast solutions for some instances the worst case is still exponential The procedure of composing a state-space tree is the procedure to construct a solution. Each node reflects the fact that a new component of a candidate solution is generated. When the tree is done, it means a path exists leading from the root, the original state to the final objective state.

Backtracking Construct the state space tree: Root represents an initial state Nodes reflect specific choices made for a solution’s components. Promising and nonpromising nodes leaves Explore the state space tree using depth-first search “Prune” non-promising nodes dfs stops exploring subtree rooted at nodes leading to no solutions and... “backtracks” to its parent node

Example: The n-Queen problem Place n queens on an n by n chess board so that no two of them are on the same row, column, or diagonal

State Space Tree of the Four-queens Problem

The m-Coloring Problem and Hamiltonian Problem Hamiltonian Circuit (use alphabet order to break the ties) c d a e b Careful to draw the state-space by coloring vertices in alphabetical order. This way you get some actual “backtracking” – most small examples of graph coloring yield a solution so fast that it is hard to appreciate what is going on.

Comments Exhaustive search and backtracking Exhaustive search is guaranteed to be very slow in every problem instance. Backtracking provides the hope to solve some problem instances of nontrivial sizes by pruning non-promising branches of the state-space tree. The success of backtracking varies from problem to problem and from instance to instance. Backtracking possibly generates all possible candidates in an exponentially growing state-space tree. But still it provides a systematic technique to do so. Generate all n-bit binary strings.

Branch and Bound An enhancement of backtracking Similarity Difference A state space tree is used to solve a problem. Difference The branch-and-bound algorithm does not limit us to any particular way of traversing the tree and is used only for optimization problems The backtracking algorithm requires the using of DFS traversal and is used for nonoptimization problems.

Branch and Bound The idea Set up a bounding function, which is used to compute a bound (for the value of the objective function) at a node on a state-space tree and determine if it is promising Promising (if the bound is better than the value of the best soluton so far): expand beyond the node. Nonpromising (if the bound is no better than the value of the best solution so far): not expand beyond the node (pruning the state-space tree).

Traveling Salesman Problem An obvious way to construct the state-space tree A node: a node in the state-space tree; a vertex: a vertex in the graph. A node that is not a leaf represents all the tours that start with the path stored at that node; each leaf represents a tour (or nonpromising node). Branch-and-bound: we need to determine a lower bound for each node For example, to determine a lower bound for node [1, 2] means to determine a lower bound on the length of any tour that starts with edge 1—2. Expand each promising node, and stop when all the promising nodes have been expanded. During this procedure, prune all the nonpromising nodes. Promising node: the node’s lower bound is less than current minimum tour length. Nonpromising node: the node’s lower bound is NO less than current minimum tour length.

Traveling Salesman Problem—Bounding Function 1 Because a tour must leave every vertex exactly once, a lower bound on the length of a tour is the sum of the minimum (lower bound)cost of leaving every vertex. The lower bound on the cost of leaving vertex v1 is given by the minimum of all the nonzero entries in row 1 of the adjacency matrix. … The lower bound on the cost of leaving vertex vn is given by the minimum of all the nonzero entries in row n of the adjacency matrix. Note: This is not to say that there is a tour with this length. Rather, it says that there can be no shorter tour. Assume that the tour starts with v1.

Traveling Salesman Problem—Bounding Function 2 Because every vertex must be entered and exited exactly once, a lower bound on the length of a tour is the sum of the minimum cost of entering and leaving every vertex. For a given edge (u, v), think of half of its weight as the the exiting cost of u, and half of its weight as the entering cost of v. The total length of a tour = the total cost of visiting( entering and exiting) every vertex exactly once. The lower bound of the length of a tour = the lower bound of the total cost of visiting (entering and exiting ) every vertex exactly once. Calculation: for each vertex, pick top two shortest adjacent edges (their sum divided by 2 is the lower bound of the total cost of entering and exiting the vertex); add up these summations for all the vertices. Assume that the tour starts with vertex a and that b is visited before c.

Traveling salesman example 2