summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2007-12-17 22:16:49 +0100
committerGuillaume Seguin <guillaume@segu.in>2007-12-17 22:16:49 +0100
commit9a5334dbf056dbbb2872944ea480b2645914e8cf (patch)
treeda08e49521bf55bbb118b9dd1d23dd039a47adaa
parent12c0dbe7ae88bafb62dabdc21a100e20c1e03307 (diff)
downloadtsp-9a5334dbf056dbbb2872944ea480b2645914e8cf.tar.gz
tsp-9a5334dbf056dbbb2872944ea480b2645914e8cf.tar.bz2
* Modify the way t0 is computed (use min (10, citycount / 5))
-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 ()