Vous êtes sur la page 1sur 11

MAP ENGLAND

London (A)

Reading (B)

Northampton (F)

Swindon (E)

Gloucester (H)

Birmingham (K)

Peterborough (G)

Louth (J)

Leicester (I)

Derby (E)

Telford (O)

Stoke-on Trent (R)

Liverpool (U)

Chelmsford (D)

Luton (C)

Manchester (V)

Nottingham (M)

Grimsby (N)

Sutton-in-Ashfield (P)

Hull (Q)

Leeds (S)

Wetherby (T)

Darlington (W)

Middlesbrough (X)

Sunderland (Z)
Preston (Y)

A
I) Complete Search Tree
C

B
E
H

G
C

K
Q

O
R

L
X

N
I

W
Z

II) -Breath First Search (BFS)


Evaluation
Node

Opened

A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U

[A]
[B, C, D]
[C, D, E]
[D, E, F, G]
[E, F, G]
[[F, G, H]
[G, H, I]
[H, I, J]
[I, J, K]
[J, K, L, M]
[K, L, M, N]
[L, M, N, O]
[M, N, O, P]
[N, O, P]
[O,P, Q]
[P, Q, R]
[Q, R, S]
[R, S, T]
[S, T, U, V]
[T, U, V, W]
[U, V, W, X]
[V, W, X, Y]

[W, X, Y]

[X, Y, Z]

[Y, Z]

[Z]

[]

Closed
[]
[A]
[A, B]
[A, B, C]
[A, B, C, D]
[A, B, C, D, E]
[A, B, C, D, E, F]
[A, B, C, D, E, F, G]
[A, B, C, D, E, F, G, H]
[A, B, C, D, E, F, G, H, I]
[A, B, C, D, E, F, G, H, I, J]
[A, B, C, D, E, F, G, H, I, J, K]
[A, B, C, D, E, F, G, H, I, J, K, L]
[A, B, C, D, E, F, G, H, I, J, K, L, M]
[A, B, C, D, E, F, G, H, I, J, K, L, M, N]
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O]
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P]
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q]
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R]
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S]
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T]
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T,
U]
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T,
U, V]
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T,
U, V, W]
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T,
U, V, W, X]
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T,
U, V, W, X, Y]
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T,
U, V, W, X, Y, Z]

Reach the goal which is Z.

- Depth First Search (DFS)


Evaluation
Node
A
B
E
H
K
O
R
U
Y
V
C
F
I
L
P
S
W
Z

Opened
[A]
[B, C, D]
[E, C, D]
[H, C, D]
[K, C, D]
[O, C, D]
[R, U, D]
[U, V, C, D]
[Y, V, C, D]
[V, C, D]
[C, D]
[F, G, D]
[I, G, D]
[L, M, G, D]
[P, M, G, D]
[S, M, G, D]
[W, M, G, D]
[Z, M, G, D]
[M, G, D]

Closed
[]
[A]
[A, B]
[A, B, E]
[A, B, E, H]
[A, B, E, H, K]
[A, B, E, H, K, O]
[A, B, E, H, K, O, R]
[A, B, E, H, K, O, R, U]
[A, B, E, H, K, O, R, U, Y]
[A, B, E, H, K, O, R, U, Y, V]
[A, B, E, H, K, O, R, U, Y, V, C]
[A, B, E, H, K, O, R, U, Y, V, C, F]
[A, B, E, H, K, O, R, U, Y, V, C, F, I]
[A, B, E, H, K, O, R, U, Y, V, C, F, I, L]
[A, B, E, H, K, O, R, U, Y, V, C, F, I, L, P]
[A, B, E, H, K, O, R, U, Y, V, C, F, I, L, P, S]
[A, B, E, H, K, O, R, U, Y, V, C, F, I, L, P, S, W]
[A, B, E, H, K, O, R, U, Y, V, C, F, I, L, P, S, W, Z]

Reach the goal which is Z.


III) - Hill Climbing
Evaluation
Node
[A]
[C34]
[F35]

Opened

Closed

[A]
[B41, C34, D41]
[C34, B41, D41]
[F35, G58]
[I39]

[]
[A]
[C34, A]
[G2, C34, A]

Search terminates with F35 is the goal. Given that Z0 is the goal, therefore searching failed.

- Best First Search (BFS)


Evaluation
Node

Opened

G58

[A]
[B41, C34, D41]
[C34, B41, D41]
[F35, G58, B41, D41]
[F35, B41, D41,G58,]
[I39, B41, D41,G58,]
[L33, M27, B41,
D41,G58,]
[M27, L33, B41,
D41,G58]
[P61, L33, B41,
D41,G58]
[L33, B41, D41,G58,
P61]
[B41, D41,G58, P61]
[E44, D41,G58, P61]
[D41, E44, G58, P61]
[E44, G58, P61]
[H29, G58, P61]
[K60, G58, P61]
[G58, K60, P61]
[J62, K60, P61]

K60

[K60, P61, J62]


[O33, P61, J62]

O33

[R50, P61, J62]

R50

[U63, V62, P60, J62]

P60

[P60, V62, J62, U63]


[S61, V62, J62, U63]

S61

[W64, V62, J62, U63]

V62

[V62, J62, U63, W64]


[J62, U63, W64]

J62

[N14, U63, W64]

A
C34
F35
I39

M27

L33
B41
D41
E44
H29

Closed
[]
[A]
[C34, A]
[F35, C34, A]
[I39, F35, C34, A]

[M27, I39, F35, C34, A]

[L33, M27, I39, F35, C34, A]


[B41, L33, M27, I39, F35, C34, A]
[D41, B41, L33, M27, I39, F35, C34, A]
[E44, D41, B41, L33, M27, I39, F35, C34, A]
[H29,E44, D41, B41, L33, M27, I39, F35, C34, A]
[G58, H29,E44, D41, B41, L33, M27, I39, F35, C34,
A]
[K60, G58, H29,E44, D41, B41, L33, M27, I39, F35,
C34, A]
[O33, K60, G58, H29,E44, D41, B41, L33, M27, I39,
F35, C34, A]
[R50, O33, K60, G58, H29,E44, D41, B41, L33, M27,
I39, F35, C34, A]
[P60, R50, O33, K60, G58, H29,E44, D41, B41, L33,
M27, I39, F35, C34, A]
[S61, P60, R50, O33, K60, G58, H29,E44, D41, B41,
L33, M27, I39, F35, C34, A]
[V62, S61, P60, R50, O33, K60, G58, H29,E44, D41,
B41, L33, M27, I39, F35, C34, A]
[J62, V62, S61, P60, R50, O33, K60, G58, H29,E44,
D41, B41, L33, M27, I39, F35, C34, A]

N14

[Q32, U63, W64]

Q32

[T60, U63, W64]

T60

[X50, U63, W64]

X50

[Z0, U63, W64]

Z0

[U63, W64]

Reach the goal which is Z.

[N14, J62, V62, S61, P60, R50, O33, K60, G58,


H29,E44, D41, B41, L33, M27, I39, F35, C34, A]
[Q32, N14, J62, V62, S61, P60, R50, O33, K60, G58,
H29,E44, D41, B41, L33, M27, I39, F35, C34, A]
[T60, Q32, N14, J62, V62, S61, P60, R50, O33, K60,
G58, H29,E44, D41, B41, L33, M27, I39, F35, C34,
A]
[X50, T60, Q32, N14, J62, V62, S61, P60, R50, O33,
K60, G58, H29,E44, D41, B41, L33, M27, I39, F35,
C34, A]
[Z0, X50, T60, Q32, N14, J62, V62, S61, P60, R50,
O33, K60, G58, H29,E44, D41, B41, L33, M27, I39,
F35, C34, A]

H(n) = Straight line distance between any town to town (Sunderland) , Z


h(n) = mil
A
383
B
379
C
279.8
D
312
E
364
F
237
G
232.8
H
335
I
207.4
J
172
K
279.8
L
165
M
165
N
160.4
O
244
P
148.7
Q
132.4
R
195
S
92.2
T
66.1
U
135.5
V
131.2
W
30.4
X
27.6
Y
130.4
Z
0

- A* Algorithm
g(n) = 41.7
h(n) = 379
f(n) = 420.7

g(n) = 0
h(n) = 383
f(n) = 383

g(n) = 34.1
h(n) = 279.8
f(n) = 313.9

g(n) = 69.1
h(n) = 237
f(n) = 306.1

g(n) = 108.2
h(n) = 207.4
f(n) = 315.6

g(n) = 141.4
h(n) = 165
f(n) = 306.4
g(n) = 162.2
h(n) = 148.7
f(n) = 310.7

g(n) = 256.5
h(n) = 131.2
f(n) = 387.7

g(n) = 383.8
h(n) = 130.4
f(n) = 514.2

g(n) = 92.3
h(n) = 232.8
f(n) = 325.1

Route Taken
ACE-IMPSWZ

g(n) = 136
h(n) = 165
M f(n) = 301

Expanded node
ACE-IMPLSWZ

g(n) = 41.9
h(n) = 312
f(n) = 353.9

Cost 309.2 mil

g(n) = 153.3
h(n) = 148.7
f(n) = 302

g(n) = 214.7
S h(n) = 92.2
f(n) = 306.9

g(n) = 278.8
h(n) = 30.4
W f(n) = 309.2

g(n) = 309.2
h(n) = 0
f(n) = 309.2

MAP with distance.


G(n) the distance between each town (shown on map)
A
41.7

41.9

34.1

C
58.2

35

44.2

D
78.6

29.7

39.1

62.4

60.7

33.2

27.8

K
33.7

J
14.8
N
32.7

17.3

20.8

50.6

61.4

60.8

64.1

50.4

63.9

62.5

41.8

36.5

30.4

27.6

105
Y
IV) Based on (II) and (III)

Algorithm

Output description

Blind Search (II)

There is no information used in guiding the search

Breadth First Search (BFS)

but it use a fixed strategy for generating the states

Depth First Search (DFS)

and testing for the goal.


For the BFS, it starts at the root and explores the
whole of one level in the tree before moving on to
the next level. So, it took longer time to complete
the searching and found the goal.
For the DFS, it starts at the root and goes deep into
the tree following the descendants of a node before
returning to explore siblings. So, it took shortest
time to found the goal.

Heuristic Search (III)


- Best First Search
- Hill Climbing
- A*

Evaluate how promising the search will be if the


paths leading from that node are explored. It goes
to the lowest cost of the node to continue with the
searching to reach the goal. This heuristic is using
estimation to make it easier to found the goal.
For the Hill Climbing, it always seeks to improve
on the existing state with the next move but it will
get stuck because all successive moves take the
search down before being able to move back up.
However it took the short time in order to search
the goal when there is a cost node of child that is
bigger than cost node of their parent.

A heuristic is a function, h(n) defined on the nodes


of a search tree, which serves as an estimate of the
cost of the cheapest path from that node to the goal
node. A* search will expand nodes that have the
lowest value for g(n) + h(n), where g(n) is the
(exact) cost of the path from the initial state to the
current node. If h(n) is admissiblethat is, if h(n)
never overestimates the costs of reaching the goal
, then A* will always find an optimal solution.

Vous aimerez peut-être aussi