MIT6_01F09_lec12

MIT6_01F09_lec12 - 6.01: Introduction to EECS 1 Week 12...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 6.01: Introduction to EECS 1 Week 12 November 24, 2009 6.01: Introduction to EECS I Search Algorithms Looking Ahead Reaction: Use a rule to determine the action to take, as a direct function of the state wall-following proportional controller Planning: Choose action based on looking ahead: exploring alternative sequences of actions Methods for planning require us to specify an explicit model of the effects of our actions in the world. Week 12 November 24, 2009 Using models to choose actions Assume states and actions are discrete. Given A state-machine model of the world A start state A goal test Find a sequence of actions (inputs to the state machine) to reach a goal state from the start state. Application: Navigation What are good definitions of states, actions? What makes a path good? Abstraction: Labeled graph Formal model Lots of possible paths! Could enumerate them and evaluate each one. Too hard... Assume additive cost . For now, each segment has a cost of one. We want to find the shortest path. States: {S, A, B, C, D, E, F, G, H} . Starting state is S . Goal test: lambda x: x == H Legal actions and successors: map1 = {S : [A, B], A : [S, C, D], B : [S, D, E], C : [A, F], D : [A, B, F, H], E : [B, H], F : [C, D, G], H : [D, E, G], G : [F, H]} map1LegalActions = [0, 1, 2, 3] def map1successors(s, a): if a < len(map1[s]): return map1[s][a] else: return s 1 Figure by MIT OpenCourseWare. 6.01: Introduction to EECS 1 Week 12 November 24, 2009 Search tree encodes all possible paths S B F D A C S S E D A A B F H A B B A F H B H A B 1 1 2 1 1 2 3 1 1 1 2 3 1 2 1 Check yourself S H B G F D A C E How many shortest paths are there from S to G ? 2 Check yourself S H B G F D A C E How many shortest paths are there from S to G ? 6 A numeric example States: integers Start state: 1 Legal actions (and successors) in state n : { 2 2 n, n + 1 , n 1 , n , n } Goal test: x = 10 How long is the longest path in this domain? Search trees in Python Node in search tree, not the same as a state! class SearchNode: def __init__(self, action, state, parent): self.state = state self.action = action self.parent = parent Search node encodes a whole path def path(self): if self.parent == None: return [(self.action, self.state)] else: return self.parent.path() + \ [(self.action, self.state)] Finding your way 6.01: Introduction to EECS 1 Search algorithm Until we find the goal or the agenda is empty: Extract a node from the agenda Expand it (find its children) Add its children to the agenda ( visit its children) Goal: Search as few nodes as possible while guaranteeing that we still find the shortest path....
View Full Document

This note was uploaded on 11/07/2011 for the course COMPUTER 6.01 taught by Professor Staff during the Spring '09 term at MIT.

Page1 / 9

MIT6_01F09_lec12 - 6.01: Introduction to EECS 1 Week 12...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online