Hey Everyone,
Post your solutions to the Sep 6 In-Class Exercise here.
Best, Chris
Current cost c = 3, so in next move c = 4.
f(number to be moved) = c + h, where c is cost and h is a heuristic function is the sum of distances of numbers to their desired positions (how messed up the board is).
f(2) = 4 + (1 + 2 + 3 + 1 + 2 + 1 + 1 + 2) = 17
f(4) = 4 + (1 + 1 + 3 + 0 + 2 + 1 + 1 + 2) = 15
f(5) = 4 + (1 + 1 + 3 + 1 + 1 + 1 + 1 + 2) = 15
f(6) = 4 + (1 + 1 + 3 + 1 + 2 + 2 + 1 + 2) = 17
It's a tie so either 4 or 5 will be the next move. We can choose the lesser of two as an arbitrary tie breaker.
Student: Zahra Amin
(Edited: 2017-09-06)f(2) = c(2) + h(2) = 4 + 13 = 17 f(4) = c(4) + h(4) = 4 + 11 = 15 f(5) = c(5) + h(5) = 4 + 11 = 15 f(6) = c(6) + h(6) = 4 + 13 = 17
(Edited: 2017-09-06)C = 4
f(4) = 4+1+1+3+2+1+1+2 = 15
f(6) = 4+1+1+3+1+2+2+1+2 = 17
f(5) = 4 +1+1+3+1+1+1+1+2 = 15
f(2) = 4+1+2+3+1+2+1+1+2 = 17
It would pick to either move 4 or 5, but it would determine to move 4 because it was the first move to be calculated
(Edited: 2017-09-06)f(n)=c(n)+h(n) In this problem, after 3 moves from the initial starting puzzle, the possible moves are: 1. Move 2 to the center f= 4+(1+2+1+2+1+1+2+3)=17 2. Move 6 to the center f= 4+(1+1+2+2+1+1+2+3)=17 3. Move 4 to the center f= 4+(1+1+2+1+0+1+2+3)=15 4. Move 5 to the center f= 4+(1+1+2+1+1+1+1+3)=15 Move 4 or 5 will get the same result, but since move 4 come up earlier than move 5, my algorithm will choose to move 4
(Edited: 2017-09-06)f(n) = c(n) + h(n)
Student: Xin Yan
(Edited: 2017-09-06)Name : Yecheng Liang f(2) = 4 + (1+2+2+1+1+1+2+3) = 17 f(4) = 4 + (1+1+2+1+1+2+3) = 15 f(6) = 4 +(1+2+2+1+1+2+3) = 17 f(5) = 4 + (1+1+2+1+1+1+1+3) = 15
going for 4
f (2) = (3 + 1) + 1 + 1 + 2 + 1 + 1 + 1+ 1 + 2 +3 = 17 f (4) = (3 + 1) + 1 + 1 +3 + 2 + 1 + 1 +2 = 15 f (5) = (3 + 1) + 1+ 1 +3 + 1 + 1 +1 +1 + 2 = 15 f (6) = (3 + 1) + 1 + 1 + 3 + 1 + 2 +2 +1 + 2 =17
(Edited: 2017-09-06)n = number to be moved f(n) = c(n) + h(n)
f(2) = 4 + (1 + 2 + 3 + 1 + 2 + 1 + 1 + 2) = 17 f(4) = 4 + (1 + 1 + 3 + 0 + 2 + 1 + 1 + 2) = 15 f(5) = 4 + (1 + 1 + 3 + 1 + 1 + 1 + 1 + 2) = 15 f(6) = 4 + (1 + 1 + 3 + 1 + 2 + 2 + 1 + 2) = 17
The move to be chosen would be moving 4 to the center.