tarfeef101 %!s(int64=6) %!d(string=hai) anos
pai
achega
5c4c8b62b6
Modificáronse 2 ficheiros con 2 adicións e 1 borrados
  1. BIN=BIN
      a2/hill_climbing.pdf
  2. 2 1
      a2/tsp_local.py

BIN=BIN
a2/hill_climbing.pdf


+ 2 - 1
a2/tsp_local.py

@@ -149,6 +149,7 @@ def tenzing_norgay(cities):
 
 
 # returns the hill climbing solution w/ x random restarts for a given input
+# if you want x restarts, call with x + 1
 def reinhold_messner(cities, x):
     curcost = length(cities)
     curpath = copy.deepcopy(cities)
@@ -278,7 +279,7 @@ def main():
             
     for i in range(0, 3):
         axes[i].plot(range(1, 11), solution_steps[i], label = "Steps to Solution", color = 'b')
-        axes[i].set_xlabel("Problem Instance w/ " + i + " cities")
+        axes[i].set_xlabel("Problem Instance w/ " + str(i) + " cities")
         axes[i].set_ylabel("Steps Taken", color = 'b')
         axis_twin = axes[i].twinx()
         axis_twin.plot(range(1, 11), solution_scores[i], label = "Solution Cost/Distance", color = 'r')