| Conditions | 1 |
| Total Lines | 8 |
| 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 | leader_best_position - self.stage.control_params) |
||
| 27 | + self.C2 * np.random.rand(len(self.stage.control_params)) * ( |
||
| 28 | particle_best_position - self.stage.control_params) |
||
| 29 | self.current_velocity = velocity |
||
| 30 | return velocity |
||
| 31 |
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.