summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtsp.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tsp.py b/tsp.py
index 02ff7f9..eabcdb8 100755
--- a/tsp.py
+++ b/tsp.py
@@ -285,11 +285,12 @@ former only breaks 2 links while the latters breaks 4.'''
class Algo_Annealing (Algo_2opt):
'''Simulated annealing algorithm'''
- t0 = 10 # Initial temperature
- updates = 0 # Accepted updates counter
+ t0 = 10.0 # Initial temperature
+ updates = 0 # Accepted updates counter
def run (self, path = None):
'''Algorithm main loop'''
+ self.t0 = min (self.t0, self.t0 * self.context.count / 50)
self.updates = 0
if not path:
path = self.context.nearest_neighbours_best ()