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