Total Complexity | 12 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | """Represents swarm.""" |
||
7 | class Swarm(object): |
||
8 | def __init__(self, process, stages, number_of_particles): |
||
9 | self.stages = stages |
||
10 | self.process = process |
||
11 | self.number_of_particles = number_of_particles |
||
12 | self.particles = [Particle(stages, self.process) for i in |
||
13 | range(number_of_particles)] |
||
14 | self.best_particle_quality = np.inf |
||
15 | self.best_particle = self.particles[0] |
||
16 | |||
17 | def initialize(self): |
||
18 | for particle in self.particles: |
||
19 | particle.initialize() |
||
20 | |||
21 | def do_single_iteration(self): |
||
22 | for particle in self.particles: |
||
23 | particle.update_values() |
||
24 | self._update_best_particle() |
||
25 | self._update_velocieties() |
||
26 | for particle in self.particles: |
||
27 | particle.move() |
||
28 | |||
29 | def _update_best_particle(self): |
||
30 | for particle in self.particles: |
||
31 | if particle.best_quality < self.best_particle_quality: |
||
32 | self.best_particle = particle |
||
33 | self.best_particle_quality = particle.best_quality |
||
34 | |||
35 | def _update_velocieties(self): |
||
36 | for particle in self.particles: |
||
37 | particle.update_velocieties(self.best_particle) |
||
38 |
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.