Skip to main content
. 2022 Apr 20;22(9):3153. doi: 10.3390/s22093153
Algorithm 1 Ant Colony Optimization algorithm (ACO).
  • 1:
    Initialization part.
  • 2:

    Random generation of L vectors from the domain of solving problem (the so-called pheromone spots): xi=[x1i,x2i,,xni]  (i=1,2,,L).

  • 3:

    Calculating the value of the objective function for each of the pheromone spot (for each solution vector).

  • 4:

    Sorting the set of solutions in descending order by the quality of solutions (the lower the value of the objective function, the better the solution). Each solution is assigned an index.

  • 5:
    Iterative part.
  • 6:

    for iteration = 1, 2, …, I do

  • 7:
        Each pheromone spot (solution vector) is assigned a probability according to the formula:
    pl=ωll=1Lωll=1,2,,L,
    where ωl are weights related to the solution index l and expressed by the formula:
    ωl=1qL2π·e(l1)22q2L2.
  • 8:

        for k = 1, 2, …, M do

  • 9:

              Ant randomly chooses the l-th solution with a probability of pl.

  • 10:
            Then ant transforms each of the coordinates (j=1,2,,n) of the selected solution using Gauss function:
    g(x,μ,σ)=1σ2π·e(xμ)22σ2,
    where μ=sjl,σ=ξL1p=1L|sjpsjl|.
  • 11:

        end for

  • 12:

        M new solutions are obtained. Divide set of new solutions into nT groups and calculate value of objective function J for each solution in each group in separate thread.

  • 13:

        From the two sets of solutions (new one and previous one) remove M worst solutions and rest sort according to the quality (value of objective function).

  • 14:

    end for