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

Skip to content

Commit 14bf5e4

Browse files
kaivalyarnorvig
authored andcommitted
corrected return value for simulated-annealing (#369)
1 parent ceb9874 commit 14bf5e4

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
@@ -378,10 +378,10 @@ def simulated_annealing(problem, schedule=exp_schedule()):
378378
for t in range(sys.maxsize):
379379
T = schedule(t)
380380
if T == 0:
381-
return current
381+
return current.state
382382
neighbors = current.expand(problem)
383383
if not neighbors:
384-
return current
384+
return current.state
385385
next = random.choice(neighbors)
386386
delta_e = problem.value(next.state) - problem.value(current.state)
387387
if delta_e > 0 or probability(math.exp(delta_e / T)):

0 commit comments

Comments
 (0)