for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
"""Contains things related to calculating velocity."""
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
class VelocityCalculator:
"""Calculate Velocity for single stage.
Attributes:
current_velocity (list) : list of coordinates of speed for current stage
"""
def __init__(self, stage):
self.stage = stage
self.c_1 = 0.5
self.c_2 = 0.5
self.w_factor = 0.8
self.current_velocity = None
def calculate_initial_velocity(self):
"""Calculate initial velocity."""
velocity = 0.02 * np.random.rand(len(self.stage.control_params)) - 0.01
self.current_velocity = velocity
return velocity
def calculate(self, particle_best_position, leader_best_position):
"""Calculate velocity."""
velocity = self._s0() + self.c_1 * self._s1(
leader_best_position) + self.c_2 * self._s2(particle_best_position)
def _s2(self, particle_best_position):
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.
return np.random.rand(len(self.stage.control_params)) * (
np.asarray(particle_best_position) - np.asarray(
self.stage.control_params))
def _s1(self, leader_best_position):
np.asarray(leader_best_position) - np.asarray(
def _s0(self):
return self.w_factor * self.current_velocity
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.