15699 exhaustive search

87
Blind search • Types of Blind search : – Breadth first search – Depth first search – Depth first iterative deepening(DFID) – Bidirectional search

Upload: seeksudhanshu1

Post on 13-May-2017

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 15699 Exhaustive Search

Blind search

• Types of Blind search :

– Breadth first search– Depth first search– Depth first iterative deepening(DFID)– Bidirectional search

Page 2: 15699 Exhaustive Search

Breadth first search

• Expands all the states one step away from the first state, expands two steps away from the start state and so on. Until a goal state is reached.

• Implemented using two steps– OPEN list- those states that are to be expanded– CLOSED lists- those states that are already

expanded.

Page 3: 15699 Exhaustive Search

Breadth First Search

3

Application1: Given the following state space (tree search), give the sequence of visited nodes when using BFS (assume that the nodeO is the goal state):

A

B C ED

F G H I J

K L

O

M N

Page 4: 15699 Exhaustive Search

Breadth First Search

4

A,

A

B C ED

Page 5: 15699 Exhaustive Search

Breadth First Search

5

A, B,

A

B C ED

F G

Page 6: 15699 Exhaustive Search

Breadth First Search

6

A, B,C

A

B C ED

F G H

Page 7: 15699 Exhaustive Search

Breadth First Search

7

A, B,C,D

A

B C ED

F G H I J

Page 8: 15699 Exhaustive Search

Breadth First Search

8

A, B,C,D,E

A

B C ED

F G H I J

Page 9: 15699 Exhaustive Search

Breadth First Search

9

A, B,C,D,E, F,

A

B C ED

F G H I J

Page 10: 15699 Exhaustive Search

Breadth First Search

10

A, B,C,D,E, F,G

A

B C ED

F G H I J

K L

Page 11: 15699 Exhaustive Search

Breadth First Search

11

A, B,C,D,E, F,G,H

A

B C ED

F G H I J

K L

Page 12: 15699 Exhaustive Search

Breadth First Search

12

A, B,C,D,E, F,G,H,I

A

B C ED

F G H I J

K L M

Page 13: 15699 Exhaustive Search

Breadth First Search

13

A, B,C,D,E, F,G,H,I,J,

A

B C ED

F G H I J

K L M N

Page 14: 15699 Exhaustive Search

Breadth First Search

14

A, B,C,D,E, F,G,H,I,J, K, A

B C ED

F G H I J

K L M N

Page 15: 15699 Exhaustive Search

Breadth First Search

15

A, B,C,D,E, F,G,H,I,J, K,L A

B C ED

F G H I J

K L

O

M N

Page 16: 15699 Exhaustive Search

Breadth First Search

16

A, B,C,D,E, F,G,H,I,J, K,L, M, A

B C ED

F G H I J

K L

O

M N

Page 17: 15699 Exhaustive Search

Breadth First Search

17

A, B,C,D,E, F,G,H,I,J, K,L, M,N, A

B C ED

F G H I J

K L

O

M N

Page 18: 15699 Exhaustive Search

Breadth First Search

18

A, B,C,D,E, F,G,H,I,J, K,L, M,N, Goal state: O

A

B C ED

F G H I J

K L

O

M N

Page 19: 15699 Exhaustive Search

Breadth First Search

19

The returned solution is the sequence of operators in the path:A, B, G, L, O

A

B C ED

F G H I J

K L

O

M N

Page 20: 15699 Exhaustive Search

Water Jug problem using BFS

Page 21: 15699 Exhaustive Search

What Criteria are used to Compare different search techniques ?

21

• Completeness: Is the technique guaranteed to find an answer (if there is one).

• Optimality :Highest quality solution when there are several solution are there for the problem

• Time Complexity: How long does it take to find a solution.

• Space Complexity: How much memory does it take to find a solution.

Time and space complexity are measured in terms of:

• The (maximum) branching factor b is defined as the maximum nodes created when a new node is expanded.

• The length of a path to a goal is the depth d.

• The maximum length of any path in the state space m.

Page 22: 15699 Exhaustive Search

Breadth First Search (BFS)

22

• Complete? Yes.• Optimal? Yes(unit cost)• Time Complexity: O(bd) • Space Complexity: O(bd)

Page 23: 15699 Exhaustive Search

Algorithm• Input: START and GOAL states• Local variables: OPEN, CLOSED, STATE-X, SUCCs, FOUND;• OUTPUT: Yes Or No• Method:Initalize OPEN list with START and CLOSED=ᵩ;FOUND= false;While(OPEN≠ᵩ and FOUND= false) do{Remove the first state from OPEN and call it STATE-X;Put STATE-X in the front of closed list{maintained as stack};If STATE-X=GOAL then FOUND= true else{Perform EXPAND operation on STATE-X, producing a list of SUCCs;Remove the successors from those states, if any that are in the CLOSED list;Append SUCCs at the end of OPEN list; /*queue*/}} /* end of while*/If FOUND= true then return Yes else return NoStop

Page 24: 15699 Exhaustive Search

Depth First Search (DFS)

24

Page 25: 15699 Exhaustive Search

Depth First Search (DFS)

25

Application2: Given the following state space (tree search), give the sequence of visited nodes when using DFS (assume that the nodeO is the goal state):

A

B C ED

F G H I J

K L

O

M N

Page 26: 15699 Exhaustive Search

Depth First Search

26

A,

A

B C ED

Page 27: 15699 Exhaustive Search

Depth First Search

27

A,B,

A

B C ED

F G

Page 28: 15699 Exhaustive Search

Depth First Search

28

A,B,F,

A

B C ED

F G

Page 29: 15699 Exhaustive Search

Depth First Search

29

A,B,F, G,

A

B C ED

F G

K L

Page 30: 15699 Exhaustive Search

Depth First Search

30

A,B,F, G,K,

A

B C ED

F G

K L

Page 31: 15699 Exhaustive Search

Depth First Search

31

A,B,F, G,K, L,

A

B C ED

F G

K L

O

Page 32: 15699 Exhaustive Search

Depth First Search

32

A,B,F, G,K, L, O: Goal State

A

B C ED

F G

K L

O

Page 33: 15699 Exhaustive Search

Depth First Search

33

The returned solution is the sequence of operators in the path: A, B, G, L, O

A

B C ED

F G

K L

O

Page 34: 15699 Exhaustive Search

Depth First Search (DFS)

34

• Complete? No (Yes on finite trees, with no loops).

• Optimal? No

• Time Complexity: O(bd), where m is the maximum depth.

• Space Complexity: O(d), where m is the maximum depth.

Main idea: Expand node at the deepest level (breaking ties left to right).

Page 35: 15699 Exhaustive Search

Depth First Iterative Deepening Search (DFID)

DFID combines the benefits of BFS and DFS: Like DFS the memory requirements are very modest (O(d)). Like BFS, it is complete when the branching factor is finite.

In general, iterative deepening is the preferred uninformed search method when there is a large search space and the depth of the solution is not known.

Page 36: 15699 Exhaustive Search

Depth First Iterative Deepening Search

36

Given the following state space (tree search), give the sequence of visited nodes when using IDS:

A

B C ED

F G H I J

K L

O

M N

Limit = 0

Limit = 1

Limit = 2

Limit = 3

Limit = 4

Page 37: 15699 Exhaustive Search

DLS with bound = 0

Depth First Iterative Deepening Search

Page 38: 15699 Exhaustive Search

Depth First Iterative Deepening Search

38

A,

ALimit = 0

Page 39: 15699 Exhaustive Search

Depth First Iterative Deepening Search

39

A, Failure

ALimit = 0

Page 40: 15699 Exhaustive Search

DLS with bound = 1

Depth First Iterative Deepening Search

Page 41: 15699 Exhaustive Search

Depth First Iterative Deepening Search

41

A,

A

B C EDLimit = 1

Page 42: 15699 Exhaustive Search

Depth First Iterative Deepening Search

42

A,B,

A

B C EDLimit = 1

Page 43: 15699 Exhaustive Search

Depth First Iterative Deepening Search

43

A,B, C,

A

B C EDLimit = 1

Page 44: 15699 Exhaustive Search

Depth First Iterative Deepening Search

44

A,B, C, D,

A

B C EDLimit = 1

Page 45: 15699 Exhaustive Search

Depth First Iterative Deepening Search

45

A,B C, D, E, A

B C EDLimit = 1

Page 46: 15699 Exhaustive Search

Depth First Iterative Deepening Search

46

A,B, C, D, E, Failure A

B C EDLimit = 1

Page 47: 15699 Exhaustive Search

Depth First Iterative Deepening Search

47

A,

A

B C ED

Limit = 2

Page 48: 15699 Exhaustive Search

Depth First Iterative Deepening Search

48

A,B,

A

B C ED

F GLimit = 2

Page 49: 15699 Exhaustive Search

Depth First Iterative Deepening Search

49

A,B,F,

A

B C ED

F GLimit = 2

Page 50: 15699 Exhaustive Search

Depth First Iterative Deepening Search

50

A,B,F, G,

A

B C ED

F GLimit = 2

Page 51: 15699 Exhaustive Search

Depth First Iterative Deepening Search

51

A,B,F, G, C,

A

B C ED

F G HLimit = 2

Page 52: 15699 Exhaustive Search

Depth First Iterative Deepening Search

52

A,B,F, G, C,H,

A

B C ED

F G HLimit = 2

Page 53: 15699 Exhaustive Search

Depth First Iterative Deepening Search

53

A,B,F, G, C,H, D, A

B C ED

F G H I JLimit = 2

Page 54: 15699 Exhaustive Search

Depth First Iterative Deepening Search

54

A,B,F, G, C,H, D,I A

B C ED

F G H I JLimit = 2

Page 55: 15699 Exhaustive Search

Depth First Iterative Deepening Search

55

A,B,F, G, C,H, D,I J,

A

B C ED

F G H I JLimit = 2

Page 56: 15699 Exhaustive Search

Depth First Iterative Deepening Search

56

A,B,F, G, C,H, D,I J, E

A

B C ED

F G H I JLimit = 2

Page 57: 15699 Exhaustive Search

Depth First Iterative Deepening Search

57

A,B,F, G, C,H, D,I J, E, Failure

A

B C ED

F G H I J

K L

O

M N

Limit = 2

Page 58: 15699 Exhaustive Search

DLS with bound = 3

Depth First Iterative Deepening Search

Page 59: 15699 Exhaustive Search

Depth First Iterative Deepening Search

59

A,

A

B C ED

Limit = 3

Page 60: 15699 Exhaustive Search

Depth First Iterative Deepening Search

60

A,B,

A

B C ED

F G

Limit = 3

Page 61: 15699 Exhaustive Search

Depth First Iterative Deepening Search

61

A,B,F,

A

B C ED

F G

Limit = 3

Page 62: 15699 Exhaustive Search

Depth First Iterative Deepening Search

62

A,B,F, G,

A

B C ED

F G

K LLimit = 3

Page 63: 15699 Exhaustive Search

Depth First Iterative Deepening Search

63

A,B,F, G,K,

A

B C ED

F G

K LLimit = 3

Page 64: 15699 Exhaustive Search

Depth First Iterative Deepening Search

64

A,B,F, G,K, L,

A

B C ED

F G

K LLimit = 3

Page 65: 15699 Exhaustive Search

Depth First Iterative Deepening Search

65

A,B,F, G,K, L, C, A

B C ED

F G H

K LLimit = 3

Page 66: 15699 Exhaustive Search

Depth First Iterative Deepening Search

66

A,B,F, G,K, L, C,H, A

B C ED

F G H

K LLimit = 3

Page 67: 15699 Exhaustive Search

Depth First Iterative Deepening Search

67

A,B,F, G,K, L, C,H, D,

A

B C ED

F G H I J

K LLimit = 3

Page 68: 15699 Exhaustive Search

Depth First Iterative Deepening Search

68

A,B,F, G,K, L, C,H, D,I,

A

B C ED

F G H I J

K L MLimit = 3

Page 69: 15699 Exhaustive Search

Depth First Iterative Deepening Search

69

A,B,F, G,K, L, C,H, D,I,M,

A

B C ED

F G H I J

K L MLimit = 3

Page 70: 15699 Exhaustive Search

Depth First Iterative Deepening Search

70

A,B,F, G,K, L, C,H, D,I,M, J,

A

B C ED

F G H I J

K L M NLimit = 3

Page 71: 15699 Exhaustive Search

Depth First Iterative Deepening Search

71

A,B,F, G,K, L, C,H, D,I,M, J,N,

A

B C ED

F G H I J

K L M NLimit = 3

Page 72: 15699 Exhaustive Search

Depth First Iterative Deepening Search

72

A,B,F, G,K, L, C,H, D,I,M, J,N, E,

A

B C ED

F G H I J

K L M NLimit = 3

Page 73: 15699 Exhaustive Search

Depth First Iterative Deepening Search

73

A,B,F, G,K, L, C,H, D,I,M, J,N, E,Failure

A

B C ED

F G H I J

K L

O

M NLimit = 3

Page 74: 15699 Exhaustive Search

DLS with bound = 4

Depth First Iterative Deepening Search

Page 75: 15699 Exhaustive Search

Depth First Iterative Deepening Search

75

A,

A

B C ED

Limit = 4

Page 76: 15699 Exhaustive Search

Depth First Iterative Deepening Search

76

A,B,

A

B C ED

F G

Limit = 4

Page 77: 15699 Exhaustive Search

Depth First Iterative Deepening Search

77

A,B,F,

A

B C ED

F G

Limit = 4

Page 78: 15699 Exhaustive Search

Depth First Iterative Deepening Search

78

A,B,F, G,

A

B C ED

F G

K L

Limit = 4

Page 79: 15699 Exhaustive Search

Depth First Iterative Deepening Search

79

A,B,F, G,K,

A

B C ED

F G

K L

Limit = 4

Page 80: 15699 Exhaustive Search

Depth First Iterative Deepening Search

80

A,B,F, G,K, L,

A

B C ED

F G

K L

OLimit = 4

Page 81: 15699 Exhaustive Search

Depth First Iterative Deepening Search

81

A,B,F, G,K, L, O: Goal State

A

B C ED

F G

K L

OLimit = 4

Page 82: 15699 Exhaustive Search

Depth First Iterative Deepening Search

82

The returned solution is the sequence of operators in the path: A, B, G, L, O

A

B C ED

F G

K L

O

Page 83: 15699 Exhaustive Search

Depth First Iterative Deepening Search

• Advantage:

It gives the best solution by combining BFS and DFS.

• Disadvantage:

It performs wasted computation before reaching the goal depth

Page 84: 15699 Exhaustive Search

Bi-directional Search (BDS)

84

• Main idea: Start searching from both the initial state and the goal state, meet in the middle.

• Complete? Yes• Optimal? Yes• Time Complexity: O(bd/2), where d is

the depth of the solution.• Space Complexity: O(bd/2), where d is

the depth of the solution.

Page 85: 15699 Exhaustive Search

Bi-directional Search (BDS)ADVANTAGES• The merit of bidirectional search is its speed. Sum of the

time taken by two searches (forward and backward) is much less than the O(bd) complexity.

• It requires less memory.DISADVANTAGES• Implementation of bidirectional search algorithm is difficult

because additional logic must be included to decide which search tree to extend at each step.

• One should have known the goal state in advance.• The algorithm must be too efficient to find the intersection

of the two search trees.

Page 86: 15699 Exhaustive Search

Comparison of search algorithms

Basic Search Algorithms

Page 87: 15699 Exhaustive Search

Comparison of search algorithms

87

b: Branching factord: Depth of solutionm: Maximum depth

l : Depth Limit