## Description

The paper published byÂ Yang, X. S. (2010). “A New Metaheuristic Bat-Inspired Algorithm, in: Nature Inspired Cooperative Strategies for Optimization (NISCO 2010)”.Â *Studies in Computational Intelligence*.Â **284**: 65â€“74 is implemented at https://free-thesis.com. A demo version of this is available hereÂ but we found it hard to use in any application. So developed in house full BAT code and happy to share here.

The Bats have some echolocation characteristics by using them we can develop an Algorithm for the optimization. Some rules for the Bat algorithm explained below.

- The distance can be sense by the bats using the echolocation and they have also difference between food/prey and the background barriers.
- The velocity of the Bats represented by (v
_{i}) and position of the Bat is (x_{i})having frequency F_{min}varying wavelength Â and loudness A_{0 }search for food. - The loudness A
_{0}also take as A_{min }constant value.

The Matlab coding for the Bat function done by consider various parameters. Various steps are involved for the Bat coding.

**Step1.**Â Firstly make the statement for Bat function

[bestfit,BestPositions,fmin,Convergence_curve]=BAT(N,Max_iter,lb,ub,dim,fobj)Â

In above statement the input parameter is mainly a benchmark function which is represented by a *â€˜fobjâ€™* and others are lb=lower bound limit and ub=upper bound limit , f_{max} is the maximum frequency and f_{min} is the minimum frequency , A= loudness of each Bat, r=pulse emission rate of each Bat, alpha and gamma are the constants for the loudness and pulse emission rate. The r_{0} is the initial pulse rate.

**Step2.** After the statement call the initialization function. The script for the initialization function written separately.

x=initialization(N, Max_iter, dim, ub, lb)Â Â Â

In initialization upper bound and lower bound limits are available and bats position is randomly search. Each bat has different upper and lower bound limits. There is N number of searching variable. Calculate the initial position of the search variable. We initialize the parameters of algorithm, generate and also evaluate the initial population, and then determine the best solution *Â *in the population. Here, virtual bats are moved in the search space according to updating rules of the bat algorithm.

**Step3. **Call the benchmark function here which is represented by the â€˜fobjâ€™and find the initial best fitness value for benchmark objective function.

The fobj function contains all the information about the benchmark function. It has 23 different benchmark function cases which have different dimension, upper bound and lower bound limits. We can randomly take any benchmark (F_{1 }â€¦..F_{23}) objective function.

The initial best value is obtained

[fmin, index]=min(fitness)Â

Also find the best solution for the best fitness value of the objective function.

**Step4. **Then start the main loop for the maximum iterations. Randomly choose the frequency as equation

Â F(ii)=Fmin+(Fmax-Fmin)*rand

Then update the velocity of the bats and position of the bats. After the update of both the terms than applied the upper and lower bound limits and update the position of bats again.

x(ii,:)=(x(ii,:).*(~(Flag4up+Flag4low)))+ub.*Flag4up+lb.*Flag4low

**Step5. **Check the condition of pulse rate emission of each bat (r). The factor 0.001 is limits the step size of the random walk.

rand>r(ii)Â

Find the new value of the objective after check the condition. It is the new fitness value in which the loudness is too much. The loudness and emission rate updated if the new solution is improved which means the bats moving towards the optimal solution. The condition for improve the loudness and pulse emission rate is

(fitnessnew<=fitness(ii)) && (rand<A(ii))Â A(ii)=alpha*A(ii) Â Â Â Â Â Â Â Â Â Â Â Â Â r(ii)=ro*(1-exp(-gamma*iter))Â Â Â Â Â Â Â Â

**Step6. **Calculate the best fitness value after optimization. Draw the convergence curve according to the best fitness value and iteration. The best position is also obtained through the optimization.

F_{min}=fitnessnew

**Step7. **Write another script for the observation of benchmark function. Initialize the parameters like N=number of searching Bats, any benchmark function (F_{1â€¦â€¦â€¦â€¦}F_{10}).

- Call the benchmark function- in this step all the bench mark function is called.
- Call the BAT function â€“ BAT function is calling in this step. The benchmark function initialize through the bat algorithm.
- Call the function plot for graphs and convergence curve for the benchmark function. The best position and best fitness value obtained by using the bat algorithm is shown by the curve.

In the general context of exploration and exploitation as well as genetic operators, we can analyze the roles of the main components of the standard BA. In essence, frequency tuning essentially acts as mutation because it varies the solutions mainly locally. However, if mutation is large enough, it can also leads to global search. Certain selection is carried out by applying a selection pressure that is relatively constant due to the use of the current best solution found so far. Compared with genetic algorithms, there is no explicit crossover; however, mutation varies due to the variations of loudness and pulse emission. On the other hand, the variations of loudness and pulse emission rates can also provide an auto zooming ability in the sense that exploitation becomes intensive as the search is approaching the global optimal. This essentially switches an exploitative phase to an exploitative phase automatically

The graph and curve which are obtained by using the BAT algorithm for the optimization of benchmark function.

The left hand side figure shows the parameter space for the benchmark function and right hand side figure shows the objective space of same benchmark function. The objective space curve is between the best fitness obtained value and iterations. The curve shows the minimum value of the objective function during the optimization. As shown in the curve the best fitness value near to 3.

We recommend our users to use the hybrid PSO-GWO optimization algorithm whose code is published here. https://free-thesis.com/product/hybrid-particle-swarm-and-grey-wolf-optimization/

4out of 5anujstaple(verified owner)–Good Product

5out of 5admin(verified owner)–Good Product

5out of 5Anonymous–Excellent

frank(verified owner)–good

frank(verified owner)–good

frank(verified owner)–perfect platform

enireddy.vamsidhar(verified owner)–good site for researchers

bayu permana.sejati(verified owner)–Good Job

taha.ansar(verified owner)–Should also give an example

Fawad(verified owner)–Excellent

venkat.reddy(verified owner)–great

venkat.reddy(verified owner)–great

raju.kumar(verified owner)–gandu

kaju.kumar(verified owner)–gaandu

praveen.hipparge(verified owner)–good

shiffali.goyal(verified owner)–Gr8

ramahk92(verified owner)–Thanks for Providing Code.

alok.kumar(verified owner)–Thanks for your support.

k.l(verified owner)–good

sameer.kumthekar(verified owner)–best

sameer.kumthekar(verified owner)–best one

preethi.g(verified owner)–good

treesa.jose(verified owner)–good

xuexi(verified owner)–good

javier.carletto(verified owner)–b

cynthia.joseph(verified owner)–excellent

richa.singh(verified owner)–nice

ratheesh.p m(verified owner)–Very Useful

ratheesh.p m(verified owner)–Very USeful

ratheesh.p m(verified owner)–Useful

ratheesh.p m(verified owner)–Useful

ratheesh.p m(verified owner)–helpful

ratheesh.p m(verified owner)–useful

nishant.tripathi(verified owner)–too good

umit.cetinkaya(verified owner)–It is so good

priya.lollmun(verified owner)–thanks

m.m(verified owner)–dsdg

1316893612(verified owner)–1

otuo.acheampong(verified owner)–very useful website

otuo.acheampong(verified owner)–very useful website

daniela.irimia(verified owner)–Usefull, I hope!

chou_aib(verified owner)–great

brandon.calder(verified owner)–good

thiyagarajan.n(verified owner)–good

thiyagarajan.n(verified owner)–good

thiyagarajan.n(verified owner)–good

thiyagarajan.n(verified owner)–good

kshitiz.varma(verified owner)–Good Initiative

chou_aib(verified owner)–Great

harshithraj.k m(verified owner)–its good

karthik.m(verified owner)–Excellent

vishnupriya.vijayan(verified owner)–nice job!!!

maria.gonzales huamani(verified owner)–gracias, de gran ayuda

saranya.gunasekar(verified owner)–need some additional details

virakwan.kelian(verified owner)–good

MadhuSudhan Reddy(verified owner)–good

saranya.gunasekar(verified owner)–very helpful

anuj.goel(verified owner)–Thank you !

john.seed(verified owner)–good

john.seed(verified owner)–good

omid.mokhlessi(verified owner)–thank you

omid.mokhlessi(verified owner)–thank you

omid.mokhlessi(verified owner)–thank you very much

hamdi.karim(verified owner)–thnx

thiyagarajan.n-1218(verified owner)–nice

thiyagarajan.n-1218(verified owner)–goood

sumeet(verified owner)–hu

sumeet(verified owner)–bjbjnk

sumeet(verified owner)–bjbj

nenisi.j(verified owner)–heh

zeamari.ilias(verified owner)–Best Articles are found here.

mohamed.elkhayat(verified owner)–good

subhashis.kar(verified owner)–Outstanding