agents & search tamara berg cs 590-133 artificial intelligence many slides throughout the course...
TRANSCRIPT
![Page 1: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/1.jpg)
Agents & Search
Tamara BergCS 590-133 Artificial Intelligence
Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore, Svetlana Lazebnik, Percy Liang, Luke Zettlemoyer
![Page 2: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/2.jpg)
Course Information
Instructor: Tamara Berg ([email protected])Course website: http://tamaraberg.com/teaching/Spring_14/
TAs: Shubham Gupta & Rohit Gupta
Office Hours (Tamara): Tuesdays/Thursdays 4:45-5:45pm FB 236 Office Hours (Shubham): Mondays 4-5pm & Friday 3-4pm SN 307 Office Hours (Rohit): Wednesday 4-5pm & Friday 4-5pm SN 312
See last week’s slides and website for additional important course information.
![Page 3: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/3.jpg)
Course Information• Textbook: “Artificial Intelligence A Modern Approach” Russell & Norvig,
3rd edition
• Prerequisites: – Programming knowledge and data structures (COMP 401 and 410) are required– Reasonable knowledge of probability, algorithms, calculus also highly desired– There will be a lot of math and programming
• Work & Grading– Readings (mostly from textbook)– 5-6 assignments including written questions, programming, or both– 2 midterms (approximate dates are on course website) and final exam– Grading will consist of 60% assignments, 40% exams. For borderline cases
participation in class or via the mailing list may also be considered.
![Page 4: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/4.jpg)
Python Tutorials
• Reminder: Students are expected to know how to program.
• Programming assignments will be in python – useful language to know, used in many current AI courses, not too hard to pick up given previous programming experience.
• To Do – install python on your laptops, attend a python tutorial. TA’s will hold drop-in tutorials Tuesday and Wednesday, 6pm in SN014.
![Page 5: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/5.jpg)
Announcements for today
• I’ve created a piazza mailing list for the course. Please sign up here: – piazza.com/unc/spring2014/comp590133
• This is a 3 credit course. Some of you are only registered for 1 credit. Please change your enrollment to 3 credits.
• Python tutorials Tues/Wed 6pm in SN014
![Page 6: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/6.jpg)
Agents
![Page 7: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/7.jpg)
Agents• An agent is anything that can be viewed as
perceiving its environment through sensors and acting upon that environment through actuators
![Page 8: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/8.jpg)
Example: Vacuum-Agent• Percepts:
Location and status, e.g., [A,Dirty]
• Actions: Left, Right, Suck, Dump, NoOp
function Vacuum-Agent([location,status]) returns an action• if status = Dirty then return Suck• else if location = A then return Right• else if location = B then return Left
![Page 9: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/9.jpg)
Rational agents
• For each possible percept sequence, a rational agent should select an action that is expected to maximize its performance measure, given the evidence provided by the percept sequence and the agent’s built-in knowledge
• Performance measure (utility function): An objective criterion for success of an agent's behavior
![Page 10: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/10.jpg)
![Page 11: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/11.jpg)
Example: Vacuum-Agent• Percepts:
Location and status, e.g., [A,Dirty]
• Actions: Left, Right, Suck, Dump, NoOp
• Potential performance measures for our vacuum agent? – Amount of dirt cleaned in 8 hour shirt– Reward for having a clean floor, e.g. awarded for each clean square @ each
time step
![Page 12: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/12.jpg)
Example: Vacuum-Agent• Percepts:
Location and status, e.g., [A,Dirty]
• Actions: Left, Right, Suck, Dump, NoOp
function Vacuum-Agent([location,status]) returns an action• if status = Dirty then return Suck• else if location = A then return Right• else if location = B then return Left
Is this agent rational?
![Page 13: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/13.jpg)
Specifying the task environment
• Problem specification: Performance measure, Environment, Actuators, Sensors (PEAS)
• Example: autonomous taxi– Performance measure
• Safe, fast, legal, comfortable trip, maximize profits– Environment
• Roads, other traffic, pedestrians, customers– Actuators
• Steering wheel, accelerator, brake, signal, horn– Sensors
• Cameras, LIDAR, speedometer, GPS, odometer, engine sensors, keyboard
![Page 14: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/14.jpg)
Another PEAS example: Spam filter
• Performance measure– Minimizing false positives, false negatives
• Environment– A user’s email account, email server
• Actuators– Mark as spam, delete, etc.
• Sensors– Incoming messages, other information about
user’s account
![Page 15: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/15.jpg)
Environment types
• Fully observable vs. partially observable• Deterministic vs. stochastic• Episodic vs. sequential• Static vs. dynamic• Discrete vs. continuous• Single agent vs. multi-agent• Known vs. unknown
![Page 16: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/16.jpg)
Fully observable vs. partially observable• Do the agent's sensors give it access to the
complete state of the environment?
vs.
![Page 17: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/17.jpg)
Deterministic vs. stochastic
• Is the next state of the environment completely determined by the current state and the agent’s action?
vs.
![Page 18: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/18.jpg)
Episodic vs. sequential
• Is the agent’s experience divided into unconnected episodes, or is it a coherent sequence of observations and actions?
vs.
![Page 19: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/19.jpg)
Static vs. dynamic• Is the world changing while the agent is
thinking?• Semi-dynamic: the environment does not change with the
passage of time, but the agent's performance score does
vs.
![Page 20: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/20.jpg)
Discrete vs. continuous
• Does the environment provide a fixed number of distinct percepts, actions, and environment states?– Time can also evolve in a discrete or continuous fashion
vs.
![Page 21: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/21.jpg)
Single-agent vs. multiagent
• Is an agent operating by itself in the environment?
vs.
![Page 22: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/22.jpg)
Known vs. unknown
• Are the rules of the environment (transitions and rewards) known to the agent?– Strictly speaking, not a property of the environment, but
of the agent’s state of knowledge
vs.
![Page 23: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/23.jpg)
Examples of different environments
Observable
Deterministic
Episodic
Static
Discrete
Single agent
Fully Partially Partially
Deterministic Stochastic Stochastic
Sequential Sequential Sequential
Semidynamic DynamicStatic
Discrete Discrete Continuous
Multi Multi Multi
Fully
Deterministic
Episodic
Static
Discrete
Single
Chess witha clock
Scrabble Autonomous driving
Word jumblesolver
![Page 24: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/24.jpg)
Solving problems by searchingChapter 3
Image source: Wikipedia
![Page 25: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/25.jpg)
Types of agentsReflex agent
• Consider how the world IS• Choose action based on
current percept (and maybe memory or a model of the world’s current state)
• Do not consider the future consequences of their actions
Planning agent
• Consider how the world WOULD BE• Decisions based on (hypothesized)
consequences of actions• Must have a model of how the world
evolves in response to actions• Must formulate a goal (test)
![Page 26: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/26.jpg)
Search
• We will consider the problem of designing goal-based agents in fully observable, deterministic, discrete, known environments
Start state
Goal state
![Page 27: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/27.jpg)
Search
• We will consider the problem of designing goal-based agents in fully observable, deterministic, discrete, known environments – The agent must find a sequence of actions that reaches the goal– The performance measure is defined by (a) reaching the goal
and (b) how “expensive” the path to the goal is– We are focused on the process of finding the solution; while
executing the solution, we assume that the agent can safely ignore its percepts (open-loop system)
![Page 28: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/28.jpg)
Search problem components• Initial state• Actions• Transition model
– What state results fromperforming a given action in a given state?
• Goal state• Path cost
– Assume that it is a sum of nonnegative step costs
• The optimal solution is the sequence of actions that gives the lowest path cost for reaching the goal
Initialstate
Goal state
![Page 29: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/29.jpg)
Example: Romania• On vacation in Romania; currently in Arad• Flight leaves tomorrow from Bucharest
• Initial state– Arad
• Actions– Go from one city to another
• Transition model– If you go from city A to
city B, you end up in city B
• Goal state– Bucharest
• Path cost– Sum of edge costs (total distance
traveled)
![Page 30: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/30.jpg)
State space• The initial state, actions, and transition model
define the state space of the problem– The set of all states reachable from initial state by any
sequence of actions– Can be represented as a directed graph where the
nodes are states and links between nodes are actions
![Page 31: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/31.jpg)
![Page 32: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/32.jpg)
State space• The initial state, actions, and transition model
define the state space of the problem– The set of all states reachable from initial state by any
sequence of actions– Can be represented as a directed graph where the
nodes are states and links between nodes are actions• What is the state space for the Romania problem?
![Page 33: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/33.jpg)
Example: Vacuum world
• States– Agent location and dirt location– How many possible states?
![Page 34: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/34.jpg)
Vacuum world state space graph
![Page 35: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/35.jpg)
Example: Vacuum world
• States– Agent location and dirt location– How many possible states?– What if there are n possible locations?
• The size of the state space grows exponentially with the “size” of the world!
![Page 36: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/36.jpg)
Simplified Pac-Man State Size?
![Page 37: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/37.jpg)
Example: The 8-puzzle• States– Locations of tiles
• 8-puzzle: 181,440 states
• 15-puzzle: ~10 trillion states
• 24-puzzle: ~1025 states
• Actions
–Move blank left, right, up, down
• Path cost
– 1 per move
• Finding the optimal solution of n-Puzzle is NP-hard
![Page 38: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/38.jpg)
Example: Robot motion planning
• States – Real-valued joint parameters (angles, displacements)
• Actions– Continuous motions of robot joints
• Goal state– Configuration in which object is grasped
• Path cost– Time to execute, smoothness of path, etc.
![Page 39: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/39.jpg)
Search• Given:
– Initial state
– Actions
– Transition model
– Goal state
– Path cost
• How do we find the optimal solution?– How about building the state space and then using Dijkstra’s
shortest path algorithm?• Complexity of Dijkstra’s is O(E + V log V), where V is the size of the
state space
• The state space may be huge!
![Page 40: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/40.jpg)
Search: Basic idea
• Let’s begin at the start state and expand it by making a list of all possible successor states
• Maintain a frontier or a list of unexpanded states
• At each step, pick a state from the frontier to expand
• Keep going until you reach a goal state• Try to expand as few states as possible
![Page 41: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/41.jpg)
Search tree• “What if” tree of sequences of actions
and outcomes
• The root node corresponds to the starting state
• The children of a node correspond to the successor states of that node’s state
• A path through the tree corresponds to a sequence of actions– A solution is a path ending in a goal state
• Edges are labeled with actions and costs
… … ……
Starting state
Successor state
Action
Goal state
![Page 42: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/42.jpg)
Tree Search Algorithm Outline
• Initialize the frontier using the start state• While the frontier is not empty– Choose a frontier node to expand according to search strategy
and take it off the frontier– If the node contains the goal state, return solution– Else expand the node and add its children to the frontier
![Page 43: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/43.jpg)
Tree search example
Start: AradGoal: Bucharest
![Page 44: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/44.jpg)
Tree search example
Start: AradGoal: Bucharest
![Page 45: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/45.jpg)
Tree search example
Start: AradGoal: Bucharest
![Page 46: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/46.jpg)
Tree search example
Start: AradGoal: Bucharest
![Page 47: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/47.jpg)
Tree search example
Start: AradGoal: Bucharest
![Page 48: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/48.jpg)
Tree search example
Start: AradGoal: Bucharest
![Page 49: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/49.jpg)
Tree search example
Start: AradGoal: Bucharest
![Page 50: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/50.jpg)
Handling repeated states• Initialize the frontier using the starting state• While the frontier is not empty– Choose a frontier node to expand according to search strategy
and take it off the frontier– If the node contains the goal state, return solution– Else expand the node and add its children to the frontier
• To handle repeated states:– Keep an explored set; which remembers every expanded node– Newly generated nodes already in the explored set or frontier
can be discarded instead of added to the frontier
![Page 51: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/51.jpg)
Search without repeated states
Start: AradGoal: Bucharest
![Page 52: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/52.jpg)
Search without repeated states
Start: AradGoal: Bucharest
![Page 53: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/53.jpg)
Search without repeated states
Start: AradGoal: Bucharest
![Page 54: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/54.jpg)
Search without repeated states
Start: AradGoal: Bucharest
![Page 55: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/55.jpg)
Search without repeated states
Start: AradGoal: Bucharest
![Page 56: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/56.jpg)
Search without repeated states
Start: AradGoal: Bucharest
![Page 57: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/57.jpg)
Search without repeated states
Start: AradGoal: Bucharest
![Page 58: Agents & Search Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649e2d5503460f94b1c65e/html5/thumbnails/58.jpg)
Tree Search Algorithm Outline
• Initialize the frontier using the starting state• While the frontier is not empty– Choose a frontier node to expand according to search strategy
and take it off the frontier– If the node contains the goal state, return solution– Else expand the node and add its children to the frontier
Main question: Which frontier nodes to explore?Idea: Try to expand as few tree nodes as possible in finding goal