Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 58df28f

Browse files
committed
expand(node, problem) was wrong.
1 parent 72bfc9d commit 58df28f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def hill_climbing(problem):
247247
stopping when no neighbor is better. [Fig. 4.11]"""
248248
current = Node(problem.initial)
249249
while True:
250-
neighbor = argmax(expand(node, problem), Node.value)
250+
neighbor = argmax(current.expand(problem), Node.value)
251251
if neighbor.value() <= current.value():
252252
return current.state
253253
current = neighbor
@@ -263,7 +263,7 @@ def simulated_annealing(problem, schedule=exp_schedule()):
263263
T = schedule(t)
264264
if T == 0:
265265
return current
266-
next = random.choice(expand(node. problem))
266+
next = random.choice(current.expand(problem))
267267
delta_e = next.path_cost - current.path_cost
268268
if delta_e > 0 or probability(math.exp(delta_e/T)):
269269
current = next

0 commit comments

Comments
 (0)