Mayfly
Optimization Algorithm
Single-objective MA
MA pseudocode:
Objective function f(x), x=(x_1,…,x_d )^T
Initialize the male mayfly population x_i (i=1,2,…,N) and velocities v_mi
Initialize the female mayfly population y_i (i=1,2,…,M) and velocities v_fi
Evaluate solutions
Find global best gbest
Do While stopping criteria are not met
Update velocities and positions of males and females
Evaluate solutions
Rank the mayflies
Mate the mayflies
Evaluate offspring
Separate offspring to male and female randomly
Replace worst solutions with the best new ones
Update pbest and gbest
end while
Click on the links below to download simplified Matlab or Python demo codes, which show how to use the Mayfly Optimization Algorithm to solve global optimization problems.
Researchers are allowed to use the demo codes mentioned above in their research projects, as long as they cite as:
Zervoudakis, K., & Tsafarakis, S. (2020). A mayfly optimization algorithm. Computers & Industrial Engineering, 145, 106559. https://doi.org/10.1016/j.cie.2020.106559
Multi-objective MA
MOMA pseudocode
Initialize the male mayfly population 𝑥𝑖 (𝑖 = 1,2, … , 𝑁) and velocities 𝑣𝑚𝑖
Initialize the female mayfly population 𝑦𝑖 (𝑖 = 1,2, … , 𝑀) and velocities 𝑣𝑓𝑖
Evaluate solutions using the predefined objective functions
Store the nondominated solutions found in an external repository
Sort the mayflies
Do While stopping criteria are not met
Update velocities and positions of males and females
Evaluate solutions
If a new mayfly dominates its personal best
Replace personal best with the new solution
If no one dominates the other
The new solution has a chance of 50% to replace the personal best
Rank the mayflies
Mate the mayflies
Evaluate offspring
Separate offspring to male and female randomly
If an offspring dominates its same-sex parent
Replace parent with the offspring
Insert all the new nondominated solutions found in the external repository
Sort the nondominated solutions and truncate the repository if needed
end while
Click here to download a simplified Matlab demo code which shows how to use the multi-objective Mayfly Optimization Algorithm to solve multi-objective optimization problems.
Researchers are allowed to use this code in their research projects, as long as they cite as:
Zervoudakis, K., & Tsafarakis, S. (2020). A mayfly optimization algorithm. Computers & Industrial Engineering, 145, 106559. https://doi.org/10.1016/j.cie.2020.106559
MA for clustering
Click here to download a simplified Matlab demo code which shows how to use the Mayfly Optimization Algorithm to solve clustering problems, as it was proposed by Mastrothanasis et al. (2023) to classify students according to their levels of emotions and performance anxiety that are developed during a theatrical performance.
Researchers are allowed to use this code in their research projects, as long as they cite as:
Mastrothanasis, K., Zervoudakis, K., Kladaki, M. & Tsafarakis, S. (2023). A bio-inspired computational classifier system for the evaluation of children’s theatrical anxiety at school. Education and Information Technologies. https://doi.org/10.1007/s10639-023-11645-4
Zervoudakis, K., & Tsafarakis, S. (2020). A mayfly optimization algorithm. Computers & Industrial Engineering, 145, 106559. https://doi.org/10.1016/j.cie.2020.106559