# Modification of Genetic Algorithm Based on Extinction Events and Migration
## Appendix A Gate Extinction Algorithm Code [63]  
```
1. clc
2. clear all
3. numb=10; % number of iteration
4. gen=2; % number of generation before changing... area of solution
5. pop=10; % population size
6. delta=0.20; % size of temporary area of solution... (% of solution area)
7. kill=3; % number of iteration between Great Extinctions
8. num_kill=3; % number of do not killed solutions in population,
9. %(num_kill best and num_kill worst survive)
10. lb_min=[0,0]; %lower boundary of area of solution
11. ub_max=[512,512]; %upper boundary of area of solution
12. f=GEgholder; %Eggholder function
13. % lb_min=[0,0];
14. % ub_max=[20,20];
15. % f=rastringis;
16. initial_pop=rand(pop,2)*2*ub_max(1)-ub_max(1);... %random generation of initial population
17. xx=initial_pop; %save initial population due to comprise
18. x=initial_pop(1,:); %initial center of temporary area of solution
19. % points to plot
20. All_agents=zeros(pop,2); yy=zeros(1); sc=zeros(pop,1);
21. for kk=1:num
22. options = optimoptions('ga','MaxGenerations',gen,... 'PopulationSize',pop,'InitialPopulationMatrix',... xx,'display','none','FunctionTolerance',0.1);%options of grate extinction algorithm
23. %modification of temporary area of solution
24. if mod(kk,kill)==1 && kk=\"kill %if great extinction,... then
25. lb=lb_min;
26. ub=ub_max;
27. else %modyi temporary area of solution as below
28. lb=x(1)-(ub_max(1)-lb_min(1))*delta,x(2)... -(ub_max(2)-lb_min(2))*delta];
29. ub=[x(1)+(ub_max(1)-lb_min(1))*delta,x(2)+... (ub_max(2)-lb_min(2))*delta];
30. for i=1:2 %if temporary area of solution... exceeds area of solution, cutting
31. if lb(i)<lb_min(i)
32. lb(i)=lb_min(i);
33. end if ub(i)>ub_max(i)
34. if ub(i)>ub_max(i)
35. ub(i)=ub_max(i);
36. end
37. end
38. [x,y,-,-pop_out,scores]=ga(f,2,[],[],[],[],lb,...
39. ub,[],[],options); %genetic algorithm
40. All_agents=[All_agents,pop_out]; yy=[yy,y];... sc=[sc,scores]; % points to plot
41. % sort population
42. pop_out=[pop_out,scores];
43. pop_out=sortrows(pop_out,3);
44. pop_out(:,3)=[];



* [PERSON] (2023) [PERSON] Parameter Optimization for an Accurate Swept-Sine Identification Procedure of Nonlinear Systems. _Appl. Sci._**2023**, _13_, 1223. [CrossRef]
* [PERSON] et al. (2019) [PERSON]; [PERSON]; [PERSON]; [PERSON] Design optimization of composite submerged cylindrical pressure hull using genetic algorithm and finite element analysis. _Ocean. Eng._**2019**, _190_, 106443. [CrossRef]
* [PERSON] et al. (2018) [PERSON]; [PERSON]; [PERSON] Blade shape optimization of the Savonius wind turbine using a genetic algorithm. _Appl. Energy_**2018**, _213_, 148-157. [CrossRef]
* [PERSON] et al. (2019) [PERSON]; [PERSON]; [PERSON]; [PERSON] The accuracy and efficiency of GA and PSO optimization schemes on estimating reaction kinetic parameters of biomass pyrolysis. _Energy_**2019**, _176_, 582-588. [CrossRef]
* [PERSON] (1992) [PERSON] Genetic Algorithms. _Sci. Am._**1992**, _267_, 66-73. Available online: [[http://papers.cumincad.org/data/works/att/7e68.content.pdf](http://papers.cumincad.org/data/works/att/7e68.content.pdf)]([http://papers.cumincad.org/data/works/att/7e68.content.pdf](http://papers.cumincad.org/data/works/att/7e68.content.pdf)) (accessed on 24 August 2022). [CrossRef]
* [PERSON] (2018) [PERSON]. A review of applications of genetic algorithms in operations management. _Eng. Appl. Artif. Intell._**2018**, _76_, 1-12. [CrossRef]
* [PERSON] et al. (2021) [PERSON]; [PERSON]; [PERSON] A review on genetic algorithm: Past, present, and future. _Multimed. Tools Appl._**2021**, _80_, 8091-8126. [CrossRef]
* [PERSON] and [PERSON] (1995) [PERSON]; [PERSON] Simulated Binary Crossover for Continuous Search Space. _Complex Syst._**1995**, \(9\), 115-148.