Total Complexity | 11 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | """Represents swarm.""" |
||
7 | class Swarm(object): |
||
8 | def __init__(self, stages, number_of_particles): |
||
9 | self.stages = stages |
||
10 | self.number_of_particles = number_of_particles |
||
11 | self.particles = self.number_of_particles * [Particle(stages)] |
||
12 | self.best_particle_quality = np.inf |
||
13 | self.best_particle = self.particles[0] |
||
14 | |||
15 | def initialize(self): |
||
16 | for particle in self.particles: |
||
17 | particle.initialize() |
||
18 | |||
19 | def do_single_iteration(self): |
||
20 | for particle in self.particles: |
||
21 | particle.update_values() |
||
22 | self._update_best_particle() |
||
23 | self._update_velocieties() |
||
24 | for particle in self.particles: |
||
25 | particle.move() |
||
26 | |||
27 | def _update_best_particle(self): |
||
28 | for particle in self.particles: |
||
29 | if particle.best_quality < self.best_particle_quality: |
||
30 | self.best_particle = particle |
||
31 | self.best_particle_quality = particle.best_quality |
||
32 | |||
33 | def _update_velocieties(self): |
||
34 | for particle in self.particles: |
||
35 | particle.update_velocieties(self.best_particle) |
||
36 |
This can be caused by one of the following:
1. Missing Dependencies
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
2. Missing __init__.py files
This error could also result from missing
__init__.py
files in your module folders. Make sure that you place one file in each sub-folder.