The swarm speed is the speed at which the entire swarm heads towards the global optimum, that is, the hidden treasure. It is first calculated based upon the formula seen as follows, and then constrained within the upper and lower bound speed hyperparameter values. As you can see, we also apply various weights and randomization values to calculate and adjust the speed, like this:
// Update Swarm Speed
Swarm[i].Speed[j] = Inertia * Swarm[i].Speed[j] + CognitiveWeight * Swarm_Random() * (Swarm[i].BestPosition[j] - Swarm[i].Position[j]) + SocialWeight * Swarm_Random() * (GlobalBest.BestPosition[j] - Swarm[i].Position[j]);
// Bound Speed
Swarm[i].Speed[j] = UpdateSwarmSpeed(Swarm[i].Speed[j]);
private double UpdateSwarmSpeed(double Speed)
{
return Math.Max(Math.Min(Speed, upperBoundSpeed), lowerBoundSpeed);
}