Presentation is loading. Please wait.

Presentation is loading. Please wait.

C M M Awais (LUMS)1 SEARCH METHODS State space search Heuristic search.

Similar presentations


Presentation on theme: "C M M Awais (LUMS)1 SEARCH METHODS State space search Heuristic search."— Presentation transcript:

1 c M M Awais (LUMS)1 SEARCH METHODS State space search Heuristic search

2 c M M Awais (LUMS)2 SEARCH Introduction:- If the general idea and action is known The actions that lead to solution is not known search methods can be applied examples:- Systematical steps that lead to prove certain theorems Sequence of steps that solve a puzzle

3 c M M Awais (LUMS)3 BASIC METHODS (Through all possible actions) Initial State Target State Background Material required is “GRAPH THEORY”

4 c M M Awais (LUMS)4 TYPICAL EXAMPLES OF SEARCH PROBLEMS Toy Problem (The 8 puzzle) Route Finding Traveling Save Person Robot Navigation Assembly Sequencing

5 c M M Awais (LUMS)5 Eight Puzzle Problem

6 c M M Awais (LUMS)6 Route Finding Problem

7 c M M Awais (LUMS)7 Suppose Initial State is Library Goal State is University Possible Route ? Problem is simple so all possible paths can be searched systematically to reach the goal Library via Hospital via newsagent to University What happens if search space is complex ?

8 c M M Awais (LUMS)8 ANALYSIS OF SEARCH STRATEGIES Completeness: is the strategy guaranteed to find a solution where there is one? Time Complexity:How long does it take to find a solution? Space Complexity:How much memory does it need to perform the search? Optimality:Does the strategy find the highest quality solution when there are several different solutions?

9 c M M Awais (LUMS)9 Exhaustive Search One can systematically check every state that is reachable from initial state to end out if it is a goal state. Search Space The set of all states is the search space For simple/small search space exhaustive search is applicable [BRUTE FORCE or BLIND SEARCH] For complex search space HEURISTIC SEARCH is used

10 c M M Awais (LUMS)10 GRAPHS AND TREES Graphs:- Consist of a set of nodes with links between them links can be directed / undirected Path is the sequence of nodes connected nodes via links. Acyclic graphs = (Paths linking a node with itself are absent) Trees???

11 c M M Awais (LUMS)11 Tree:- A tree is a special kind of graph with only one path to each node, usually represented with a special root node at the top Relationship between nodes Parent Children Sibling Ancestor Node,Descendant Node,Leaf Node

12 c M M Awais (LUMS)12 Graphs VS Trees Compare the searches in the two (which is efficient) a b c d a b c d e f g

13 c M M Awais (LUMS)13 Type of searches What is the value of profit if sales,employees, expenses etc., are given?. For a given profit what level of sales,employees, expenses etc., are required

14 c M M Awais (LUMS)14 STRATEGIES FOR STATE SPACE SEARCH DATA DRIVEN SEARCH (Forward Chaining) Start with some given facts Set of legal moves are given Search proceeds by applying rules to facts to generate new facts Process continues unless goal is reached

15 c M M Awais (LUMS)15 Goal - Driven Search(Backward Chaining) Take the goal Find what conditions or rules can produce or generate the goal Apply the conditions to generate subgoals Continue until the goal is reached

16 c M M Awais (LUMS)16 Types: Breadth First/Depth First

17 c M M Awais (LUMS)17 Example: Map Problem-1

18 c M M Awais (LUMS)18 Example: Map Problem -2

19 c M M Awais (LUMS)19 1.Start with queue = [initial - state] and found = FALSE 2.While queue not empty and not found do: (a)Remove the first node n from queue (b)if N is a goal state then found = TRUE (c )Find all the successor nodes of X, and put them on the end of the queue Breath First

20 c M M Awais (LUMS)20

21 c M M Awais (LUMS)21 1.Open = [A]; closed = [] 2. Open = [B,C,D]; closed = [A] 3. Open = [C,D,E,F]; closed = [A,B] 4. Open = [D,E,F,G,H]; closed = [C,B,A] 5. Open = [E,F,G,H,I,J]; closed = [D,C,B,A] 6. Open = [F,G,H,I,J,K,L]; closed = [E,D,C,B,A] 7. Open = [G,H,I,J,K,L,M]; closed = [F,E,D,C,B,A] 8. Open = [H,I,J,K,L,M,N]; closed = [G,F,E,D,C,B,A] 9. And so on until either U is found or open = []

22 c M M Awais (LUMS)22 1.Start with agenda = [initial - state] and found = FALSE 2.While agenda not empty and not found do: (a)Remove the first node N from agenda (b)if N is not in visited then (I)Add N to visited (II)if N is a goal state then found = TRUE (III)Put N’s successors on the front of the stack Depth First

23 c M M Awais (LUMS)23 Example

24 c M M Awais (LUMS)24 1.Open = [A]; closed = [] 2. Open = [B,C,D]; closed = [A] 3. Open = [E,F, C,D]; closed = [B,A] 4. Open = [K,L,F,C,D]; closed = [E,B,A] 5. Open = [S,L,F,C,D]; closed = [K,E,B,A] 6. Open = [L,F,C,D]; closed = [S,K,E,B,A] 7. Open = [T,F,C,D]; closed = [L,S,K,E,B,A] 8. Open = [F,C,D]; closed = [T,L,S,K,E,B,A] 9. Open = [M,C,D]as L is already on closed; closed = [F,T,L,S,K,E,B,A] 10. Open = [C,D]; closed = [M,F,T,L,S,K,E,B,A] 11. Open = [G.H.D]; closed = [C,M,F,T,L,S,K,E,B,A]


Download ppt "C M M Awais (LUMS)1 SEARCH METHODS State space search Heuristic search."

Similar presentations


Ads by Google