Ch 13 – Backtracking + 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.
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.
Branch & Bound Algorithms
S. J. Shyu Chap. 1 Introduction 1 The Design and Analysis of Algorithms Chapter 1 Introduction S. J. Shyu.
Algorithm Strategies Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Approximation Algorithms
6 - 1 § 6 The Searching Strategies e.g. satisfiability problem x1x1 x2x2 x3x3 FFF FFT FTF FTT TFF TFT TTF TTT.
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.
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.
1 Optimization problems such as MAXSAT, MIN NODE COVER, MAX INDEPENDENT SET, MAX CLIQUE, MIN SET COVER, TSP, KNAPSACK, BINPACKING do not have a polynomial.
1 -1 Chapter 1 Introduction Why Do We Need to Study Algorithms? To learn strategies to design efficient algorithms. To understand the difficulty.
The Theory of NP-Completeness
MAE 552 – Heuristic Optimization Lecture 26 April 1, 2002 Topic:Branch and Bound.
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.
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.
5-1 Chapter 5 Tree Searching Strategies. 5-2 Breadth-first search (BFS) 8-puzzle problem The breadth-first search uses a queue to hold all expanded nodes.
Jin Zheng, Central South University1 Branch-and-bound.
Chapter 12 Coping with the Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Backtracking.
ECE669 L10: Graph Applications March 2, 2004 ECE 669 Parallel Computer Architecture Lecture 10 Graph Applications.
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 Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
Dr. Jouhaina Chaouachi Siala
Chapter 12 Coping with the Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
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.
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.
1 Tackling Difficult Combinatorial Problems There are two principal approaches to tackling difficult combinatorial problems (NP-hard problems): b Use a.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
1 Branch and Bound Searching Strategies Updated: 12/27/2010.
COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Constraint Satisfaction Problems (Chapter 6)
Types of Algorithms. 2 Algorithm classification Algorithms that use a similar problem-solving approach can be grouped together We’ll talk about a classification.
LIMITATIONS OF ALGORITHM POWER
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.
1 Ch 10 - NP-completeness Tractable and intractable problems Decision/Optimization problems Deterministic/NonDeterministic algorithms Classes P and NP.
Branch and Bound Searching Strategies
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Exhaustive search Exhaustive search is simply a brute- force approach to combinatorial problems. It suggests generating each and every element of the problem.
Brute Force and Exhaustive Search Brute Force and Exhaustive Search Traveling Salesman Problem Knapsack Problem Assignment Problem Selection Sort and Bubble.
Hard Problems Some problems are hard to solve.  No polynomial time algorithm is known.  E.g., NP-hard problems such as machine scheduling, bin packing,
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.
The Theory of NP-Completeness
Limitation of Computation Power – P, NP, and NP-complete
Traveling Salesperson Problem
BackTracking CS255.
CSCI 104 Backtracking Search
Courtsey & Copyright: DESIGN AND ANALYSIS OF ALGORITHMS Courtsey & Copyright:
Design and Analysis of Algorithm
Algorithms for hard problems
Types of Algorithms.
Heuristics Definition – a heuristic is an inexact algorithm that is based on intuitive and plausible arguments which are “likely” to lead to reasonable.
Back Tracking.
Branch and Bound.
Applied Combinatorics, 4th Ed. Alan Tucker
Chapter 12 Coping with the Limitations of Algorithm Power
Backtracking and Branch-and-Bound
The Theory of NP-Completeness
Unit –VII Coping with limitations of algorithm power.
Lecture 4: Tree Search Strategies
Presentation transcript:

Ch 13 – Backtracking + Branch-and-Bound There are two principal approaches to tackling NP-hard problems or other “intractable” problems: Use a strategy that guarantees solving the problem exactly but doesn’t guarantee to find a solution in polynomial time Use an approximation algorithm that can find an approximate (sub-optimal) solution in polynomial time

Exact solutions The exact solution approach includes: exhaustive search (brute force) useful only for small instances backtracking eliminates some cases from consideration branch-and-bound further cuts down on the search fast solutions for most instances worst case is still exponential

Backtracking : Colouring Example Region (Variable) Assignment Alternatives NT Q T WA Regions/variables: will be assigned values in the order shown (top to bottom); value order is red, green, blue; Assignment shows the values currently assigned to the variables; Alternatives are for backtracking; Result: exactly like (uninformed) depth-first search; in general very inefficient; NT NSW SA V SA V NSW Q T WA

Backtracking Construct the state space tree: nodes: partial solutions edges: choices in completing solutions 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: 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 of the four-queens problem

Example: m-coloring problem Given a graph and an integer m, color its vertices using no more than m colors so that no two adjacent vertices are the same color. Run on the following graph with m=3. 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.

Example: Ham Circuit problem Given a graph, find one of its Hamiltonian cycles. Run on the following graph. c d a e b f

Example: Subset-Sum problem Find a subset of a given set S = {s1, s2, …, sn} whose sum is equal to a given integer d. Run on S = {3, 5, 6, 7} and d =15.

Branch and Bound An enhancement of backtracking Applicable to optimization problems Uses a lower/upper bound for the value of the objective function for each node (partial solution) so as to: guide the search through state-space rule out certain branches as “unpromising” Lower bound for minimization problems Upper bound for maximization problems

Example: The job-employee assignment problem Select 1 element in each row of the cost matrix C : no 2 selected elements are in the same col; and the sum is minimized For example: Job 1 Job 2 Job 3 Job 4 Person a 9 2 7 8 Person b 6 4 3 7 Person c 5 8 1 8 Person d 7 6 9 4 Lower bound: Any solution to this problem will have total cost of at least: 2 + 3 + 1 + 4 = 10.

Assignment problem: lower bounds Job 1 Job 2 Job 3 Job 4 Person a 9 2 7 8 Person b 6 4 3 7 Person c 5 8 1 8 Person d 7 6 9 4 Lower bound: same formula, but remove the selected col.

Complete state-space 9 2 7 8 6 4 3 7 5 8 1 8 7 6 9 4

Knapsack problem Run BB algorithm on the following data: W = 10 (max weight) Elements (weight, benefit): (4,40), (7,42), (5,25), (3,12) Upper bound is calculated as ub = v + (W-w)(vi+1/wi+1) v = value of already selected items w = weight of already selected items

Knapsack problem (4,40, 10), (7,42, 6), (5,25, 5), (3,12, 4) W = 10

Traveling salesman problem Given a finite set C={c1,...,cm} of cities, a distance function d(ci, cj) of nonnegative values, find the length of the minimum distance tour which includes every city exactly once. Lower bound: average of the best 2 edges for each city (1+3 + 3+6 + 1+2 + 3+4 + 2+3)/2 Heuristic: Choose an order between 2 cities to reduce space by half.

Traveling salesman example

Summary Backtracking consists of doing a DFS of the state space tree, checking whether each node is promising and if the node is nonpromising backtracking to the its parent. Branch and Bound employs lower bounds for minimization problems, and upper bounds for maximization problems. It prunes branches that will lead to inferior solutions (than the ones already found).