Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Uninformed Search Lecture 4 What are common search strategies that operate only given the search problem formalism? How do they compare? Uninformed Search January 29, 2016 1
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Agenda • A quick refresher • DFS, BFS, ID-DFS, UCS • Unification! Uninformed Search January 29, 2016 2
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Search Problem Formalism Defined via the following components: • The initial state the agent starts in • A successor/transition function – S (x) = {action+cost->state} • A goal test , which determines whether a given state is a goal state • A path cost that assigns a numeric cost to each path A solution is a sequence of actions leading from initial state to a goal state. ( Optimal = lowest path cost.) Together the initial state and successor function implicitly define the state space , the set of all reachable states Uninformed Search January 29, 2016 3
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky State Space Graph • State space graph: A mathematical representation of a search problem – Nodes are (abstracted) world G configurations a – Arcs represent successors c b (action results) – The goal test is a set of goal e node(s) d f S • In a search graph, each state h occurs only once! p r q • We can rarely build this full graph in memory (it’s too big), but it’s a useful idea Uninformed Search January 29, 2016 4
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Search Tree • A “what if” tree of plans and their outcomes “N”, 1.0 “E”, 1.0 • The start state is the root node • Children correspond to successors • Nodes show states, but correspond to PLANS that achieve those states • For most problems, we can never actually build the whole tree Uninformed Search January 29, 2016 5
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Searching for Solutions Basic idea: incrementally build a search tree until a goal state is found • Root = initial state • Expand via transition function to create new nodes • Nodes that haven’t been expanded are leaf nodes and form the frontier ( open list ) • Different search strategies (next lecture) choose next node to expand (as few as possible!) • Use a closed list to prevent expanding the same state more than once Uninformed Search January 29, 2016 6
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky General Algorithm Queue (FIFO) Stack (LIFO) Priority Queue Uninformed Search January 29, 2016 7
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Evaluating a Search Strategy Solution Efficiency • Completeness : does it • Time Complexity : always find a solution if number of nodes one exists? generated/expanded • Optimality : does it • Space Complexity : always find a least-cost maximum number of solution? nodes in memory Uninformed Search January 29, 2016 8
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Depth-First Search (DFS) Uninformed Search January 29, 2016 9
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky DFS Example Strategy: expand a G a a deepest node first c c b b e e Implementation: d d f f Fringe is a LIFO stack S h h p p r r q q S e p d q e h r b c h r p q f a a q c p q f G a q c G a Uninformed Search January 29, 2016 10
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Let’s Evaluate! Uninformed Search January 29, 2016 11
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Search Tree Properties 1 node b b nodes … • B ranching factor b 2 nodes • M aximum depth m tiers • Solutions at various depths b m nodes Number of nodes in the tree? • 1 + b + b 2 + …. b m = O(b m ) Uninformed Search January 29, 2016 12
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky DFS Evaluation Time 1 node b • Expands left b nodes … – Could be whole tree! b 2 nodes • Assuming finite depth, O(b m ) m tiers Space • Only siblings on path, O(bm) b m nodes Complete • Only if finite Optimal • No, ”left-most” w/o regard to cost/depth Uninformed Search January 29, 2016 13
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Breadth-First Search (BFS) Uninformed Search January 29, 2016 14
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky BFS Example G a Strategy: expand a c b shallowest node first e d f Implementation: Fringe S h is a FIFO queue p r q S e p d Search q e h r b c Tiers h r p q f a a q c p q f G a q c G a Uninformed Search January 29, 2016 15
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky BFS Evaluation Time 1 node b • Processes all nodes b nodes … above shallowest s tiers b 2 nodes solution, O(b s ) b s nodes Space • Has roughly the last tier, so O(b s ) b m nodes Complete • Yes! Optimal • Only if all costs are 1 (more later) Uninformed Search January 29, 2016 16
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky DFS vs. BFS Empty-DFS Empty-BFS Maze-DFS Maze-BFS Uninformed Search January 29, 2016 17
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Grounding the Branching Factor Depth Nodes Time Memory 2 110 0.11 msecs 107 KB 4 11,110 11 msecs 10.6 MB 10 6 6 1.1 secs 1 GB 10 8 8 2 mins 103 GB 10 10 10 3 hours 10 TB 10 12 12 13 days 1 PB 10 14 14 3.5 years 99 PB 10 16 16 350 years 10 EB Assumptions • b = 10 Memory often becomes the • 1 million nodes/second limiting factor • 1000 bytes/node Uninformed Search January 29, 2016 18
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Iterative Deepening DFS • Basic idea: DFS b memory with BFS … time/shallow solution – DFS up to 1 – DFS up to 2 – …. • Generally most work happens in the lowest level searched, so not too wasteful Uninformed Search January 29, 2016 19
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Cost-Sensitive Search GOAL a 2 2 c b 3 2 1 8 2 e d 3 f 9 8 2 START h 4 2 1 4 p r 15 q • BFS finds the shortest path in terms of number of actions, but it does not find the least-cost path. • We will now cover a similar algorithm which does! Uninformed Search January 29, 2016 20
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Uniform-Cost Search (UCS) Uninformed Search January 29, 2016 21
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky UCS Example 2 G a c b 8 Strategy: expand a cheapest 1 2 2 e node first: 3 d f 9 2 8 S h Fringe is a priority queue 1 (priority: cumulative cost) 1 p r q 15 0 S 9 e p 3 d 1 q 11 5 17 e h r b 4 c 11 16 Cost 6 13 7 h r p q f a a contours q c 8 p q f G a q c 11 10 G a Uninformed Search January 29, 2016 22
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky UCS Evaluation Time b c ≤ 1 … • O(b C*/ 𝜁 ) c ≤ 2 C*/ ε “tiers” c ≤ 3 (effective Space depth) • O(b C*/ 𝜁 ) Complete • Yes! Assume solution costs C* and arcs cost at least 𝜁 Optimal • Yes! Uninformed Search January 29, 2016 23
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky UCS vs. DFS vs. BFS • UCS is good and c ≤ 1 … optimal c ≤ 2 c ≤ 3 • However, it still moves in every direction – it’s not informed about goal direction… Empty-UCS Maze-UCS MazeCost-DFS Start Goal MazeCost-BFS MazeCost-UCS Uninformed Search January 29, 2016 24
Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky Unification • All these search algorithms are the same except for fringe strategies • Conceptually, all fringes are priority queues (i.e. collections of nodes with attached priorities) • Practically, for DFS and BFS, you can avoid the log(n) overhead from an actual priority queue, by using stacks and queues Uninformed Search January 29, 2016 25
Recommend
More recommend