0% found this document useful (0 votes)
36 views11 pages

21mis0359 (Ai Da2) - 1

The document describes solving a blocks problem using the hill-climbing algorithm. It starts with an initial state with a score of -6 and applies the hill-climbing algorithm using different local functions to arrive at the goal state with a score of +28.

Uploaded by

ruthika.j2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views11 pages

21mis0359 (Ai Da2) - 1

The document describes solving a blocks problem using the hill-climbing algorithm. It starts with an initial state with a score of -6 and applies the hill-climbing algorithm using different local functions to arrive at the goal state with a score of +28.

Uploaded by

ruthika.j2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

SCHOOL OF COMPUTER SCIENCE ENGINEERING

AND INFORMATION SYSTEMS

WINTER SEMESTER 2023-24

NAME: RUTHIKA.J
REG NO: 21MIS0359
COURSE NAME: ARTIFICIAL INTELLIGENCE
SLOT:C1+TC1
COURSE CODE: SWE4010
DA - 2 QUESTION

Solve the following blocks problem using hill-climbing algorithm:


(10 Marks)

H
C
G
A
D
B
F
E

Solution:
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:

H -1 H +1

C -1 G +1

G -1 F +1

A -1 E +1

D -1 D +1
B -1 C +1
F +1 B +1
E -1
A +1

Initial state Final state


Score: -6 Score: +8
Step 1:
C -1
G -1
A -1
D -1
B -1
F +1 -1

E -1 H

Score: -6

Justification: In step-1, the score has not been improved from step-0, hence the
hill-climbing algorithm comes to halt. We need to redefine heuristic 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 supporting structure.

Step 0:
-7 H +7
H
C -6 G +6

G -5 F +5

A -4 E +4

D -3 D +3

B -2 C +2
F -1 B +1
E 0 A 0

Initial state Final state


Score: -28 Score: +28
Step 1:
C -6
G -5
A -4
D -3
B -2
F -1 0

E 0 H

Score: -21

Step 2:

Case(a)
G
-5
A -4
D -3

B -2

F -1 0 0

E 0 H C

Score: -15
Case(b)
G -5
A -4
D -3

B -2

F -1 C -1
E 0
H 0

Score: -16

Case(c)

H -7

C -6
G -5
A -4
D -3
B -2
F -1
E
0

(Dead End)
Score: -28

Justification : Score of case (a) is highest. Hence we can proceed with case (a).
Step 3:

A
-4
D
-3
B -2
F -1 0 0 0

E 0 H C G

Score: -10

Step 4:

D
-3
B -2
0
F -1 0 0 0

E 0 H C G A

Score: -6

Step 5:

B -2 0
0
F -1 0 0 0
H C G A D
E 0

Score: -3
Step 6:

F -1 0 0 0 0 0 000
0
E 0 H C G A D B

Score: -1

Step 7:

0 0 0 0 00 00 0
0

E H C G A D B F

Score: 0

Step 8:

0
0 0 B +1 0
0 0 0

E 00000 H C G A 0 D F

E
Score: +1

Step 9

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

Score: +3

Step 10:

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

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

Score: +10
Step 12:

F +5
E +4

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

Score: +15
Step 13:

G
+6
F +5

E +4

D
+3
C
+2
0 B +1
H A 0
E

Score : +21
Step 14:

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

Score: +28
Therefore, Goal state is reached.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy