Informed Search Strategies Tutorial Informed Search Strategies 8-Puzzle Problem Heuristics for 8-puzzle These heuristics were obtained by relaxing constraints … (Explain !!!) • h1: The.

Download Report

Transcript Informed Search Strategies Tutorial Informed Search Strategies 8-Puzzle Problem Heuristics for 8-puzzle These heuristics were obtained by relaxing constraints … (Explain !!!) • h1: The.

Informed Search Strategies
Tutorial
Informed Search Strategies
8-Puzzle Problem
Heuristics for 8-puzzle
These heuristics were obtained by relaxing
constraints … (Explain !!!)
• h1: The number of misplaced tiles
(squares with number).
• h2: The sum of the distances of the tiles
from their goal positions.
Heuristics for 8-puzzle I
Current
State
•The number of
misplaced tiles
(not including
the blank)
Goal
State
1
4
7
2
5
1
4
2
5
7
8
3
6
8
3
6
11 22 33
44 55 66
77 8
8
In this case, only “8” is misplaced, so the heuristic
function evaluates to 1.
N
N
N
N
In other words, the heuristic is telling us, that it thinks a
N
Y
solution might be available in just 1 more move.
Notation: h(n)
h(current state) = 1
N
N
Heuristics for 8-puzzle II
Current
State
•The Manhattan
Distance (not
including the
blank)
Goal
State
3
4
7
1
4
7
2
5
1
2
5
8
8
6
In other words, the heuristic is telling us, that it thinks a
solution is available in just 8 more moves.
h(current state) = 8
3
2 spaces
8
3
6
In this case, only the “3”, “8” and “1” tiles are
misplaced, by 2, 3, and 3 squares respectively, so
the heuristic function evaluates to 8.
Notation: h(n)
3
3 spaces
8
1
3 spaces
1
Total 8
Greedy Search
(with systematic checking of repeated states)
8-Puzzle with h2()
h2(): Manhattan Distance
8-Puzzle Problem
• Solve the following 8-puzzle problem using
Greedy search algorithm as search strategy
and Manhattan distance as heuristic.
1
2
3
1
2
3
4
8
5
4
5
6
7
6
7
8
Greedy Search
(with systematic checking of repeated states)
8-Puzzle with h1()
h1(): the number of misplaced tiles
8-Puzzle Problem
• Solve the following 8-puzzle problem using
Greedy search algorithm as search strategy
and h1() as heuristic.
1
2
3
1
2
3
4
8
5
4
5
6
7
6
7
8
A* Search
(with systematic checking of repeated states)
8-Puzzle with h1()
h1(): the number of misplaced tiles
8-Puzzle Problem
• Solve the following 8-puzzle problem using A* search
algorithm as search strategy and the following
function f(n) as heuristic: f(n)=g(n)+h(n)
– h(n):the number of misplaced tiles
– g(n):the number of steps from the initial state
2
8
3
1
1
6
4
8
7
5
7
2
3
4
6
5
A* Search
(with systematic checking of repeated states)
8-Puzzle with h2()
h2(): Manhattan Distance
8-Puzzle Problem
• Solve the following 8-puzzle problem using A* search
algorithm as search strategy and the following
function f(n) as heuristic: f(n)=g(n)+h(n)
– h(n):the Manhattan Distance
– g(n):the number of steps from the initial state
2
8
3
1
1
6
4
8
7
5
7
2
3
4
6
5
IDA* Search
8-Puzzle with h1()
h1(n): the number of misplaced tiles
8-Puzzle Problem
• Solve the following 8-puzzle problem using IDA*
search algorithm as search strategy and the following
function f(n) as heuristic: f(n)=g(n)+h(n)
– h(n):the number of misplaced tiles
– g(n):the number of steps from the initial state
2
8
3
1
1
6
4
8
5
7
7
2
3
4
6
5
Informed Search Strategies
Maze Traversal
Maze Traversal
• Consider the Maze Traversal Problem:
1
2
A
3
4
Start
B
C
D
End
Maze Traversal
•
Give a formulation for this problem
•
Solve this problem by using:
1.
Greedy search technique with Manhattan distance as
heuristic.
2.
A* Algorithm and Manhattan distance as heuristic.
3.
propose another heuristic h().
Maze Traversal
•
Consider the following problem:
A
B
C
D
E
1
•
2
3
4
5
Where A3 is the Starting node and E2 the End
node.
Maze Traversal
•
Solve this problem by using:
1. Greedy search technique with Manhattan
distance as heuristic.
2. A* Algorithm and Manhattan distance as
heuristic.
3. IDA* Algorithm and Manhattan distance as
heuristic.
MAP Searching
• Consider the following Map:
110
85
90
155
120
200
270
320
365
255
185
240
140
410
180
410
200
435
210
Map Searching
• SLD heuristic: h()
Straight Line Distance
between any city and
the End city Munchen
• Is h() admissible ?
City
h()
Munchen
0
Hamburg
720
Kiel
750
Rostock
740
Schwerin
680
Berlin
590
Leipzig
410
Dresden
400
Hannover
610
Bremen
720
Dusserldorf
540
Bonn
480
Stuttgart
180
Frankfurt
380
Map searching
We wish to move from Hannover to
Munchen, solve this problem using:
1. Greedy search with SLD heuristic
2. A* algorithm with SLD heuristic