CSM6120 Introduction To Intelligent Systems: Informed Search
CSM6120 Introduction To Intelligent Systems: Informed Search
CSM6120 Introduction To Intelligent Systems: Informed Search
Informed search
[email protected]
Quick review
Problem definition
Initial state, goal state, state space, actions, goal function, path
cost function
Factors
Branching factor, depth of shallowest solution, maximum depth
of any path in search state, complexity, etc.
Uninformed techniques
BFS, DFS, Depth-limited, UCS, IDS
Informed search
What we’ll look at:
Heuristics
Hill-climbing
Best-first search
Greedy search
A* search
Heuristics
A heuristic is a rule or principle used to guide a search
It provides a way of giving additional knowledge of the problem
to the search algorithm
Must provide a reasonably reliable estimate of how far a state
is from a goal, or the cost of reaching the goal via that state
0 1 2
3 4 5
6 7
The 8-puzzle
Using a heuristic evaluation function:
h2(n) = sum of the distance each tile is from its goal position
Goal state
0 1 2
3 4 5
6 7
Current state Current state
0 1 2 0 2 5
3 4 5 3 1 7
6 7 6 4
h1=1 h1=5
h2=1 h2=1+1+1+2+2=7
Search algorithms
Hill climbing
Best-first search
Greedy best-first search
A*
Iterative improvement
Consider all states laid out on the surface of a landscape
Plateau
Area of state space where the evaluation function is essentially
flat
The search will conduct a random walk
Ridges
Causes problems when states along the ridge are not directly
connected - the only choice at each point on the ridge
requires uphill (downhill) movement
Best-first search
Like hill climbing, but eventually tries all paths as it uses
list of nodes yet to be explored
Implementation
Expand the “most desirable” node into the frontier queue
Sort the queue in decreasing order
Route planning: heuristic??
Route planning - GBFS
Greedy best-first search
Route planning
Greedy best-first search
Greedy best-first search
Optimal
No! (A – S – F – B = 450, shorter journey is possible)
A* search
A* (A star) is the most widely known form of Best-First
search
It evaluates nodes by combining g(n) and h(n) start
where n
goal
A* search
When h(n) = h*(n) (h*(n) is actual cost to goal)
Only nodes in the correct path are expanded
Optimal solution is found
Time complexity
Exponential in [relative error of h x length of solution]
The better the heuristic, the better the time
Best case h is perfect, O(d)
Worst case h = 0, O(bd) same as BFS, UCS
Space complexity
Keeps all nodes in memory and save in case of repetition
This is O(bd) or worse
A* usually runs out of space before it runs out of time
A* exercise
Hence f(G2) > f(n), and A* will never select G2 for expansion
Heuristic functions
Admissible heuristic example: for the 8-puzzle
h1(S) = ??
h2(S) = ??
Heuristic functions
Admissible heuristic example: for the 8-puzzle
h1(S) = 6
h2(S) = 4+0+3+3+1+0+2+1
= 14
Heuristic functions
Dominance/Informedness
if h2(n) h1(n) for all n (both admissible)
then h2 dominates h1 and is better for search
h1(S) = 6
h2(S) = 4+0+3+3+1+0+2+1
= 14
Relaxed problems
Admissible heuristics can be derived from the exact
solution cost of a relaxed version of the problem
E.g. If the rules of the 8-puzzle are relaxed so that a tile can
move anywhere, then h1(n) gives the shortest solution
If the rules are relaxed so that a tile can move to any adjacent
square, then h2(n) gives the shortest solution