Skip to content

Commit

Permalink
Fix: change spread to random as initial position
Browse files Browse the repository at this point in the history
Due to a bug, spread position should not be used at the moment.
See Issue #32
  • Loading branch information
rsreds committed Mar 18, 2024
1 parent a9ce8d4 commit 2e3ca6a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions optimizer/mopso.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def __init__(self,
objective,
lower_bounds, upper_bounds, num_particles=50,
inertia_weight=0.5, cognitive_coefficient=1, social_coefficient=1,
incremental_pareto=True, initial_particles_position='spread', default_point=None):
incremental_pareto=True, initial_particles_position='random', default_point=None):
self.objective = objective
if FileManager.loading_enabled:
try:
Expand Down Expand Up @@ -219,7 +219,9 @@ def __init__(self,
'spread', 'lower_bounds', 'upper_bounds', 'random', 'gaussian'}

if initial_particles_position == 'spread':
self.spread_particles()
warnings.warn(f"Initial distribution set to 'random'.")
initial_particles_position = 'random'
# self.spread_particles()

if initial_particles_position == 'lower_bounds':
[particle.set_position(self.lower_bounds)
Expand Down

0 comments on commit 2e3ca6a

Please sign in to comment.