Skip to content

Commit

Permalink
placate flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored Jun 28, 2017
1 parent a2775c0 commit 66e8634
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Solid/ParticleSwarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def __init__(self, swarm_size, member_size, lower_bound, upper_bound, c1, c2, c3

self.pos = uniform(self.lower_bound, self.upper_bound, size=(swarm_size, member_size))

self.vel = uniform(self.lower_bound - self.upper_bound, self.upper_bound - self.lower_bound, size=(swarm_size, member_size))
self.vel = uniform(self.lower_bound - self.upper_bound, self.upper_bound - self.lower_bound,
size=(swarm_size, member_size))

self.best = copy(self.pos)

Expand Down Expand Up @@ -104,7 +105,8 @@ def _clear(self):
:return: None
"""
self.pos = uniform(self.lower_bound, self.upper_bound, size=(self.swarm_size, self.member_size))
self.vel = uniform(self.lower_bound - self.upper_bound, self.upper_bound - self.lower_bound, size=(self.swarm_size, self.member_size))
self.vel = uniform(self.lower_bound - self.upper_bound, self.upper_bound - self.lower_bound,
size=(self.swarm_size, self.member_size))
self.scores = self._score(self.pos)
self.best = copy(self.pos)
self.cur_steps = 0
Expand Down Expand Up @@ -155,7 +157,7 @@ def _global_best(self):
:return: None
"""
if self.global_best is None or min(self.scores) < self._objective(self.global_best[0]):
self.global_best = array([self.pos[argmin(self.scores)],] * self.swarm_size)
self.global_best = array([self.pos[argmin(self.scores)]] * self.swarm_size)

def run(self, verbose=True):
"""
Expand Down

0 comments on commit 66e8634

Please sign in to comment.