AI - Informed Search - Lecture 7, 8
AI - Informed Search - Lecture 7, 8
AI - Informed Search - Lecture 7, 8
INTELLIGENC
E
Review of Last Lecture
5
• Blind search:
• Search the solution space in an uninformed manner
•They simply march through the search space until a solution is found.
• Costly with respect time, space or both
• Informed search.
• Search the solution space in informed manner -> HEURISTIC
SEARCH
• Don’t try to explore all possible search path, rather focus on
the path which get you closer to the goal state using some
kind of a
“ GUIDE”.
• A heuristic search makes use of available information in making the
search more efficient.
6
HEURISTIC SEARCH
•Heuristics:
• Rules for choosing the branches in a state space that are
•most likely to lead to an acceptable problem solution.
•Used when:
• Computational costs are high E.g. Chess
•But, Heuristics are fallible. They can lead a search algorithm to a suboptimal
solution or fail to find a solution at all.
7
(1) if you saw that there was a checkout with only one person in that queue but that
the person currently at the checkout had three trolleys full of shopping
(2) that at the fast- checkout all the people had only one item, you may choose to go
(3) you don't go to a checkout that doesn't have a cashier - it may have the shortest
A 5 B 3 C 2
S 6
G
3 3
D 4 E F
Heuristic search: road
map
The number show 3
the distance b/w two
3
cities
2
A B C
S 4 4
G
3
2
D 1 E 3 F
Best First Search
B: C:
5 3
D:4 E: F:
2 6
G:0
Solution
25
Hill Climbing:
If the Node is better in terms of assigned heuristics, only then you proceed
to
that Node
Algorithm:
1. Start with current-state (cs) = initial state
2. Until cs = goal-state or there is no change in the cs
do:
maximum.
2. Plateaus: An area of the (c)
search
• space where evaluation
function
•is Figure 5.9 Local maxima, Plateaus and
ridge situation for Hill
• flat, thus requiring random Climbing
walk.
Optimal searches
• We have covered informed and uninformed
searches.
• Bothe have some advantages and
disadvantages.
• One common lacks in both:
• Immediately stop when find a solution
• Don’t look for an optimal solution
• Optimal search:
• Find all the possible solution using
either blind/heuristic
search.
• Choose the most optimal amongst
Branch and Bound (B& B)
• Some how related to heuristic search.
• Cut of the unnecessary search.
3 A 6 E 1
2 4
S D G
4 3
B
2
8 5
C
Branch and Bound
3 4 8
A B C
11
5 B 10 G
9
E D
7
6
8 D D
A
D D D E E G C 9
10 12 12 12 11 11
Branch and bound
• Some how related to heuristic search.
• Cut of the unnecessary search.
D
A
E
B 9
9 F G
30
. Branch and bound
The no show the distance b/w two cities
•.
3
2
A B
3
C
S 4 4
G
3
2
D 1 E 3 F
A
*•
A* (pronounced "A star") is a best-first, graph
search algorithm that finds the least-cost path
from a given initial node to one goal node (out
of one or more possible goals).
• Improve version of branch and bound.
• Uses a distance-plus-cost heuristic function
(usually denoted f(x)) to determine the order in
which the search visits nodes in the tree.
• Initially called algorithm A. Since using this
algorithm yields optimal behavior for a given
heuristic, it has been called A*.
Distance-Plus-Cost Heuristics function
• The distance-plus-cost heuristic is a sum of two functions:
• The path-cost function (usually denoted g(x)): cost from the starting
node to the current node.
• A heuristic estimate of the distance to the goal (usually denoted
h(x)).
• Total Cost: f(x) = g(x) + h(x)
A* Search
Algorithm
• At every step, take node n from the front of the queue
• Enqueue all its successors n" with priorities:
• f(n") = g(n") + h(n")
= cost of getting to n" + estimated cost from n" to goal
• Terminate when a goal state is popped from the queue.
A* Search
. The Algorithm
no show the distance b/w two cities
•. And the color no shows the under estimated
distance between that particular node and
the goal 2
node. 3
3 3
A B C 5
2
8
S 4 4
0 G
3 5 2
2
6 D E F
42
Examples of
Heuristics
43
Last Solution