Skip to main content
. 2019 Jun 22;21(6):617. doi: 10.3390/e21060617
Algorithm 1: Pseudocode of the basic PSO algorithm
  • 1:

    initialize necessary variables and create swarm population

  • 2:

    repeat

  • 3:

     adjust inertia factor value

  • 4:

    for all particles in population do

  • 5:

      calculate particle fitness

  • 6:

      if fitness is better than that of the best particle then

  • 7:

       update best particle and save fitness

  • 8:

      end if

  • 9:

    end for

  • 10:

    for all particles in population do

  • 11:

      retrieve best particle from neighborhood

  • 12:

      update speed and modify its position

  • 13:

    end for

  • 14:

    until reaching termination condition

  • 15:

    return solution of best particle in population