Artificial Intelligence Lecture 4 Uninformed Search Dr Muhammad
- Slides: 34
Artificial Intelligence Lecture 4 – Uninformed Search Dr. Muhammad Adnan Hashmi 1/16/2022 1
Uninformed Search Strategies q Uninformed search strategies use only the information available in the problem definition q Breadth-first search q Uniform-cost search q Depth-first search q Depth-limited search q Iterative deepening search 1/16/2022 2
Breadth-first search q q Expand shallowest unexpanded node Implementation: Ø fringe is a FIFO queue, i. e. , new successors go at end 1/16/2022 3
Breadth-first search q q 1/16/2022 Expand shallowest unexpanded node Implementation: Ø fringe is a FIFO queue, i. e. , new successors go at end 4
Breadth-first search q q Expand shallowest unexpanded node Implementation: Ø fringe is a FIFO queue, i. e. , new successors go at end 1/16/2022 5
Breadth-first search q q Expand shallowest unexpanded node Implementation: Ø fringe is a FIFO queue, i. e. , new successors go at end 1/16/2022 6
Breadth-first search 1/16/2022 7
Properties of Breadth-first search q Complete? Yes (if b is finite) q Time? 1+b+b 2+b 3+… +bd + b(bd-1) = O(bd+1) q Space? O(bd+1) (keeps every node in memory) q Optimal? Yes (if cost = 1 per step) q Space is the bigger problem (more than time). 1/16/2022 8
Preventing Loopy Paths q q We can have search graphs (instead of trees) Ø Hence paths can go backwards, A B C B Ø Can get paths with loops A B C D B We can also have multiple paths to a node Ø From them, we are interested in the min-cost path q The Loop problem is that we “rediscover” nodes that the search has already discovered q Need to consider methods to suppress nodes that have already been visited. 1/16/2022 9
Uniform-Cost Search 1/16/2022 11
Consider the following problem… A 10 1 5 S B 5 G 5 15 C We wish to find the shortest route from node S to node G; that is, node S is the initial state and node G is the goal state. In terms of path cost, we can clearly see that the route SBG is the cheapest route. However, if we let breadth-first search loose on the problem it will find the non-optimal path SAG, assuming that A is the first node to be expanded at level 1.
Once Node node Astart is Sexpand removed is. B removed hasour been from expanded the queue it and is and removed the revealed fromnode the nodes queue (node are and G) added the is added revealed to to We We now with the initial node state at the and front expand ofthe queue, A. Press space tothe node queue. (node The G)queue isqueue added. isisthen again The sorted queue sorted on ison path again path cost. sorted cost. Nodes Note, on path with wecost. cheaper have. Note, now path found node cost G a have continue. it… goal now priority. In appears state but this in dothe case notqueue recognise the queue twice, itwill once as be it isas Node not G 10 at. Aand the (1), once front nodeof as. Bthe G (5), 11 queue. . followed As G 10 Node isbyatnode Bthe is C the(15). front cheaper of Press the queue, node. space. Press we now space. proceed to goal state. Press space. A 1 5 S 15 10 5 B C G The goal state is achieved and the path S-B-G is returned. In relation to path cost, UCS has found the optimal route. Size of Queue: 0 1 3 Queue: Empty S 10 G A, B, G B, , 11 GC, 11 C, C 15 Nodes expanded: 3 0 1 2 Current. FINISHED action: Expanding Waiting…. Backtracking SEARCH Current level: 2 n/a 0 1 UNIFORM COST SEARCH PATTERN
Uniform-Cost Search 1/16/2022 14
Uniform-Cost Search q q Expand least-cost unexpanded node Implementation: Ø q q q fringe = queue ordered by path cost Equivalent to breadth-first if step costs all equal Complete? Yes, if step cost ≥ ε Time? O(bceiling(C*/ ε)) where C* is the cost of the optimal solution Space? O(bceiling(C*/ ε)) Optimal? Yes – given the condition of completeness – you always expand the node with lowest cost Ø O(bceiling(C*/ ε)) can be greater than Ob/d 1/16/2022 15
Depth-first search q q Expand deepest unexpanded node Implementation: Ø fringe is a LIFO queue, i. e. , put successors in the front 1/16/2022 16
Depth-first search q q Expand deepest unexpanded node Implementation: Ø fringe is a LIFO queue, i. e. , put successors in the front 1/16/2022 17
Depth-first search q q Expand deepest unexpanded node Implementation: Ø fringe is a LIFO queue, i. e. , put successors in the front 1/16/2022 18
Depth-first search q q Expand deepest unexpanded node Implementation: Ø fringe is a LIFO queue, i. e. , put successors in the front 1/16/2022 19
Depth-first search q q Expand deepest unexpanded node Implementation: Ø fringe is a LIFO queue, i. e. , put successors in the front 1/16/2022 20
Depth-first search q q Expand deepest unexpanded node Implementation: Ø fringe is a LIFO queue, i. e. , put successors in the front 1/16/2022 21
Depth-first search q q Expand deepest unexpanded node Implementation: Ø fringe is a LIFO queue, i. e. , put successors in the front 1/16/2022 22
Properties of Depth-first search q Complete? No: fails in infinite-depth spaces, spaces with loops Ø q Time? O(bm): terrible if m is much larger than d Ø q q Complete in finite spaces But if solutions are dense, may be much faster than breadth-first Space? O(bm), i. e. , linear space! Optimal? No 1/16/2022 23
BFS or DFS
Depth-limited search q q Depth-first search with depth limit l, i. e. , nodes at depth l have no successors Recursive implementation: 1/16/2022 25
Depth-Limited Search q Complete? NO. Why? (l < d OR l > d) q Time? O(bl) q Space? O(bl) q Depth-first is a special case of depth-limited with l being infinite. 1/16/2022 26
Iterative deepening search 1/16/2022 27
Iterative deepening search l =0 1/16/2022 28
Iterative deepening search l =1 1/16/2022 29
Iterative deepening search l =2 1/16/2022 30
Iterative deepening search l =3 1/16/2022 31
Iterative Deepening search q q q Number of nodes generated in a depth-limited search to depth d with branching factor b: NDLS = b 0 + b 1 + b 2 + … + bd-2 + bd-1 + bd Number of nodes generated in an iterative deepening search to depth d with branching factor b: NIDS = (d+1)b 0 + d b 1 + (d-1)b 2 + … + 3 bd-2 +2 bd-1 + 1 bd For b = 10, d = 5, Ø NDLS = 1 + 100 + 1, 000 + 100, 000 = 111, 111 Ø NIDS = 6 + 50 + 400 + 3, 000 + 20, 000 + 100, 000 = 123, 456 Ø Overhead = (123, 456 - 111, 111)/111, 111 = 11% 1/16/2022 32
Properties of iterative deepening search q q Complete? Yes Time? (d+1)b 0 + d b 1 + (d-1)b 2 + … + bd = O(bd) q Space? O(bd) q Optimal? Yes, if step cost = 1 1/16/2022 33
Summary of Algorithms 1/16/2022 34
Questions 1/16/2022 35
- Uninformed search in artificial intelligence
- Informed and uninformed search
- State space search in artificial intelligence
- Uninformed search algorithm
- Which search strategy is called as blind search
- Uninformed search
- Uninformed and informed search
- Uninformed search
- Sabah translation
- Attahiyyatu
- Partitioned semantic network in artificial intelligence
- Strips planning
- Omniscience in artificial intelligence
- Problem solving by searching in artificial intelligence
- 15-780 graduate artificial intelligence
- Artificial intelligence chapter 1
- Artificial intelligence: a modern approach
- Passive reinforcement learning in artificial intelligence
- Part picking robot peas
- Planning in artificial intelligence
- Optimal decisions in games in artificial intelligence
- Cpsc 322: introduction to artificial intelligence
- 15-780 graduate artificial intelligence
- Inference by enumeration in artificial intelligence
- Artificial intelligence graph
- 15-780 graduate artificial intelligence
- Artificial intelligence applications institute
- Artificial intelligence
- Artificial intelligence assessment
- Waltz algorithm in artificial intelligence
- Artificial intelligence applications institute
- Roman yampolskiy
- Optimal decisions in games in artificial intelligence
- Artificial intelligence
- A star and ao star algorithm