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.

Slides:



Advertisements
Similar presentations
Chapter 4: Informed Heuristic Search
Advertisements

Greed is good. (Some of the time)
Artificial Intelligence Chapter 9 Heuristic Search Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Branch & Bound Algorithms
1 Tree Searching Strategies Updated: 2010/12/27. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these.
EIE426-AICV 1 Blind and Informed Search Methods Filename: eie426-search-methods-0809.ppt.
Chapter 3 The Greedy Method 3.
Review: Search problem formulation
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.
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.
Informed Search (no corresponding text chapter). Recall: Wanted " An algorithm and associated data structure(s) that can: 1) Solve an arbitrary 8-puzzle.
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 -1 Chapter 1 Introduction Why Do We Need to Study Algorithms? To learn strategies to design efficient algorithms. To understand the difficulty.
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.
Using Search in Problem Solving
Problem Solving and Search in AI Heuristic Search
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
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.
A Specialized A* Algorithm. Specialized A* Algorithm As soon as a goal node is found, we may stop and return an optimal solution. In ordinary A* algorithm,
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.
CSE 550 Computer Network Design Dr. Mohammed H. Sqalli COE, KFUPM Spring 2007 (Term 062)
Backtracking.
1 Lecture 4 Maximal Flow Problems Set Covering Problems.
Informed Search Idea: be smart about what paths to try.
Informed Search Strategies
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.
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.
Informed (Heuristic) Search
Informed search algorithms
Notes 5IE 3121 Knapsack Model Intuitive idea: what is the most valuable collection of items that can be fit into a backpack?
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
3 -1 Chapter 3 The Greedy Method 3 -2 A simple example Problem: Pick k numbers out of n numbers such that the sum of these k numbers is the largest.
Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
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.
1 Solving problems by searching 171, Class 2 Chapter 3.
1 Branch and Bound Searching Strategies Updated: 12/27/2010.
COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Computer Science CPSC 322 Lecture 6 Iterative Deepening and Search with Costs (Ch: 3.7.3, 3.5.3)
Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state).
State space representations and search strategies - 2 Spring 2007, Juris Vīksna.
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
Searching for Solutions
Ch22.Branch and Bound.
CSCE350 Algorithms and Data Structure Lecture 21 Jianjun Hu Department of Computer Science and Engineering University of South Carolina
3.5 Informed (Heuristic) Searches This section show how an informed search strategy can find solution more efficiently than uninformed strategy. Best-first.
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Branch and Bound Searching Strategies
1 Tree Searching Strategies 2010/12/03. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these problems.
For Monday Read chapter 4 exercise 1 No homework.
Exhaustive search Exhaustive search is simply a brute- force approach to combinatorial problems. It suggests generating each and every element of the problem.
CSE 326: Data Structures Lecture #17 Heuristic Graph Search Henry Kautz Winter Quarter 2002.
Design and Analysis of Algorithm
Artificial Intelligence Problem solving by searching CSC 361
Branch and Bound.
Branch and Bound Searching Strategies
Informed Search Idea: be smart about what paths to try.
Major Design Strategies
Tree Searching Strategies
Informed Search Idea: be smart about what paths to try.
Major Design Strategies
Lecture 4: Tree Search Strategies
Presentation transcript:

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 there are 2 n possible assignments.

5-3 An instance: -x 1 …….. …… (1) x 1 …………..(2) x 2 v x 5 …. ….(3) x 3 ……. …….(4) -x 2 ……. …….(5) A partial tree to determine the satisfiability problem. We may not need to examine all possible assignments.

5-4 Hamiltonian circuit problem A graph containing a Hamiltonian circuit.

5-5 The tree representation of whether there exists a Hamiltonian circuit.

5-6 Breadth-first search (BFS) 8-puzzle problem The breadth-first search uses a queue to hold all expanded nodes.

5-7 Depth-first search (DFS) e.g. sum of subset problem S={7, 5, 1, 2, 10}  S ’  S  sum of S ’ = 9 ? A stack can be used to guide the depth-first search. A sum of subset problem solved by depth-first search.

5-8 Hill climbing A variant of depth-first search The method selects the locally optimal node to expand. e.g. 8-puzzle problem evaluation function f(n) = d(n) + w(n) where d(n) is the depth of node n w(n) is # of misplaced tiles in node n.

5-9 An 8-puzzle problem solved by a hill climbing method.

5-10 Best-first search strategy Combine depth-first search and breadth-first search. Selecting the node with the best estimated cost among all nodes. This method has a global view. The priority queue (heap) can be used as the data structure of best-first search.

5-11 An 8-puzzle problem solved by a best-first search scheme.

5-12 Best-First Search Scheme Step1: Form a one-element list consisting of the root node. Step2: Remove the first element from the list. Expand the first element. If one of the descendants of the first element is a goal node, then stop; otherwise, add the descendants into the list. Step3: Sort the entire list by the values of some estimation function. Step4: If the list is empty, then failure. Otherwise, go to Step 2.

5-13 Branch-and-bound strategy This strategy can be used to efficiently solve optimization problems. e.g. A multi-stage graph searching problem.

5-14 Solved by branch -and-bound

5-15 Personnel assignment problem A linearly ordered set of persons P={P 1, P 2, …, P n } where P 1 <P 2 < … <P n A partially ordered set of jobs J={J 1, J 2, …, J n } Suppose that P i and P j are assigned to jobs f(P i ) and f(P j ) respectively. If f(P i )  f(P j ), then P i  P j. Cost C ij is the cost of assigning P i to J j. We want to find a feasible assignment with the minimum cost. i.e. X ij = 1 if P i is assigned to J j X ij = 0 otherwise. Minimize  i,j C ij X ij

5-16 e.g. A partial ordering of jobs After topological sorting, one of the following topologically sorted sequences will be generated: One of feasible assignments: P 1 → J 1, P 2 → J 2, P 3 → J 3, P 4 → J 4 J1J1 J2J2 ↓ ↘ ↓ J3J3 J4J4 J1,J1,J2,J2,J3,J3,J4J4 J1,J1,J2,J2,J4,J4,J3J3 J1,J1,J3,J3,J2,J2,J4J4 J2,J2,J1,J1,J3,J3,J4J4 J2,J2,J1,J1,J4J4 J3J3

5-17 A solution tree All possible solutions can be represented by a solution tree. J1J1 J2J2 ↓ ↘ ↓ J3J3 J4J4

5-18 Cost matrix Jobs Persons Cost matrix Apply the best- first search scheme:

5-19 Cost matrix Jobs Persons Reduced cost matrix Jobs Persons (-12) 26102(-26) (-3) 48005(-10) (-3) Reduced cost matrix

5-20 A reduced cost matrix can be obtained: subtract a constant from each row and each column respectively such that each row and each column contains at least one zero. Total cost subtracted: = 54 This is a lower bound of our solution.

5-21 Branch-and-bound for the personnel assignment problem Bounding of subsolutions: Jobs Persons J1J1 J2J2 ↓ ↘ ↓ J3J3 J4J4

5-22 The traveling salesperson optimization problem It is NP-complete. A cost matrix jiji ∞ ∞ ∞ ∞ ∞ ∞ ∞

5-23 A reduced cost matrix jiji ∞ (-3) 20∞ (-4) 3291∞200129(-16) ∞49084(-7) ∞032(-25) ∞4(-3) ∞(-26) Reduced: 84

5-24 Another reduced matrix jiji ∞ ∞ ∞ ∞ ∞ ∞ ∞ (-7)(-1) (-4) Total cost reduced: = 96 (lower bound)

5-25 The highest level of a decision tree: If we use arc 3-5 to split, the difference on the lower bounds is 17+1 = 18.

5-26 A reduced cost matrix if arc (4,6) is included in the solution. Arc (6,4) is changed to be infinity since it can not be included in the solution.

5-27 The reduced cost matrix for all solutions with arc 4-6 Total cost reduced: 96+3 = 99 (new lower bound) jiji ∞ ∞ ∞ ∞25(-3) 60858∞ ∞

5-28 A branch-and-bound solution of a traveling salesperson problem.

5-29 The 0/1 knapsack problem Positive integer P 1, P 2, …, P n (profit) W 1, W 2, …, W n (weight) M (capacity)

5-30 e.g. n = 6, M = 34 A feasible solution: X 1 = 1, X 2 = 1, X 3 = 0, X 4 = 0, X 5 = 0, X 6 = 0 -(P 1 +P 2 ) = -16 (upper bound) Any solution higher than -16 can not be an optimal solution. i PiPi WiWi (P i /W i  P i+1 /W i+1 )

5-31 Relax the restriction Relax our restriction from X i = 0 or 1 to 0  X i  1 (knapsack problem)

5-32 Upper bound and lower bound We can use the greedy method to find an optimal solution for knapsack problem: X 1 = 1, X 2 =1, X 3 = 5/8, X 4 = 0, X 5 = 0, X 6 =0 -(P 1 +P 2 +5/8P 3 ) = (lower bound) -18 is our lower bound. (only consider integers)  -18  optimal solution  -16 optimal solution: X 1 = 1, X 2 = 0, X 3 = 0, X 4 = 1, X 5 = 1, X 6 = 0 -(P 1 +P 4 +P 5 ) = -17

5-33 0/1 knapsack problem solved by branch-and-bound strategy. Expand the node with the best lower bound.

5-34 The A * algorithm Used to solve optimization problems. Using the best-first strategy. If a feasible solution (goal node) is obtained, then it is optimal and we can stop. Cost function of node n : f(n) f(n) = g(n) + h(n) g(n): cost from root to node n. h(n): estimated cost from node n to a goal node. h * (n): “ real ” cost from node n to a goal node. If we guarantee h(n)  h*(n), then f(n) = g(n) + h(n)  g(n)+h * (n) = f * (n)

5-35 An example for A * algorithm Find the shortest path with A * algorithm. Stop iff the selected node is also a goal node.

5-36 Step 1:

5-37 Step 2: Expand node A. 5

5-38 Step 3: Expand node C.

5-39 Step 4: Expand node D.

5-40 Step 5: Expand node B.

5-41 Step 6: Expand node F. Node I is a goal node. Thus, the final solution has been obtained.

5-42 The channel routing problem A channel specification

5-43 Illegal wirings: We want to find a routing which minimizes the number of tracks.

5-44 A feasible routing 7 tracks are needed.

5-45 An optimal routing 4 tracks are needed. This problem is NP-complete.

5-46 A* algorithm for the channel routing problem Horizontal constraint graph (HCG) e.g. net 8 must be to the left of net 1 and net 2 if they are in the same track.

5-47 Vertical constraint graph: Maximum cliques in HCG: {1,8}, {1,3,7}, {5,7}. Each maximum clique can be assigned to a track.

5-48 f(n) = g(n) + h(n), g(n): the level of the tree h(n): maximal local density A partial solution tree for the channel routing problem by using A * algorithm.