CS4700-Search1 v7
CS4700-Search1 v7
Bart Selman
Problem-solving agents
Problem types
Problem formulation
Example problems
Basic search algorithms
Problem-solving agents
More details on “states” soon.
Problem solving agents are goal-directed agents:
Start state
Goal
(reach one in
this set of states)
states? The agent is in one of 8 possible world states.
actions? Left, Right, Suck [simplified: left out No-op]
goal test? No dirt at all locations (i.e., in one of bottom two states).
path cost? 1 per action
Minimum path from Start to Goal state: 3 actions
Alternative, longer plan: 4 actions
Note: path with thousands of steps before reaching goal also exists.
Example: The 8-puzzle
“sliding tile puzzle”
Aside:
variations
on goal state.
eg empty square
bottom right or
in middle.
etc.
4 17 boards farthest away from goal state (80 moves)
1
13
<2
,5,
6 >
?
<15,12,11>/
<9,10,14>
?
What is
?
it about
these 17
Each require 80 moves to reach:
boards
out of Intriguing similarities. Each number
over 10 has its own few locations. <3 ,
trillion? Interesting machine learning task: 7,8>
Learn to recognize the hardest boards!
(Extremal Combinatorics, e.g. LeBras, Gomes, and Selman AAAI-12)
17 boards farthest away from goal state (80 moves)
Thanks to Jonathan GS
A few urls:
Aside: in this
tree, immediate
duplicates are
removed.
Goal
A breadth-first search tree. (More detail soon.)
Really only barely feasible on compute cluster with lots of memory and
compute time. (Raw numbers for 24 puzzle, truly infeasible.)
Can we avoid generating all these boards? Do with much less search?
(Key: bring average branching factor down.)
Gedanken experiment: Assume that you knew for each state, the minimum
number of moves to the final goal state. (Table too big, but assume there is
some formula/algorithm based on the board pattern that gives this number
for each board and quickly.)
d >= 4 Select
d=3 d >= 3
d=2
Select
dSelect
=1
Select
d = 0 d >= 1
Goal
A breadth-first search tree. (More detail soon.)
We may not have the exact distance function (“perfect heuristics”), but
we can still “guide” the search using an approximate distance function.
Reinforcement learning:
Learn the state eval function.
Goal
A breadth-first search tree.
Perfect “heuristics,” eliminates search.
Approximate heuristics, significantly reduces search.
Best (provably) use of search heuristic info: A* search (soon).
General question: Given a state space,
how good a heuristics can we find?
State evaluation functions
or “heuristics”
Provide guidance in terms of what action to take next.
Because eval function is often only an estimate of the true state value,
greedy search may not find the optimum path to the goal.
1) Manhattan Distance: For each tile the number of grid units between its
current location and its goal location are counted and the values for all
tiles are summed up. (underestimate; too “loose”; not very powerful)
Protein design: sequence of amino acids that will fold into the 3-
dimensional protein with the right properties.
Basic idea:
simulated exploration of state space by generating successors of already-
explored states (a.k.a. ~ expanding states)
–
Added to tree.
The Expand function creates new nodes, filling in the various fields
and using the SuccessorFn of the problem to create the
corresponding states.
Fringe is the collection of nodes that have been generated but not (yet)
expanded. Each node of the fringe is a leaf node.
Implementation: general tree search
Search strategies
– Breadth-first search
– Uniform-cost search
– Depth-first search
– Depth-limited search
– Iterative deepening search
– Bidirectional search
–
Key issue: type of queue used for the fringe of the search tree
(collection of tree nodes that have been generated but not yet
expanded)
Breadth-first search
Expand shallowest unexpanded node.
Implementation:
– fringe is a FIFO queue, i.e., new nodesqueue:
Fringe go at end<A>
– (First In First Out queue.)
Select A from
queue and expand.
Gives
<B, C>
Queue: <B, C>
Select B from
front, and expand.
Gives
<C, D, E>
Fringe queue: <C, D, E>
Fringe queue: <D, E, F, G>
Implementation:
– fringe = LIFO queue, i.e., put successors at front (“push on stack”)
– Last In First Out
Fringe stack:
A
Expanding A,
gives stack:
B
C
So, B next.
Expanding B,
gives stack:
D
E
C
So, D next.
Expanding D,
gives stack:
H
I
E
C
So, H next.
etc.
What is main advantage over breadth first search?
“Anytime” nature.
Iterative deepening search
Number of nodes generated in an iterative deepening search to depth
d with branching factor b:
Looks quite wasteful, is it?
NIDS = d b1 + (d-1)b2 + … + 3bd-2 +2bd-1 + 1bd
Complete? Yes
(b finite)
Space? O(bd)
• Checking a node for membership in the other search tree can be done in constant
time (hash table)
• Key limitations:
Space O(bd/2)
Also, how to search backwards can be an issue (e.g., in Chess)? What’s tricky?
Problem: lots of states satisfy the goal; don’t know which one is relevant.
Iterative deepening search uses only linear space and not much more time
than other uninformed algorithms.