0% found this document useful (0 votes)
5 views42 pages

Lec04 Search Intro

Chapter 3 discusses problem-solving through search in goal-based agents within fully observable, deterministic environments. It outlines the components of search problems including initial state, actions, transition model, goal state, and path cost, and provides examples such as the Romania problem and the 8-puzzle. The chapter emphasizes the importance of constructing a search tree and handling repeated states to find optimal solutions efficiently.

Uploaded by

promhkl2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views42 pages

Lec04 Search Intro

Chapter 3 discusses problem-solving through search in goal-based agents within fully observable, deterministic environments. It outlines the components of search problems including initial state, actions, transition model, goal state, and path cost, and provides examples such as the Romania problem and the 8-puzzle. The chapter emphasizes the importance of constructing a search tree and handling repeated states to find optimal solutions efficiently.

Uploaded by

promhkl2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Solving problems by searching

Chapter 3
Types of agents
Reflex agent Planning agent

• Consider how the world IS • Consider how the world WOULD BE


• Choose action based on • Decisions based on (hypothesized)
current percept consequences of actions
• Do not consider the future • Must have a model of how the world
evolves in response to actions
consequences of actions
• Must formulate a goal
Source: D. Klein, P. Abbeel
Search
• We will consider the problem of designing goal-based
agents in fully observable, deterministic, discrete, known
environments

Start state

Goal state
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)
Search problem components
• Initial state Initial
state
• Actions
• Transition model
– What state results from
performing a given action
in a given state?
• Goal state
• Path cost
– Assume that it is a sum of Goal
nonnegative step costs state

• The optimal solution is the sequence of actions that gives the


lowest path cost for reaching the goal
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)
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?
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!
• Actions
– Left, right, suck
• Transition model
Vacuum world state space graph
Example: The 8-puzzle
• States
– Locations of tiles
• 8-puzzle: 181,440 states (9!/2)
• 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


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.
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!
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
Search: Basic idea

start
Search: Basic idea
Search: Basic idea
Search: Basic idea
Search: Basic idea
Search: Basic idea
Search: Basic idea
Search: Basic idea
Search: Basic idea
Search: Basic idea
Search: Basic idea
Search: Basic idea
Search tree
• “What if” tree of sequences of actions and
outcomes Starting
state
– When we are searching, we are not acting in the
world, merely “thinking” about the possibilities Action
• The root node corresponds to the starting state Successor
• The children of a node correspond to the state
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 the goal state
• Nodes vs. states

– A state is a representation of the world, Frontier
while a node is a data structure that is
part of the search tree Goal
• Node has to keep pointer to parent, path cost, state
possibly other info
Tree Search Algorithm Outline
• Initialize the frontier using the starting state
• While the frontier is not empty
– Choose a frontier node 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
Tree search example

Start: Arad
Goal: Bucharest
Tree search example

Start: Arad
Goal: Bucharest
Tree search example

Start: Arad
Goal: Bucharest
Tree search example

Start: Arad
Goal: Bucharest
Tree search example

Start: Arad
Goal: Bucharest
Tree search example

Start: Arad
Goal: Bucharest
Tree search example

Start: Arad
Goal: Bucharest
Handling repeated states
• Initialize the frontier using the starting state
• While the frontier is not empty
– Choose a frontier node 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:


– Every time you expand a node, add that state to the
explored set; do not put explored states on the frontier again
– Every time you add a node to the frontier, check whether it
already exists in the frontier with a higher path cost, and if yes,
replace that node with the new one
Search without repeated states

Start: Arad
Goal: Bucharest
Search without repeated states

140 118 75

Start: Arad
Goal: Bucharest
Search without repeated states

118 75

280 239 291 220

Start: Arad
Goal: Bucharest
Search without repeated states

118 75

280 239 291

366 317 300

Start: Arad
Goal: Bucharest
Search without repeated states

118 75

280 291

338 450 366 317 300

Start: Arad
Goal: Bucharest
Search without repeated states

118 75

280 291

338 450 366 300

418 455 414

Start: Arad
Goal: Bucharest
Search without repeated states

118 75

280 291

338 450 366 300

418 455 414

Start: Arad
Goal: Bucharest

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy