State Space Search 1/25/16 Reading Quiz Q1: What is the forward - - PowerPoint PPT Presentation
State Space Search 1/25/16 Reading Quiz Q1: What is the forward - - PowerPoint PPT Presentation
State Space Search 1/25/16 Reading Quiz Q1: What is the forward branching factor of a node in a search graph? a) The number of paths from the start to the node. b) The number of paths from the node to the goal. c) The number of edges
Reading Quiz
Q1: What is the forward branching factor of a node in a search graph? a) The number of paths from the start to the node. b) The number of paths from the node to the goal. c) The number of edges terminating at the node. d) The number of edges originating at the node
When is state space search applicable?
- The world can be described by discrete states.
- The environment is fully observable and deterministic.
- The agent’s objective is to reach some goal state.
The key idea
- Embed states of the world in a graph, where:
○ Each node contains one state. ○ A directed edge (A,B) indicates that some action by the agent can transition the world from state A to state B.
- The agent can then search for a path in the graph from start to goal.
- The sequence of actions along the path constitutes a plan the agent can
execute to achieve its goal.
Some important distinctions
- States and nodes are not completely synonymous.
○ A state is a configuration of the world. ○ A node is a data structure. It contains a state, a parent pointer or other connection information, and possibly additional bookkeeping.
- Likewise, actions and edges are related but not identical.
- Start is a state; goal is a proposition.
○ The agent has a fixed start state. ○ There may be many states that achieve the goal. We describe this with a function.
Example: robot navigation
- The state must describe the robot’s location.
○ The state might also need to track package locations, etc. ○ The state may ignore some information (e.g. o105-o107)
- The robot can drive to nearby locations.
○ States between which the robot can drive directly are connected in the search graph.
- We need a start state: o103
- We need a goal function: state == storage
note: this graph is incomplete
Exercise: describe the search space.
- What is the start state?
- What states is it adjacent to?
- What states are those states adjacent to?
○ Start drawing the graph.
- What is the goal function?
- Do we need to track any additional information?
Example: traffic jam puzzle
start state
- ne of many states
satisfying the goal proposition
Next states reachable in
- ne move from
the start state
Exercise: model this as a search problem.
- We are given a 3-quart and 4-quart pitcher.
- The pitchers have no markings that show partial quantities.
- Either pitcher can be filled from a faucet.
- The contents of either pitcher can be poured down a drain.
- Water may be poured from one pitcher to the other until either the pouring
pitcher is empty or the receiving pitcher is full.
- We want to measure 2 quarts of water.
Describe the state representation. How many total states are there? What is the start state? What are its neighbors? Draw a little bit of the graph. How can we recognize a goal state?
Generic search algorithm
add start to frontier add start to parents while frontier not empty and goal not found get state from frontier add state to walls or free if state is free add state to parents add neighbors of state to frontier end if end while Procedure Search(G,S,goal) Inputs G: graph with nodes N and arcs A S: set of start nodes goal: Boolean function of states Output path from a member of S to a node for which goal is true
- r ⊥ if there are no solution paths
Local Frontier: set of paths Frontier ←{⟨s⟩: s∈S} while (Frontier ≠{}) select and remove ⟨s0,...,sk⟩ from Frontier if ( goal(sk)) then return ⟨s0,...,sk⟩ Frontier ←Frontier ∪{⟨s0,...,sk,s⟩: ⟨sk,s⟩∈A} return ⊥
The rest of this week (and the rest of chapter 3)
select and remove ⟨s0,...,sk⟩ from Frontier
- A FIFO frontier gives breadth-first search.
- A LIFO frontier gives depth-first search.
- A priority queue frontier allows more sophisticated searches.
What is an appropriate metric to use for “priority”? What characteristics of the search are we trying to optimize?
Generic search algorithm
Procedure Search(G,S,goal) Inputs G: graph with nodes N and arcs A S: set of start nodes goal: Boolean function of states Output path from a member of S to a node for which goal is true
- r ⊥ if there are no solution paths
Local Frontier: set of paths Frontier ←{⟨s⟩: s∈S} while (Frontier ≠{}) select and remove ⟨s0,...,sk⟩ from Frontier if ( goal(sk)) then return ⟨s0,...,sk⟩ Frontier ←Frontier ∪{⟨s0,...,sk,s⟩: ⟨sk,s⟩∈A} return ⊥