Professional Documents
Culture Documents
AI ETH DA2 Harsh Gautam
AI ETH DA2 Harsh Gautam
AI ETH DA2 Harsh Gautam
G H
D G
F F
E E
B D
A C
C B
H A
Step 0
G -1
D -1
F +1
E -1
B +1
A -1
C -1
H -1
Total score of initial state = -4
H +1
G +1
F +1
E +1
D +1
C +1
B +1
A +1
Total score of goal state = +8
There is only one possible move from initial state so we perform that.
Step 1
Removing block G from top of the stack and put it on the tabletop.
D -1
F +1
E -1
B +1
A -1
C -1 -1
H -1 G
Global: 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.
As we have modified the function, we will re calculate the scores of initial and goal states.
Step 0
Calculating the score of the initial state as per the definition of Global function:
G -7
D -6
F -5
E -4
B -3
A -2
C -1
H 0
Total score of initial state = -28
Calculating score for the goal state as per the definition of Local function:
H +7
G +6
F +5
E +4
D +3
C +2
B +1
A 0
Total score of goal state = +28
There is only one possible move from initial state so we perform that.
Step 1
Removing block G from top of the stack and put it on the tabletop.
D -6
F -5
E -4
B -3
A -2
C -1 0
H 0 G
Score = -21
As there is a score improvement we go ahead and make the new state as our current state.
Step 2
There are 3 possibilities
A)
F -5
E -4
B -3
A -2
C -1 D -1
H 0 G 0
Score = -16
B)
G -7
D -6
F -5
E -4
B -3
A -2
C -1
H 0
Score = -28
C)
A -5
E -4
D -3
F -2
B -1 0 0
C 0 G D
Score = -15
The Scores of States A), B), C) respectively are -16, -28, -15
we will make state C as our new current state as it has the highest score among the 3
possibilities.
Step 3
The New state will be
E -4
B -3
A -2
C -1 0 0 0
H 0 G D F
Score = -10
Step 4
The New state will be
B -3
A -2
C -1 0 0 0 0
H 0 G D F E
Score = -6
Step 5
The New state will be
A -2
C -1 0 0 0 0 0
H 0 G D F E B
Score = -3
Step 6
The New state will be
C -1 0 0 0 0 0 0
H 0 G D F E B A
Score = -1
Step 7
The New state will be
C -1 0 0 B +1 0 0 0
H 0 G H A 0 E D F
Score = 0
Step 8
The New state will be
C +2
0 0 B +1 0 0 0
G H A 0 E D F
Score = +3
Step 9
The New state will be
D +3
C +2
0 0 B +1 0 0
G H A 0 E F
Score = +6
Step 10
The New state will be
E +4
D +3
C +2
0 0 B +1 0
G H A 0 F
Score = +10
Step 11
The New state will be
F +5
E +4
D +3
C +2
0 0 B +1
G H A 0
Score = +15
Step 12
The New state will be
G +6
F +5
E +4
D +3
C +2
0 B +1
H A 0
Score = +21
Step 13
The New state will be
H +7
G +6
F +5
E +4
D +3
C +2
B +1
A 0