Browse Source

first graph generated, lets see how it looks

tarfeef101 6 years ago
parent
commit
b679dfd1dd
2 changed files with 2 additions and 3 deletions
  1. BIN
      a2/hill_climbing.pdf
  2. 2 3
      a2/tsp_local.py

BIN
a2/hill_climbing.pdf


+ 2 - 3
a2/tsp_local.py

@@ -210,7 +210,7 @@ def beck_weathers(cities, opt):
 # 1 = hill climbing, 2 = tabu/sideways allowed, 3 = random restarts, 4 = annealing
 # x represents the optional parameters for 3 and 4
 # specifically, the # of restarts and the annealing schedule, respectively
-def solver(problem, algo, x):
+def solver(problem, algo, *x):
     # import map
     prob = problem
     with open(prob) as file:
@@ -251,7 +251,6 @@ def solver(problem, algo, x):
 def main():
     plt.ioff()
     plt.switch_backend('agg')
-    solver("instance_10.txt", 1, 0)
     solution_steps = []
     solution_scores = []
     
@@ -285,7 +284,7 @@ def main():
         axis_twin.plot(range(1, 11), solution_scores[i], label = "Solution Cost/Distance")
         axis_twin.set_ylabel("Distance in units")
 
-    axes.legend()
+    #axes.legend()
     plt.savefig("hill_climbing.pdf")
 
 main()