Algorithm
The plan of the algorithm itself was treacherously taken from [
3 ]. Add a few formulas to make it all take a more meaningful look. So, we have some function

that needs to be minimized and the scope of the search

(for simplicity, we assume its multidimensional rectangular parallelepiped), in which the minimum point, or rather its approximation, will be searched. The next step is to generate the initial harmonics in our search area.

(randomly). Magnitude

is set by the user, and, as it is easy to guess, indicates the number of harmonics that can be stored in memory. In addition, the user must also specify

- the probability of choosing from the harmonics in the memory,

- probability of modification and

- the value of the modification itself. Now that all the preparations have been made, with a clear conscience we can proceed
to create music to minimize the function. The iterative part continues until the stopping criterion of the algorithm is satisfied. It can be either a limit on the number of iterations, or the number of runs without updating the harmonic memory, or the proximity of the added harmonics in the sense of a particular metric. It all depends on your desire. During the iterative part, the following happens:
- Create a zero harmonic
. - Next, for each harmonic component, do the following: generate a random number
uniformly distributed from zero to one. If a
less than
then in the current component write the corresponding component from randomly selected harmonics from the memory. Otherwise, the component is generated randomly, taking into account the belonging to the corresponding component of the search area.
. If the component was generated using memory, then it may be subject to modification. For this, a random number is generated again.
uniformly distributed from zero to one. If a
less than
, the component changes by
where
- random variable uniformly distributed from
before
. - If a
then
replaces
(memory update is in progress).