TroglodyteDerivations commited on
Commit
70cbdc1
1 Parent(s): 7775b72

Updated line 340 with: best_positions_npy = np.load('best_positions.npy’). Updated line 358 with: contour = plt.contour(X, Y, Z, levels=20, cmap='magma’). Updated line 455 with: contour_plot = gwo.plot_contour_and_wolves(best_positions)

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -337,7 +337,7 @@ class GWO:
337
  def objective_function(x, y):
338
  return -5.0*np.exp(-0.5*((x+2.2)**2/0.4+(y-4.3)**2/0.4)) + -2.0*np.exp(-0.5*((x-2.2)**2/0.4+(y+4.3)**2/0.4))
339
 
340
- best_postions_npy = np.load('best_positions.npy')
341
 
342
  wolf_positions = best_positions_npy
343
 
@@ -355,7 +355,7 @@ class GWO:
355
 
356
  # Plot the contour map
357
  plt.figure(figsize=(10, 8))
358
- contour = plt.contour(X, Y, Z, levels=20, cmap='viridis')
359
  plt.colorbar(contour)
360
 
361
  # Plot the wolf positions
@@ -452,7 +452,7 @@ def optimize(npart, ndim, max_iter):
452
  best_positions_text = f"Best Fitness: {last_best_positions}"
453
 
454
  # Get the contour plot as a PIL Image
455
- contour_plot = gwo.plot_contour_and_wolves(wolf_positions)
456
 
457
  # Calculate the dispersion
458
  dispersion = gwo.Dispersion()
 
337
  def objective_function(x, y):
338
  return -5.0*np.exp(-0.5*((x+2.2)**2/0.4+(y-4.3)**2/0.4)) + -2.0*np.exp(-0.5*((x-2.2)**2/0.4+(y+4.3)**2/0.4))
339
 
340
+ best_positions_npy = np.load('best_positions.npy')
341
 
342
  wolf_positions = best_positions_npy
343
 
 
355
 
356
  # Plot the contour map
357
  plt.figure(figsize=(10, 8))
358
+ contour = plt.contour(X, Y, Z, levels=20, cmap='magma')
359
  plt.colorbar(contour)
360
 
361
  # Plot the wolf positions
 
452
  best_positions_text = f"Best Fitness: {last_best_positions}"
453
 
454
  # Get the contour plot as a PIL Image
455
+ contour_plot = gwo.plot_contour_and_wolves(best_positions)
456
 
457
  # Calculate the dispersion
458
  dispersion = gwo.Dispersion()