The firefly algorithm is a metaheuristic proposed by Xin-She Yang and inspired by the flashing behaviour of fireflies.

The primary purpose for a firefly’s flash is to act as a signal system to attract other fireflies. Xin-She Yang formulated this firefly algorithm by assuming:

- All fireflies are unisexual, so that any individual firefly will be attracted to all other fireflies;
- Attractiveness is proportional to their brightness, and for any two fireflies, the less bright one will be attracted by (and thus move towards) the brighter one; however, the intensity (apparent brightness) decrease as their mutual distance increases;
- If there are no fireflies brighter than a given firefly, it will move randomly.

The brightness should be associated with the objective function.

### Related

Forward–backward algorithmThe forward-backward algorithm is an algorithm for computing posterior marginals in a hidden Markov model (HMM). It is based on…

Prim's algorithmIn computer science, Prim's algorithm is a greedy algorithm that finds a minimum spanning tree for a weighted undirected graph.…