Lecture 2 - State Space Search Flashcards
What are the 4 elements to represent the state space problem?
- Initial State
starting state
ex. unsolved puzzle, being at home - Set of operators
actions responsible for transition between states (up, down, etc) - Goal test function
Applied to a state to determine if it is a goal state
ex. solved puzzle, arrived at Concordia - Path cost function
Assigns a cost to a path to tell if a path is preferable to
another
Informed vs Uninformed Search
Uninformed search
We systematically explore the alternatives
aka: systematic/exhaustive/blind/brute force search
Informed search (heuristic search)
We try to choose smartly
DFS vs BFS
Determine order for examining states
Depth-first:
visit successors before siblings
- Uses Stack
Breadth-first:
visit siblings before successors
i.e. visit level-by-level
-Uses Queue
Particularities of BFS:
- WIll always find shortest path
- Inneficient if there’s a high branching factor B
- High memory Requirement - B^n
Particularities of DFS:
Does not guarantee finding the shortest path, but requires less memory
What is Depth-Limited Search?
Compromise for DFS :
Do depth-first but with depth cutoff k (depth at which nodes are not expanded)
What is iterative Deepening?
Compromise between BFS and DFS:
use depth-first search, but
with a maximum depth before going to next level
-Finds the shortest path, and is preferred when there is a large search space
Uniform Cost Search
- Uses a priority queue sorted using hte cost from the root to node n (g(n).
- This will find lowest cost solution path
What is heuristic
Heuristic search:
A technique that improves the efficiency of search,
possibly sacrificing on completeness
Focus on paths that seem most promising according to
some function
Need an evaluation function (heuristic function) to
score a node in the search tree
Heuristic function h(n) = an approximation of the
lowest cost from node n to the goal
What is Hill Climbing
General hill climbing strategy:
as soon as you find a position that is better than the current one, select it.
Does not maintain a list of next nodes to visit (an open list)
Similar to climbing a mountain in the fog with amnesia … always go higher than where you are now,
but never go back…
What is Steepest ascent Hill climbing?
Steepest ascent hill climbing:
instead of moving to the first position that is better than the current one
pick the best position out of all the next possible moves
problems with hill climbing
Foothills (or local maxima)
reached a local maximum, not the global maximum
a state that is better than all its neighbors but is not better
than some other states farther away.
at a local maximum, all moves appear to make things worse.
Plateau
a flat area of the search space in which the next states
have the same value.
it is not possible to determine the best direction in which
to move by making local comparisons.
Some Solutions to hill-climbing
Random-restart hill-climbing
random initial states are generated
run each until it halts or makes no significant progress.
the best result is then chosen.
keep going even if the best successor has the same value as current node
works well on a “shoulder”
but could lead to infinite loop
on a plateau
What is best first search?
The thing about hill-climbing is that it selects one move and forgets the others.
Solution:
- Use open as a priority queue -> this is best first search.
- Insert nodes into an open list so that the nodes are sorted in ascending h(n)
What is manhattan distance?
of moves required for a piece to be at the correct location