0% found this document useful (0 votes)
42 views

Digital Assignment-1 ITE2010 - Artificial Intelligence: Cal Course

This document describes solving a blocks word problem using the hill climbing algorithm. It presents the initial problem state with blocks labeled A through H in a random order with a score of -6. It then explains the hill climbing heuristic used, and shows the final correct state configuration with a score of +8 is reached in 14 steps.

Uploaded by

Garvit Kataria
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Digital Assignment-1 ITE2010 - Artificial Intelligence: Cal Course

This document describes solving a blocks word problem using the hill climbing algorithm. It presents the initial problem state with blocks labeled A through H in a random order with a score of -6. It then explains the hill climbing heuristic used, and shows the final correct state configuration with a score of +8 is reached in 14 steps.

Uploaded by

Garvit Kataria
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Digital Assignment-1

ITE2010 – Artificial Intelligence

SLOT A2+TA2

CAL COURSE

In

B. Tech – Information Technology

By

Garvit Kataria (17BIT0101)

Under the guidance of

Prof. Ajit Kumar Santra

SITE

School of Information Technology and Engineering


Solve the following blocks of word problem using the hill climbing
algorithm.

C
G
F
H
B
E
A
D

Answer:

To implement the Hill climbing algorithm, we need to follow a heuristic


function. The heuristic function we follow is Local function. It is described
as follows. Local function:
Add one point for every block that is resting on the thing it is supposed to be
resting on. Subtract one point for every block that is sitting on the wrong thing.
Step 0:
Initial State:
C -1
G +1
F -1
H -1
B -1
E -1
A -1
-1
D
Score: -6
Final state
H +1
G +1
F +1
E +1
D +1
C +1
B
+1
A
+1
Score: +8

Step 1:
G +1
F -1

G -1

B -1
-1
E
-1 -1
A
-1
D C
Score: -6
Here we are facing problem. As score in step 1 is same as score in step 0, the
Hill Climbing algorithm comes to halt. We define a new heuristic function
which is called Global function.
Global Function:

For each block that has the correct support structure (i.e. the complete structure
underneath it is exactly as it should be), add one point for every block in the
support structure. For each block that has an incorrect support structure,
subtract one point for every block in the existing support structure.

Step 0:
C -7
G -6
F -5
H -4
B -3
E -2
A -1
D 0
Initial State: -28

H +7
G +6
F +5
E +4
D +3
C +2
B +1
A 0
Final State: +28
Step 1:
G -6
F -5

H -4

B -3
-2
E
-1 0
A 0
D C
Score: -21

Step 2:
(i)
C -7
G -6
F -5
H -4
B -3
E -2
A -1
D 0
Score: -28
(ii)

F -5
H -4
B -3
E -2
A -1 G -1
D 0 C 0
Score: -16
(iii)

A -5

E -4

B -3
D -2
0
C -1 0

H 0 C G
Score: -15

The score of option (iii) is the highest score. So, we go ahead with option (iii).

Step 3:

H -4
B -3
E -2
A 0 0 0
-1
D C G F
0
Score: -10
Step 4:
B -3

E -2

A -1
D E
0 0 0 0 0
C G F H
Score: -6 `

Step 5:

B -3

E -2

A -1
D E
0 0 0 0 0 0
C G F H B
Score: -3 `

Step 6:

B -3

E -2

A -1
D E
0 0 0 0 0 0
0
E C G F H B
Score: -1 `
Step 7:

B -3

E -2

A -1
D E
0 00 0 0 0 0 0 0
B
A D E C G F H B
Score: 0 `

Step 8:

B +1 0 0 H0 + 0 0 0
A 0 C D E F G H
Score: +1

Step 9:

C +2
B +1 0 0 H +1 0 0
A 0 D E G 0 F
Score: +3
Step 10:

D +3
C +2
B +1 0 0 H +1 0 0
A 0 E F G 0
Score: +6

Step 11:

E +4
D +3
C +2
B +1 0 H0 +1 H +1 0 0
A 0 F G 0 G 0

Score: +10

Step 12:

+
F +5
E +4
D +3
C +2
B +1 0 H0 +1 H +1 0 0
A 0 F G 0 G 0

Score: +15
Step 13:

H +7
G +6
F +5
E +4
D +3
C +2
B +1
A 0

Score: +21

Step 14:

H +7
G +6
F +5
E +4
D +3
C +2
B +1
A 0

Score: +28

Final State is reached. So, we stop here as we have reached goal state.

You might also like