Artificial Intelligence Unit IV
Artificial Intelligence Unit IV
Artificial Intelligence Unit IV
Unit IV
Problem Solving
In problem solving, we sometimes have
to search through many possible ways.
We may know all the possible actions
our robot can do, but we have to
consider various sequences to find a
sequence of action to achieve a goal.
We may know all possible moves in
chess game, but we must consider
many possibilities to find a good move.
Effectiveness of Search
The effectiveness of search can be
measured in at least three ways:
Does it finds solution at all.
Is it an optimal solution(with low
cost)?
What is the search cost associated
with the time and memory required
to find a solution?
Goal State(s)
a goal is defined as a desirable state for an agent
there may be many states which satisfy the goal test
e.g., drive to a town with a ski-resort
Tic-Tac-Toe
Tic-Tac-Toe
Uninformed Search
Also known as BLIND SEARCH.
Uninformed search has no
information about the number of
steps or the path costs from the
current state to the goal.
They can only distinguish a goal
state from a non-goal state.
There is no bias to go to go towards
the desire goal.
Uninformed Search
Breadth-First-Search
Depth-First-Search
Uniform-Search
Iterative Deepening Search
Bi-Directional Search
Uninformed Search
Breadth-First-Search
Depth-First-Search
Uniform-Search
Iterative-Deepening-Search
Bi-Directional Search
C
D
E
B
G
D
S
C
F
C
Time Complexity
assume (worst case) that there is 1
goal leaf at the RHS at depth d
so BFS will generate
= b + b2+ ..... + bd + bd+1 - b
= O (bd+1)
d=0
d=1
d=2
G
Space Complexity
how many nodes can be in the queue
(worst-case)?
at depth d there are bd+1 unexpanded
nodes in the Q = O (bd+1)
d=0
d=1
G
d=2
Depth-First-Search
Depth-First-Search
Depth-First-Search
Depth-First-Search
Depth-First-Search
Depth-First-Search
Depth-First-Search
Depth-First-Search
Depth-First-Search
BFS vs DFS
Iterative Deepening
Search
It is similar to the DFS but chooses
the best depth limit.
It tries all possible depth limits: first
depth 0, then depth 1, then depth 2
and so on.
Linear memory requirement of depth
first search.
Guarantee for goal node of minimal
depth.
Iterative Deepening
Search
Iterative Deepening
Search
Iterative Deepening
Search
Iterative Deepening
Search
Iterative Deepening
Search
Iterative Deepening
Search
Bidirectional Search
Run two simultaneous search.
One forward from initial state and
other backward from goal-hoping
that two searches meet in the
middle.
For problems where branching factor
is b and the solution is in depth d,
the solution is found after half step of
depth first.
Bidirectional Search
Bidirectional Search
Bidirectional Search
The time and space complexity for
Bidirectional search is O(bd/2).
Complete : Yes
Optimal : Yes
Informed Search
Strategies
Here we see how information about
the state space can prevent
algorithms from blundering about in
the dark.
Also known as Heuristic Search.
Informed Search
Strategies
Hill-Climbing.
BestFirst Search.
Greedy-Best-First Search.
A* Search.
IDA* Search.
Local-Beam Search
Informed Search
Strategies
Hill-Climbing.
BestFirst Search.
Greedy-Best-First Search.
A* Search.
IDA* Search.
Local-Beam Search.
Heuristic Function
The word Heuristic is derived from the
Greek verb heuriskein, meaning to
find or to discover.
A heuristic function at a node n is an
estimate of the optimum cost from the
current node to a goal.
Denoted by h(n).
h(n)= Estimated cost of the cheapest
path from node n to goal node.
Heuristic Function
Heuristic Function = Cost from start
state to current state + Estimated
distance from the goal.
Heuristic Function
8-Puzzle
8-Puzzle
8-Puzzle
8-Puzzle
In this case only the 3 ,8 and 1
tiles are misplaced by 2, 3 and 3
space respectively.
So, the heuristic function evaluates
to 8.
In other words the heuristic is telling
us, that it thinks a solution is
available in just 8 more moves.
h(n)=8.
A*
A* include in its evaluation function the cost
from the start node to the current node, in
addition to the estimated cost from the
current node to the goal.
Evaluation function: f(n)=g(n)+h(n).
Where,
g(n) = cost so for to reach n.
h(n) =Estimated cost to goal from n.
f(n) =Estimated total cost of path from the
starting node n0 through n to goal.
A*
A*
A*
A*
A*
A*
A*
A*
A*
A*
Optimality of A*
Optimality of A*
Optimality of A*
Iterative Deepening A*
Like Iterative Deepening Depth-First, but depth
bound modified to be an f-Limit.
Start with F-Limit= f(Start).
Prune any node if f(Node)>F-Limit.
Next F-Limit=min-cost of any node pruned.
If this Search does not succeed, determine the
lowest f-Limit among the nodes that were visited
but not expanded.
Use this f-Limit as the new limit value-cut off value
and do another depth first search.
Repeated this procedure Until a goal node is found.
Iterative Deepening A*
Iterative Deepening A*
Iterative Deepening A*
Iterative Deepening A*
Iterative Deepening A*
Iterative Deepening A*
Iterative Deepening A*
Iterative Deepening A*
Iterative Deepening A*
Iterative Deepening A*
Iterative Deepening A*
Iterative Deepening A*
Iterative Deepening A*
Iterative Deepening A*
IDA*