From 1828bd98314d039ad0e00ad5035c06e5c13286a8 Mon Sep 17 00:00:00 2001 From: Kaivalya Rawal Date: Sat, 18 Mar 2017 01:11:16 +0530 Subject: [PATCH] corrected return value for simulated-annealing --- search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/search.py b/search.py index 04d5b6c51..9d77025a4 100644 --- a/search.py +++ b/search.py @@ -378,10 +378,10 @@ def simulated_annealing(problem, schedule=exp_schedule()): for t in range(sys.maxsize): T = schedule(t) if T == 0: - return current + return current.state neighbors = current.expand(problem) if not neighbors: - return current + return current.state next = random.choice(neighbors) delta_e = problem.value(next.state) - problem.value(current.state) if delta_e > 0 or probability(math.exp(delta_e / T)):