-
Notifications
You must be signed in to change notification settings - Fork 0
/
FATA.m
106 lines (93 loc) · 4.12 KB
/
FATA.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
% 📜 FATA Optimization source codes (version 1.0)
% 🌐 Website and codes of FATA: An Efficient Optimization Method Based on Geophysics:
% 🔗 http://www.aliasgharheidari.com/FATA.html
% 👥 Ailiang Qi, Dong Zhao, Ali Asghar Heidari, Lei Liu, Yi Chen, Huiling Chen
% 📅 Last update: 8 6 2024
% 📧 E-Mail: q17853118231@163.com, as_heidari@ut.ac.ir, aliasghar68@gmail.com, chenhuiling.jlu@gmail.com
% 📜 After use of code, please users cite to the main paper on FATA: An Efficient Optimization Method Based on Geophysics:
% Ailiang Qi, Dong Zhao, Ali Asghar Heidari, Lei Liu, Yi Chen, Huiling Chen
% FATA: An Efficient Optimization Method Based on Geophysics
% Neurocomputing - 2024, DOI: https://doi.org/10.1016/j.neucom.2024.128289
%----------------------------------------------------------------------------------------------------------------------------------------------------%
% 📊 You can use and compare with other optimization methods developed recently:
% - (ECO) 2024: 🔗 http://www.aliasgharheidari.com/ECO.html
% - (AO) 2024: 🔗 http://www.aliasgharheidari.com/AO.html
% - (PO) 2024: 🔗 http://www.aliasgharheidari.com/PO.html
% - (RIME) 2023: 🔗 http://www.aliasgharheidari.com/RIME.html
% - (INFO) 2022: 🔗 http://www.aliasgharheidari.com/INFO.html
% - (RUN) 2021: 🔗 http://www.aliasgharheidari.com/RUN.html
% - (HGS) 2021: 🔗 http://www.aliasgharheidari.com/HGS.html
% - (SMA) 2020: 🔗 http://www.aliasgharheidari.com/SMA.html
% - (HHO) 2019: 🔗 http://www.aliasgharheidari.com/HHO.html
%____________________________________________________________________________________________________________________________________________________%
%% Fata morgana algorithm .Qi A
function [bestPos,gBestScore,cg_curve]=FATA(fobj,lb,ub,dim,N,MaxFEs)
% initialize position
worstInte=0; %Parameters of Eq.(4)
bestInte=Inf;%Parameters of Eq.(4)
noP=N;
arf=0.2;%Eq. (15) reflectance=0.2
gBest=zeros(1,dim);
cg_curve=[];
gBestScore=inf;%change this to -inf for maximization problems
Flight=initialization(noP,dim,ub,lb);%Initialize the set of random solutions
fitness=zeros(noP,1)+inf;
% it=1;%Number of iterations
it=1;
FEs=0;
lb=ones(1,dim).*lb; % lower boundary
ub=ones(1,dim).*ub; % upper boundary
% Main
while FEs < MaxFEs
for i=1:size(Flight,1)
Flag4ub=Flight(i,:)>ub;
Flag4lb=Flight(i,:)<lb;
Flight(i,:)=(Flight(i,:).*(~(Flag4ub+Flag4lb)))+ub.*Flag4ub+lb.*Flag4lb;
FEs=FEs+1;
fitness(i)=fobj(Flight(i,:));
%Make greedy selections
if(gBestScore>fitness(i))
gBestScore=fitness(i);
gBest=Flight(i,:);
end
end
[Order,Index] = sort(fitness);
worstFitness = Order(N);
bestFitness = Order(1);
%% The mirage light filtering principle
Integral=cumtrapz(Order);
if Integral(N)>worstInte
worstInte=Integral(N);
end
if Integral(N)<bestInte
bestInte =Integral(N);
end
IP=(Integral(N)-worstInte)/(bestInte-worstInte+eps);% Eq.(4) population quality factor
%% Calculation Para1 and Para2
a = tan(-(FEs/MaxFEs)+1);
b = 1/tan(-(FEs/MaxFEs)+1);
%%
for i=1:size(Flight,1)
Para1=a*rand(1,dim)-a*rand(1,dim); %Parameters of Eq.(10)
Para2=b*rand(1,dim)-b*rand(1,dim);%Parameters of Eq.(13)
p=((fitness(i)-worstFitness))/(gBestScore-worstFitness+eps);% Parameters of Eq.(5) individual quality factor
%% Eq.(1)
if rand>IP
Flight(i,:) = (ub-lb).*rand+lb;
else
for j=1:dim
num=floor(rand*N+1);
if rand<p
Flight(i,j)=gBest(j)+Flight(i,j).*Para1(j);%Light refraction(first phase) Eq.(8)
else
Flight(i,j)=Flight(num,j)+Para2(j).*Flight(i,j);%Light refraction(second phase) Eq.(11)
Flight(i,j)=(0.5*(arf+1).*(lb(j)+ub(j))-arf.*Flight(i,j));%Light total internal reflection Eq.(14)
end
end
end
end
cg_curve(it)=gBestScore;
it=it+1;
bestPos=gBest;
end
end