# Firefly algorithm number of objective function calls

Reading an article (arXiv) about the Firefly optimization algorithm, it is stated that the objective function is called only once per firefly per iteration, but following both the pseudo-code in the article and some implementations I found online I do not understand why this is the case..

As I understand the following holds:

• The objective function is called whenever we want to update the light intensity $I_i$ of firefly $i$
• In a given iteration and firefly $i$, for every firefly $j$, if $I_j>I_i$ we move firefly $i$ and immediately re-calculate the intensity.

From this, if the fireflies' intensities are ordered as $1,2,3,\dots,n$, and the updated intensity increases by each movement are small (i.e. each movement will increase the intensity by at most 1), in one iteration the first firefly will move $n-1$ times, the second $n-2$ times,... each movement calling the objective function for a total of $n(n-1)/2$ calls. Where does the figure of $n$ objective calls per iteration comes form?

## 1 Answer

It seems to me that you are correct. I haven’t read the whole algorithm carefully though. One alternative is that maybe they intend for the movement to be simultaneous, so that the firefly that’s currently being placed moves towards all the bright fireflies at once, then recalculates once for the new position?

But as is, it seems like the pseudo code for the algorithm and the description don’t line up.