| Conditions | 1 |
| Total Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | import numpy as np |
||
| 23 | def calculate(self, particle_best_position, leader_best_position): |
||
| 24 | velocity = self.w * self.current_velocity |
||
| 25 | + self.C1 * np.random.rand(len(self.stage.control_params)) * ( |
||
| 26 | np.asarray(leader_best_position) - np.asarray( |
||
| 27 | self.stage.control_params)) |
||
| 28 | + self.C2 * np.random.rand(len(self.stage.control_params)) * ( |
||
| 29 | np.asarray(particle_best_position) - np.asarray( |
||
| 30 | self.stage.control_params)) |
||
| 31 | self.current_velocity = velocity |
||
| 32 | return velocity |
||
| 33 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.