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.

Slides:



Advertisements
Similar presentations
Traveling Salesperson Problem
Advertisements

Graphs CSC 220 Data Structure. Introduction One of the Most versatile data structures like trees. Terminology –Nodes in trees are vertices in graphs.
Movie theatre service on brightness and volume range leading to maximum clique graph By, Usha Kavirayani.
5-1 Chapter 5 Tree Searching Strategies. 5-2 Satisfiability problem Tree representation of 8 assignments. If there are n variables x 1, x 2, …,x n, then.
1 Section 9.4 Spanning Trees. 2 Let G be a simple graph. A spanning subtree of G is a subgraph of G containing every vertex of G –must be connected; contains.
Graph Search Methods A vertex u is reachable from vertex v iff there is a path from v to u
Algorithms and Data Structures
Branch & Bound Algorithms
Graph Search Methods A vertex u is reachable from vertex v iff there is a path from v to u
Graphs Chapter 12. Chapter Objectives  To become familiar with graph terminology and the different types of graphs  To study a Graph ADT and different.
CS 345 Ch 4. Algorithmic Methods Spring, Misconceptions about CS Computer Science is the study of Computers. “Computer Science is no more about.
Graph Search Methods Spring 2007 CSE, POSTECH. Graph Search Methods A vertex u is reachable from vertex v iff there is a path from v to u. A search method.
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
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.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
1 Tree Searching Strategies. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these problems becomes a tree.
CS 206 Introduction to Computer Science II 11 / 10 / 2008 Instructor: Michael Eckmann.
Using Search in Problem Solving
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Spring 2010CS 2251 Graphs Chapter 10. Spring 2010CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs.
Blind Search-Part 2 Ref: Chapter 2. Search Trees The search for a solution can be described by a tree - each node represents one state. The path from.
1 Branch and Bound Searching Strategies 2 Branch-and-bound strategy 2 mechanisms: A mechanism to generate branches A mechanism to generate a bound so.
Using Search in Problem Solving
Ch 13 – Backtracking + Branch-and-Bound
1 Tree Searching Strategies. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these problems becomes a tree.
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 Reading Material: Chapter 13, Sections 1, 2, 4, and 5.
Branch and Bound Algorithm for Solving Integer Linear Programming
CS 206 Introduction to Computer Science II 03 / 30 / 2009 Instructor: Michael Eckmann.
Jin Zheng, Central South University1 Branch-and-bound.
2/10/03Tucker, Sec Tucker, Applied Combinatorics, Sec. 3.2, Important Definitions Enumeration: Finding all of the possible paths in a rooted tree.
Backtracking.
ECE669 L10: Graph Applications March 2, 2004 ECE 669 Parallel Computer Architecture Lecture 10 Graph Applications.
Solving Problems by Searching CPS Outline Problem-solving agents Example problems Basic search algorithms.
Search.
Dr. Jouhaina Chaouachi Siala
Tree Searching Breadth First Search Dept First Search.
Artificial Intelligence Lecture 9. Outline Search in State Space State Space Graphs Decision Trees Backtracking in Decision Trees.
Backtracking. N-Queens The object is to place queens on a chess board in such a way as no queen can capture another one in a single move –Recall that.
Lecture 5: Backtracking Depth-First Search N-Queens Problem Hamiltonian Circuits.
Representing and Using Graphs
Design and Analysis of Algorithms - Chapter 111 How to tackle those difficult problems... There are two principal approaches to tackling NP-hard problems.
1 Chapter 5 Advanced Search. 2 Chapter 5 Contents l Constraint satisfaction problems l Heuristic repair l The eight queens problem l Combinatorial optimization.
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.
Search by partial solutions.  nodes are partial or complete states  graphs are DAGs (may be trees) source (root) is empty state sinks (leaves) are complete.
Graph Traversal BFS & DFS. Review of tree traversal methods Pre-order traversal In-order traversal Post-order traversal Level traversal a bc d e f g hi.
1 Branch and Bound Searching Strategies Updated: 12/27/2010.
COPING WITH THE LIMITATIONS OF ALGORITHM POWER
1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;
Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state).
Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in A player is given 30 seconds to find.
1 Directed Graphs Chapter 8. 2 Objectives You will be able to: Say what a directed graph is. Describe two ways to represent a directed graph: Adjacency.
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Ch22.Branch and Bound.
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
February 11, 2016Introduction to Artificial Intelligence Lecture 6: Search in State Spaces II 1 State-Space Graphs There are various methods for searching.
Branch and Bound Searching Strategies
Brute Force and Exhaustive Search Brute Force and Exhaustive Search Traveling Salesman Problem Knapsack Problem Assignment Problem Selection Sort and Bubble.
Brute Force and Exhaustive Search Brute Force and Exhaustive Search Traveling Salesman Problem Knapsack Problem Assignment Problem Selection Sort and Bubble.
BackTracking CS255.
Back Tracking.
Branch and Bound.
Searching for Solutions
Backtracking and Branch-and-Bound
Unit –VII Coping with limitations of algorithm power.
Presentation transcript:

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 that the sequence satisfies some constraint Traverses the state space using a depth-first search with pruning

Backtracking Performs a depth-first traversal of a tree Continues until it reaches a node that is non-viable or non-promising Prunes the sub tree rooted at this node and continues the depth-first traversal of the tree

Example: N-Queens Problem Given an N x N sized chess board Objective: Place N queens on the board so that no queens are in danger

One option would be to generate a tree of every possible board layout This would be an expensive way to find a solution

Backtracking Backtracking prunes entire sub trees if their root node is not a viable solution The algorithm will “backtrack” up the tree to search for other possible solutions

Efficiency of Backtracking This given a significant advantage over an exhaustive search of the tree for the average problem Worst case: Algorithm tries every path, traversing the entire search space as in an exhaustive search

Branch and Bound Where backtracking uses a depth-first search with pruning, the branch and bound algorithm uses a breadth-first search with pruning Branch and bound uses a queue as an auxiliary data structure

The Branch and Bound Algorithm Starting by considering the root node and applying a lower-bounding and upper-bounding procedure to it If the bounds match, then an optimal solution has been found and the algorithm is finished If they do not match, then algorithm runs on the child nodes

Example: The Traveling Salesman Problem Branch and bound can be used to solve the TSP using a priority queue as an auxiliary data structure An example is the problem with a directed graph given by this adjacency matrix:

Traveling Salesman Problem The problem starts at vertex 1 The initial bound for the minimum tour is the sum of the minimum outgoing edges from each vertex Vertex 1 min (14, 4, 10, 20) = 4 Vertex 2 min (14, 7, 8, 7) = 7 Vertex 3 min (4, 5, 7, 16) = 4 Vertex 4 min (11, 7, 9, 2) = 2 Vertex 5 min (18, 7, 17, 4) = 4 Bound = 21

Traveling Salesman Problem Next, the bound for the node for the partial tour from 1 to 2 is calculated using the formula: Bound = Length from 1 to 2 + sum of min outgoing edges for vertices 2 to 5 = 14 + ( ) = 31

Traveling Salesman Problem The node is added to the priority queue The node with the lowest bound is then removed This calculation for the bound for the node of the partial tours is repeated on this node The process ends when the priority queue is empty

Traveling Salesman Problem The final results of this example are in this tree: The accompanying number for each node is the order it was removed in

Efficiency of Branch and Bound In many types of problems, branch and bound is faster than branching, due to the use of a breadth-first search instead of a depth-first search The worst case scenario is the same, as it will still visit every node in the tree