Ver Fonte

generating % better or same as reference graphs (i hope)

Tareef há 6 anos atrás
pai
commit
ee91829b78
1 ficheiros alterados com 8 adições e 4 exclusões
  1. 8 4
      a2/tsp_local.py

+ 8 - 4
a2/tsp_local.py

@@ -285,17 +285,21 @@ def main():
             scores.append(prob_scores / 100.0)
             good_sols.append(good_solutions)
             
-    figure, axes = plt.subplots(3, 1, True)
+    figure, axes = plt.subplots(3, 2, True)
             
     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/ " + str(i + 14) + " cities")
-        axes[i].set_ylabel("Steps Taken", color = 'b')
+        axes[i][0].plot(range(1, 11), solution_steps[i], label = "Steps to Solution", color = 'b')
+        axes[i][0].set_xlabel("Problem Instance w/ " + str(i + 14) + " cities")
+        axes[i][0].set_ylabel("Steps Taken", color = 'b')
         axis_twin = axes[i].twinx()
         axis_twin.plot(range(1, 11), solution_scores[i], label = "Solution Quality", color = 'r')
         axis_twin.set_ylabel("Solution Quality", color = 'r')
         #axes[i].legend()
         #axis_twin.legend()
+    for i in range(0, 3):
+        axes[i][1].plot(range(1, 11), good_sol_counts[i], color = 'b')
+        axes[i][1].set_xlabel("Problem Instance w/ " + str(i + 14) + " cities")
+        axes[i][1].set_ylabel("% of runs <= NEOS", color = 'b')
 
     plt.savefig("hill_climbing.pdf")