So, we have some function that needs to be minimized:

. In addition, there is an area

in which the initial positions of the particles are generated. In accordance with the GS work plan, everything begins with the generation of a particle system

where

- The maximum number of particles in the system.
Force acting at time

on

particle from the side

th, calculated by the formula

where

- active gravitational mass

particles

- passive gravitational mass

particles

- gravitational constant at the appropriate time,

- small constant

- Euclidean distance between particles.
')
So that the algorithm was not deterministic, but stochastic, in the formula for calculating the resultant force

random variables are added

(evenly distributed from zero to one). Then the resultant force is

.
Calculate the acceleration and speed:

where

- operation of component multiplication of vectors,

- random variable uniformly distributed from zero to one,

- inert mass

particles
It remains to recalculate the position of the particles. This is very easy to do:

.
By the current moment, two questions remain: how the gravitational constant changes and how to calculate the masses of the particles. The value of the gravitational constant should be determined by a monotonically decreasing function, depending on the initial values โโof the constant

and time points

i.e.

.
For example, you can take the following functions:
where
:
,
where
:
,
where
:
.
Now we can proceed to the final part of the story: to recalculate the masses. In the simplest case, all three masses (passive, active and inertial) are equal:

. Then the value of the masses can be recalculated by the formula:

where

.
Of course, the masses can be calculated on the basis of their physical meaning; nevertheless, Rashedi does not speak about this (and none of the authors I could find).