Anda di halaman 1dari 2

Benjamin Mao

maoben86@gmail.com

2 7 3
1 8
6 5 4

g(n)=1,h(n)=6,f(
2 7 3
n)=7= 1 8 4

2 7
1 8 3
6 5 4

6 5
2 7 3
1 8 4
g(n)=2,
h(n)=4, 6 5

2 7 3
1
8
6 5 4

g(n)=1,h(n)=7,f
(n)=8

g(n)=0, h(n)=7,
f(n)=7

g(n)=1,h(
n)=8,
f(n)=9

f(n)=6

2 7 3
8 4
g(n)=3,h(n)=4
1 6 5
,f(n)=7 *

c) No, that would probably not be an admissible heuristic. h(n) is our estimate of how many steps
it would take to reach the goal state. I think it is safe to assume we will reach a solution before
2*7 or 14 steps.
2a)
Initial state: (3,3,1)
Goal state: (0,0,0) or (0,0,1). The latter would be impossible since the boat on the right back
would require someone to go back across.
There are 10 possible operators. One cannibal can take the boat across, one vegetarian can, two
cannibals can, two vegetarians can, or one of each can. There are equivalent operators going the
other way. One just has to make sure the cannibals dont outnumber the vegetarians at any given
point.
Travel trips:
(c,v,1)(c-1,v,0) if c>0 and (v=0 or v=3)
(c,v,1)(c,v-1,0) if v=1 or (v=3 and c>1)
(c, v, 1)(c-2, v, 0) if c > 1 and v 2
(c, v, 1) (c,v-2 , 0) if v > 1 and v + c = 4
(c, v, 1)(c-1, v-1, 0) if v > 0 and v = c

Benjamin Mao
maoben86@gmail.com

Return trips:
(c,v,0)(c+1,v,1) if c<3 and c v
Etc.
b) h(n) is admissible. You probably will underestimate the number of steps it takes to reach the
goal state if you dont include any cannibals in the equation.
(3,3,1)
(2,3,0)

(3,2,0)

(1,3,0)

(3,1,0)

(2,3,1)

(1,3,1)

(1,2,0) (2,1,0)(0,3,0)

(0,2,0)(1,1,0)

(2,2,0)
(2,2,1)

3.

24

108*

-1

108

24

b) Since Max will want to pick the highest minimax value to have the highest chance of winning,
he should expand the node with the value of 108.

Anda mungkin juga menyukai