for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
"""Represents swarm."""
import numpy as np
numpy
This can be caused by one of the following:
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
# .scrutinizer.yml before_commands: - sudo pip install abc # Python2 - sudo pip3 install abc # Python3
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.
__init__.py
from grortir.main.pso.particle import Particle
class Swarm(object):
"""Class which represent swarm."""
def __init__(self, process, stages, number_of_particles):
self.stages = stages
self.process = process
self.number_of_particles = number_of_particles
self.particles = [Particle(stages, self.process) for i in
range(number_of_particles)]
self.best_particle_quality = np.inf
self.best_particle = self.particles[0]
def initialize(self):
"""Initialize all particles in swarm."""
for particle in self.particles:
particle.initialize()
def do_single_iteration(self):
"""Iterate one time."""
particle.update_values()
self._update_best_particle()
self._update_velocieties()
particle.move()
def _update_best_particle(self):
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
class SomeClass: def some_method(self): """Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.
if particle.best_quality < self.best_particle_quality:
self.best_particle = particle
self.best_particle_quality = particle.best_quality
def _update_velocieties(self):
particle.update_velocieties(self.best_particle)
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.