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.

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.
Techniques for Dealing with Hard Problems Backtrack: –Systematically enumerates all potential solutions by continually trying to extend a partial solution.
October 1, 2012Introduction to Artificial Intelligence Lecture 8: Search in State Spaces II 1 A General Backtracking Algorithm Let us say that we can formulate.
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
1 Graphs: Traversal Searching/Traversing a graph = visiting the vertices of a graph by following the edges in a systematic way Example: Given a highway.
Graph Searching (Graph Traversal) Algorithm Design and Analysis Week 8 Bibliography: [CLRS] – chap 22.2 –
Graphs Graphs are the most general data structures we will study in this course. A graph is a more general version of connected nodes than the tree. Both.
S. J. Shyu Chap. 1 Introduction 1 The Design and Analysis of Algorithms Chapter 1 Introduction S. J. Shyu.
Artificial Intelligence Lecture
Algorithm Strategies Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
CPSC 322, Lecture 9Slide 1 Search: Advanced Topics Computer Science cpsc322, Lecture 9 (Textbook Chpt 3.6) January, 23, 2009.
Branch and Bound Searching Strategies
6 - 1 § 6 The Searching Strategies e.g. satisfiability problem x1x1 x2x2 x3x3 FFF FFT FTF FTT TFF TFT TTF TTT.
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 Graphs.
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.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Using Search in Problem Solving
Spring 2010CS 2251 Graphs Chapter 10. Spring 2010CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs.
MAE 552 – Heuristic Optimization Lecture 26 April 1, 2002 Topic:Branch and Bound.
CS 206 Introduction to Computer Science II 11 / 05 / 2008 Instructor: Michael Eckmann.
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.
Ch 13 – Backtracking + Branch-and-Bound
CISC220 Fall 2009 James Atlas Nov 13: Graphs, Line Intersections.
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.
Backtracking.
Dijkstra’s Algorithm and Heuristic Graph Search David Johnson.
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.
Graphs II Robin Burke GAM 376. Admin Skip the Lua topic.
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.
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
Fundamentals of Algorithms MCS - 2 Lecture # 7
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.
Today’s Topics FREE Code that will Write Your PhD Thesis, a Best-Selling Novel, or Your Next Methods for Intelligently/Efficiently Searching a Space.
CS 415 – A.I. Slide Set 5. Chapter 3 Structures and Strategies for State Space Search – Predicate Calculus: provides a means of describing objects and.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Lecture 3: Uninformed Search
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
1 Branch and Bound Searching Strategies Updated: 12/27/2010.
Types of Algorithms. 2 Algorithm classification Algorithms that use a similar problem-solving approach can be grouped together We’ll talk about a classification.
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.
LIMITATIONS OF ALGORITHM POWER
CS 312: Algorithm Analysis Lecture #33: Branch and Bound, Job Assignment This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
CSCE350 Algorithms and Data Structure Lecture 21 Jianjun Hu Department of Computer Science and Engineering University of South Carolina
© The McGraw-Hill Companies, Inc., Chapter 1 Introduction.
Graph Search II GAM 376 Robin Burke. Outline Homework #3 Graph search review DFS, BFS A* search Iterative beam search IA* search Search in turn-based.
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Other partial solution strategies. Partial solution algorithms greedy  branch and bound  A*  divide and conquer  dynamic programming.
Branch and Bound Searching Strategies
MA/CSSE 473 Day 14 Strassen's Algorithm: Matrix Multiplication Decrease and Conquer DFS.
CSE 326: Data Structures Lecture #17 Heuristic Graph Search Henry Kautz Winter Quarter 2002.
Lower bound algorithm. 1 Start from A. Delete vertex A and all edges meeting at A. A B C D 4 5 E Find the length of the minimum spanning.
D1 Discrete Mathematics
Traveling Salesperson Problem
BackTracking CS255.
The Travelling Salesperson problem
D1 Discrete Mathematics
Branch and Bound.
Applied Combinatorics, 4th Ed. Alan Tucker
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Branch and Bound Searching Strategies
Backtracking and Branch-and-Bound
More advanced aspects of search
Presentation transcript:

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 optimal solution –As an example take Weighed Graph Coloring R  $2, G  $3, B  $5, Y  $2 A fully connected graph of 3 vertices –Note that some of the connections on the next slide are missing to keep the picture fairly clean

Weighted Graph Coloring R  $2, G  $3, B  $5, Y  $2 A CB

Weighted Graph Coloring Obviously this approach will take a long time since we need to look at every possible combination Is there any way we can prune even more nodes from the tree? –Besides the non-feasible ones that we already prune What about a upper or lower bound on a node? –An estimate of the potential cost of expanding the node

Bounding A bound on a node is a guarantee that any solution obtained from expanding the node will be: –Greater than some number (lower bound) –Or less than some number (upper bound) If we are looking for a minimal optimal, as we are in weighted graph coloring, then we need a lower bound –For example, if the best solution we have found so far has a cost of 12 and the lower bound on a node is 15 then there is no point in expanding the node The node cannot lead to anything better than a 15

Bounding We can compute a lower bound for weighted graph color in the following way: –The actual cost of getting to the node –Plus a bound on the future cost Min weight color * number of nodes still to color –That is, the future cost cannot be any better than this

Weighted Graph Coloring R  $2, G  $3, B  $5, Y  $2 A CB Lower bound: cost + min_weight * num_uncolored 0+3  2=6 2+2  2=63+2  2=75+2  2=92+2  2=

Bounding Recall that we could either perform a depth-first or a breadth-first search –Without bounding, it didn’t matter which one we used because we had to expand the entire tree to find the optimal solution –Does it matter with bounding? Hint: think about when you can prune via bounding

Weighted Graph Coloring Breadth-first Search R  $2, G  $3, B  $5, Y  $2 A CB Lower bound: cost + min_weight * num_uncolored 0+3  2=6 2+2  2=63+2  2=75+2  2=92+2  2= Best so far:  Best so far: 7

Weighted Graph Coloring Depth-first Search R  $2, G  $3, B  $5, Y  $2 A CB Lower bound: cost + min_weight * num_uncolored 0+3  2=6 2+2  2=63+2  2=75+2  2=92+2  2= Best so far:  Best so far: 7

Bounding We prune (via bounding) when: (currentBestSolutionCost <= nodeBound) This tells us that we get more pruning if: –The currentBestSolution is low –And the nodeBound is high So we want to find a low solution quickly and we want the highest possible lower bound –One has to factor in the extra computation cost of computing higher lower bounds vs. the expected pruning savings

Best-first Search Depth-first search found a solution quickly Breadth-first search found all solutions at about the same time (but slowly) Best-first search finds a good solution fairly quickly –Not as quickly as depth-first –But the solution is often better which will increase the pruning via bounding

Best-first Search Best-first search expands the node with the best bounds next How would you implement a best-first search? –Depth-first is a stack –Breadth-first is a queue –Best-first is a ???

Weighted Graph Coloring Best-first Search R  $2, G  $3, B  $5, Y  $2 A CB Lower bound: cost + min_weight * num_uncolored 0+3  2=6 2+2  2=63+2  2=75+2  2=92+2  2= Best so far:  Best so far: 7

Best-first Search Best-first search expands the node with the best bounds next How would you implement a best-first search? –Depth-first is a stack –Breadth-first is a queue –Best-first is a ???

Traveling Salesperson Problem This is a classic CS problem Given a graph (cities), and weights on the edges (distances) find a minimum weight tour of the cities –Start in a particular city –Visit all other cities (exactly once each) –Return to the starting city Brute-force method requires worst-case n! (worse than exponential) running time –So we will look to backtracking with pruning to make it run in a reasonable amount of time in most cases

Traveling Salesperson Problem We will build our state space by: –Having our children be all the potential cities we can go to next –Having the depth of the tree be equal to the number of cities in the graph we need to visit each city exactly once So given a fully connected set of 5 nodes we have the following state space –only partially completed

Traveling Salesperson Problem A AB ABCD E BCDE CDE

Now we need to add bounding to this solution –It is a minimization problem so we need to find a lower bound We can use: –The current cost of getting to the node plus –An underestimate of the future cost of going through the rest of the cities The obvious choice is to find the minimum weight edge in the graph and multiply that edge weight by the number of remaining nodes to travel through

Traveling Salesperson Problem As an example assume we have the given adjacency matrix If we started at node A and have just traveled to node B then we need to compute the bound for node B –Cost 14 to get from A to B –Minimum weight in matrix is 2 times 4 more legs to go to get back to node A = 8 –For a grand total of =

Traveling Salesperson Problem Recall that if we can make the lower bound higher then we will get more pruning Note that in order to complete the tour we need to leave node B, C, D, and E –The min edge we can take leaving B is min(14, 7, 8, 7) = 7 –Similarly, C=4, D=2, E=4 This implies that at best the future underestimate can be = current cost of 14 = 31 –This is much higher than =

Traveling Salesperson Problem A 0+( ) = 21 ABACADAE 14 + ( ) = ( ) = ( ) = ( ) = 37 ACBACDACE (4+5) + (7+2+4) = ADBADCADE ACBDACBE ACBDEA 37 ACBEDA 31 ACDBACDE ACDBEA 43 ACDEBA 34 ADEBADEC ADEBCA 30 ADECBA A B C D E ABCDE