Request for MATLAB Code of Elephant Search Algorithm (ESA)

Hi everyone,

I’m looking for a MATLAB implementation of the Elephant Search Algorithm (ESA) for optimization problems. I couldn’t find an existing code online, and I’d appreciate it if someone could share a working implementation or guide me on how to code it based on its original paper.

If anyone has experience implementing ESA in MATLAB or can point me to a useful resource, I’d be very grateful.

Thanks in advance!

7 commentaires

Posting the code could help.
There are any number of reasons for the author not having responded in the last 2+ days. I would not give up on that possibiity.

I will try to write the algorithm code myself during this time, and if it works, I will upload it here so others can use it as well.

When you get it working so that it can be put into a function, test it, document it, with internal comments to explain how it works as well as external documentation explaining how to use it, then upload it to the File Exchange.
Hi @Sina, Are you writing the Elephant Search Algorithm based on the following pseudocode guidance?
While you can randomly populate the male and female elephants of various ages within different search ranges and determine the current best location based on the best fitness, I do not understand whether the process of removing aging elephants and accounting for newly born baby elephants is absolutely necessary for the ESA iterations to efficiently continue searching until the number of training epochs reaches the predetermined limit.
Pseudocode for Elephant Search Algorithm:

Yes, I want to write the MATLAB code based on this pseudocode.

Since, unlike the PSO algorithm, each elephant in this algorithm does not remember the best position it has experienced, the concepts of death and birth are used to better cover the search space, prevent convergence to local optima, and maintain diversity.

For practical reasons, it's probably a good idea to run a simple script for one or two epochs before implementing the full iteration loop. This allows you to observe how the elephants (candidate solutions) move in the search space, whether they converge too quickly or spread out as expected. It saves time in debugging later, when analyzing results across many iterations would be more complex.
A simple convex test function for running the ESA script for two epochs would be a Quadratic Bowl function:
within the domain . The function is smooth and has a well-defined global minimum at , making it suitable for testing exploration behavior. You can initialize a small herd consisting of approximately 10 elephants and use the randi() function to maintain the candidate solutions in integer form.
Please remember to post the MATLAB script here for testing and discussion.

Thank you very much for your guidance. Your words will definitely help me a lot in doing this.

Connectez-vous pour commenter.

Réponses (2)

Sam Chak
Sam Chak le 7 Mar 2025
The most effective approach is to contact the authors, as the algorithm was originally coded in MATLAB. They would benefit from your efforts to popularize their algorithm and enhance their h-index ranking.

2 commentaires

Thank you very much for your guidance. I emailed the author of the paper to request the code.

Since my request might be declined, I would appreciate it if anyone who has the code could share it with me.

Although I wrote and sent my request to him with the utmost respect, I have not received any response from the author.

I have his paper available for those who can help with coding this algorithm.

Connectez-vous pour commenter.

Image Analyst
Image Analyst le 6 Mar 2025
You might find some interesting things in the File Exchange:
Looks like lots of elephants there.

7 commentaires

No! All of these are related to Elephant Herding Optimization (EHO), but I need the Elephant Search Algorithm. Anyway, thanks.

It seems like every animal has their own algorithm. There must be dozens of them. How is the elephant algorithm different than the numerous other animal-inspired algorithms?

The EHO algorithm is designed based on the social behavior of elephants and uses clans with female elephants to update positions. In contrast, the ESA not only utilizes elephant behavior but also incorporates an evolutionary mechanism, where male elephants are used for global search and female elephants for local search.

If you can tell us your true objectives of using only the ESA to solve optimization problem, perhaps we can advise one or two things.

I have a seminar in a few weeks, and one of the algorithms I need to use to solve an optimization problem is this algorithm.

I have the paper for this algorithm, but I don't have its MATLAB code.

If you can help me, I can provide you with the paper.

Unfortunately, I do not write optimizer code because I am not the inventor. It may be now to consider a Plan B while awaiting a response from the inventor of the ESA.
Since you still have time before the seminar, you can select another optimizer with which you feel confident and comfortable working. There are currently over 500 different metaheuristic optimization algorithms documented, some of which are available in MATLAB code on File Exchange and GitHub. You need not regard ESA as a Holy Grail-level optimizer.
I have a seminar in a few weeks, and one of the algorithms I need to use to solve an optimization problem is this algorithm.
Time to get writing the code yourself. No-one hanging around seems to have to code for it, and it is rather unlikely that anyone will volunteer to code it up just because you need it.

Connectez-vous pour commenter.

Question posée :

le 6 Mar 2025

Commenté :

le 11 Mar 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by