1 简介
Gravitational search algorithm is a popular adaptivesearch algorithm among nature-inspired algorithms and hasbeen successfully used for optimizing many real-world problems.Gravitational search algorithm uses the law of Newton gravityfor fifinding the optimal solution. The performance of gravitationalsearch algorithm is controlled by exploration and exploitationcapabilities and Kbest is one of its parameters that controlsthis trade-off. In this paper, a novel chaotic Kbest gravitationalsearch algorithm has been proposed that uses the chaotic modelin Kbest to balance the exploration and exploitation nonlinearly. The proposed algorithm shows better convergence rateat later iterations with high precision and does not trap intolocal optima.The experimental results validate that the proposedalgorithm outperforms.
2 部分代码
% Gravitational Search Algorithm.
function BestChart=GSA(F_index,N,max_it,ElitistCheck,chaosIndex,chValueInitial)
%V: Velocity.
%a: Acceleration.
%M: Mass. Ma=Mp=Mi=M;
%dim: Dimension of test function.
%N: Number of agents.
%X: Position of agents. dim-by-N matrix.
%R: Distance between agents in search space.
%[low-up]: Allowable range for search space.
%Rnorm: Norm in eq.8.
%Rpower: Power of R in eq.7.
G_History=zeros(1,max_it);
Rnorm=2;
Rpower=1;
min_flag=1; % 1: minimization, 0: maximization
%get allowable range and dimension of the test function.
[low,up,dim]=test_functions_range(F_index);
%random initialization for agents.
X=initialization(dim,N,up,low);
%create chart of best so far and average fitnesses.
BestChart=[];MeanChart=[];
V=zeros(dim,N);
wMax=chValueInitial;
wMin=1e-10;
for iteration=1:max_it
chValue=wMax-iteration*((wMax-wMin)/max_it);
% iteration
%Checking allowable range.
X=space_bound(X,up,low);
%Evaluation of agents.
fitness=evaluateF(X,F_index);
[best best_X]=min(fitness); %min: minimization. max: maximization.
if iteration==1
Fbest=best;Lbest=X(:,best_X);
end
if best<Fbest % < : minimization. > : maximization
Fbest=best;Lbest=X(:,best_X);
end
BestChart=[BestChart Fbest];
MeanChart=[MeanChart mean(fitness)];
%Calculation of M. eq.14-20
[M]=massCalculation(fitness,min_flag);
%Calculation of Gravitational constant. eq.13.
G=Gconstant(iteration,max_it);
%G=chaos(3,iteration,max_it,10);
switch chaosIndex
case 1
G=Gconstant(iteration,max_it);
case 2
G=G+chaos(chaosIndex-1,iteration,max_it,chValue);
case 3
G=G+chaos(chaosIndex-1,iteration,max_it,chValue);
case 4
G=G+chaos(chaosIndex-1,iteration,max_it,chValue);
case 5
G=G+chaos(chaosIndex-1,iteration,max_it,chValue);
case 6
G=G+chaos(chaosIndex-1,iteration,max_it,chValue);
case 7
G=G+chaos(chaosIndex-1,iteration,max_it,chValue);
case 8
G=G+chaos(chaosIndex-1,iteration,max_it,chValue);
case 9
G=G+chaos(chaosIndex-1,iteration,max_it,chValue);
case 10
G=G+chaos(chaosIndex-1,iteration,max_it,chValue);
case 11
G=G+chaos(chaosIndex-1,iteration,max_it,chValue);
end
G_History(iteration)=G;
test_G(iteration)=G;
if iteration==499
alisop=0;
end
%Calculation of accelaration in gravitational field. eq.7-10,21.
a=Gfield(M,X,G,Rnorm,Rpower,ElitistCheck,iteration,max_it);
%Agent movement. eq.11-12
[X,V]=move(X,a,V);
end %iteration
3 仿真结果
4 参考文献
B. Zibanezhad, K. Zamanifar, N. Nematbakhsh, and F. Mardukhi, “Anapproach for web services composition based on qos and gravitationalsearch algorithm,” in Innovations in Information Technology, 2009.IIT’
International Conference on, 2009.[6] C. Lopez-Molina, H. Bustince, J. Fern´andez, P. Couto, and B. De Baets,“A gravitational approach to edge detection based on triangular norms,”Pattern Recognition, vol. 43, pp. 3730–3741, 2010.