Skip to main content
. 2021 Dec 9;12(12):1532. doi: 10.3390/mi12121532
Algorithm 1. Standard flower pollination algorithm.
1: Define the objective function f(x),x=(x1,x2,,xd)
2: Initialize a population of n flowers/pollen gametes with random solutions
3: Evaluate each flower or solution in the population
4: Extract the best solution in the population
5: Find the best solution gbest* in the initial population
6: Define a switch probability p[0,1]
7: Define fixed number of iterations Max_generation
8: While t<Max_generation
9: for i = 1:n (each flower in the population)
10: if (rand < p)
11: Draw a (d-dimensional) step vector L which obeys a Lévy distribution
12: Global pollination via xit+1=xit+γL(λ)(xitgbest*)
13: else
14: Draw ε from a uniform distribution in [0, 1]
15: Do local pollination via xit+1=xit+ε(xjtxkt)
16: end if
17: Evaluate each new solution xit
18: If new solution is better, update it in the population
19: end for
20: Find the current best solution gbest*
21: end While
22: Output the best solution found