{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

View Full Document Right Arrow Icon
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.
Image of page 1

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

View Full Document Right Arrow Icon
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 0 1 1 2 0 0 1 0 1 2 3 0 1 1 0 1 2 3 0 1 2 0 0 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
Image of page 2
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.
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern