Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
INTELLIGENT SYSTEMS
INFORMED SEARCH
SLIDE 2 OF 9 2
SLIDE ‹#› OF 9 3
Heuristics
To do this, we use heuristics (informed guesses)
Heuristic means “serving to aid discovery”
Can find solutions more efficiently than can an uninformed search
The Heuristic is any device that is often effective but will not
guarantee work in every case
Try to explore the promising paths before the less promising path.
Evaluation function: scores a node in the search tree according to
how close to the target state it seems to be(will just be a guess but
should b helpful)
Heuristic search
Example: 8 Puzzle
1 2 3 1 2 3
7 8 4 8 4
6 5 7 6 5
Heuristic search
1 2 3 GOAL 1 2 3
8 4 7 8 4
7 6 5 6 5
up
left right
1 2 3 1 2 3 1 2 3
7 8 4 7 8 4 7 4
6 5 6 5 6 8 5
1 2 3
Current
State 4 5 6
7 8 N N N
• The number
of misplaced N N N
1 2 3
tiles (not Goal N Y
including the State 4 5 6
blank) 7 8
14
Generate-and-Test
Example - Traveling Salesman
Problem (TSP)
• Traveler needs to visit n cities.
• Know the distance between each pair of cities.
• Want to know the shortest route that visits all the cities
once.
• n=80 will take millions of years to solve exhaustively!
SLIDE 15 OF 9
Generate-and-Test
TSP Example
From A to C
ABC =
ADC =
A B
ABDC =
6 ADBC
AC =
1 2
5 3
D 4 C
Best-first search
Uses a list of nodes that are to be further explored.
Always removes the best node from the list i.e. the one
with the best score.
The successors of the best node will be evaluated and will
be added to the list.
Uses a priority queue rather than a stack or simple queue.
This can be achieved by applying appropriate Heuristic
function to each of them.
Best-first search
Heuristic function: f(n) = h(n)
where,
h(n) - estimated straight line distance from node n to goal
To implement the graph search procedure ,we will need to
use two list of nodes.
OPEN- nodes that have been generated but have not been
visited yet
Closed - nodes that have been already visited
SLIDE 19 OF 9 19
Best-first search
Example
SLIDE 20 OF 9 20
Best-first search
Example
SLIDE 21 OF 9 21
Best-first search
Example
SLIDE 22 OF 9 22
Hill Climbing
Very simple idea: Start from some state s,
Move to a neighbor t with better score. Repeat.
Question: what’s a neighbor?
◦ You have to define that!
◦ The neighborhood of a state is the set of neighbors
◦ Also called ‘move set’
Hill Climbing
Example: N-queen (one queen per column). One possibility
◦ Pick the right-most most-conflicting column;
◦ Move the queen in that column vertically to a different location
Hill Climbing
Basic idea: always head towards a state which is better than
the current one.
Example: if you are at town A and you can get to town B and town C
(and your target is town D) then you should make a move IF town B
or C appear nearer to town D than town A does.
Plateau
A flat area of the search space in which all neighbouring states have the same
value.
Limitations of Hill Climbing
Ridge
It is a special kind of local maximum.
It is an area of the search space which is higher than the surrounding areas
and that itself has a slope.
We cannot travel the ridge by single moves as the orientation of the high
region compared to the set of available moves makes it impossible.
Solution to the problem
◦ Trying different paths at the same time is a solution. We can apply two or more rules
before doing the test. This corresponds to moving in several directions at once.
Variation of Simple Hill Climbing
Steepest-Ascent Hill climbing : It first examines all the neighboring nodes and
then selects the node closest to the solution state as next node.
Stochastic hill climbing : It does not examine all the neighboring nodes before
deciding which node to select. It just selects a neighboring node at random,
and decides (based on the amount of improvement in that neighbor) whether
to move to that neighbor or to examine another.
First-choice hill climbing: Generates successors randomly until one is
generated that is better than current state. This is a good strategy when a state
may have hundreds or thousands of successor states.
Random-restart Hill-climbing: If you don’t succeed the first time, try, try again.
If the first hill-climbing attempt doesn’t work, try again and again and again!
That is, generate random initial states and perform hill-climbing again and
again.
31