[optimization solution] Based on biogeography combined with gravity search optimization algorithm matlab source code

1, Gravity search algorithm

  1.1BBO algorithm

Biogeographic optimization algorithm (BBO) is an algorithm developed based on biogeographic theory proposed by Dan Simon in 2008. Similar to other intelligent algorithms, BBO is also an algorithm based on population optimization, but it regards each solution in the population as a habitat, the fitness of the solution as the HSI of the habitat, and each component of the solution is a SIV. It continuously evolves the population by simulating the migration and variation process in biogeography, so as to solve the optimization problem. The two main operations of BBO algorithm are migration operation and mutation operation.

1, Migration operation

BBO algorithm regards each solution of the optimization problem as a habitat. The higher the fitness of the solution, the more species the habitat has, the higher the emigration rate and the lower the emigration rate; on the contrary, the lower the fitness of the solution, the lower the corresponding emigration rate and the higher the emigration rate.
The purpose of migration operation is to share information among different solutions. The good solution tends to spread its own information to other solutions, while the poor solution tends to receive information from other solutions. In the specific implementation, each iteration of BBO algorithm will examine each solution H(i) in the population, and set its migration rate and migration rate as follows: λ( i) And μ( i) , then each component has λ The probability of I being modified (i.e. moving in); If you want to move in, select a migration solution H(j) from the population with the probability of migration out rate, and then replace the current component of H(i) with the corresponding component of Hj. After the above operations are performed on all components of H(i), a new solution H '(I) is generated. The algorithm compares the fitness of H(i) and H '(I), and retains the one with higher fitness in the population.
The process of the above migration operation can be described by the pseudo code shown below in the algorithm process, where D represents the dimension of the problem, that is, the length of the solution vector, and rand() is used to generate a random number in [0,1].

2, Mutation operation

Some major emergencies will dramatically change some properties of a natural habitat, thus changing SHI and leading to significant changes in the number of species. BBO algorithm models this situation as SIV variation. When the number of species is too large or too small, the probability of species number is relatively low; Under the medium number of species (close to the equilibrium point), the probability of species number is high. It can be seen that the probability of the above species refers to a centrosymmetric distribution, as shown in the figure below.

Assuming that the required solution is a continuous optimization problem, and the value range of dimension d of the problem is [ld,ud], the mutation operation process of BBO can be described by the pseudo code of the algorithm process shown in the figure below.

summary

Because of the novelty of evolutionary mechanism, BBO algorithm has attracted the attention of many scholars in the field of computational intelligence. Although many important achievements have been made, compared with other evolutionary algorithms, its more in-depth theoretical research, including parameter selection, complexity analysis, fitness function design and the application of the algorithm in engineering practice, needs to be expanded.

1.2 gravity search algorithm

Gravitational Search Algorithm (GSA) is a random heuristic search algorithm proposed by Esmat Rashedi et al. In 2009. This algorithm is inspired by Newton's law of universal gravitation and law of motion: 1. Any two particles attract each other through the force in the direction of the connecting line, The magnitude of this attraction is directly proportional to the product of their masses and inversely proportional to the square of their distance. 2. Force causes the object to gain acceleration.

In GSA, a particle is abstracted as a solution in the solution space. There is a mutual attraction between the solutions. This attraction is determined by the quality of the solution and the distance between the two solutions. The quality of the particle is abstracted as the evaluation function value of the solution. In the solution space, the acceleration of each solution is obtained by the attraction of other solutions, and the acceleration provided by greater mass (better evaluation function value) makes the solution move in the direction of better solution.

Here, some small partners will think that GSA is an algorithm similar to PSO. Yes, the outer framework of GSA and PSO is the same, but their key particle movement strategies are different:

1. In PSO, only two optimal positions pbest and gbest are used for particle movement. However, in GSA, the direction of the agent is calculated according to the total force obtained by all other agents or some better agents.
2.PSO uses a memory to update speed (due to pbest and gbest). However, GSA has no memory, and only the current location of the agent plays a role in the update process.
3. In PSO, the update does not consider the distance between solutions, while in GSA, the force is inversely proportional to the distance between solutions.
4.PSO simulates the social behavior of birds, while GSA is inspired by physical phenomena.

The main process of GSA is as follows:

1. Determine the search space.
2. Randomly initialize the individual population.
3. Evaluate the fitness of the population.
4. Update the gravitational constant G, update the best and worst individuals in the population, and update the quality of individuals.
5. Calculate the total gravity of each individual in different directions.
6. Calculate the individual acceleration and update the individual speed based on this.
7. Update the position of the individual in the solution space according to the speed.
8. Repeat steps 3-7 until the stop criteria are met.

Algorithm flow:

2, Partial code

% GSA-BBO HYBRIDIZATION ALGORITHM CODE
% SAJAD AHMAD RATHER
% 11/03/2016,05:55 PM
% Main function for using GSA algorithm.
clear all;clc
% inputs:
% N:  Number of agents.
% max_it: Maximum number of iterations (T).
% ElitistCheck: If ElitistCheck=1, algorithm runs with eq.21 and if =0, runs with eq.15.
% Rpower: power of 'R' in eq.28.
% F_index: The index of the test function. See tables 1,2,3 of the mentioned article.
% Insert your own objective function with a new F_index in 'test_functions.m'
% and 'test_functions_range.m'.
% outputs:
% Fbest: Best result. 
% Lbest: Best solution. The location of Fbest in search space.
% BestChart: The best so far Chart over iterations. 
% MeanChart: The average fitnesses Chart over iterations.
% n=Smax:Maximum number of species
% Pos:original population size
k= 2; % elitism parameter: how many of the best habitats to keep from one generation to the next
I = 1; % max immigration rate for each island
E1 = 1; % max emigration rate, for each island
N=50; 
Siv=4;%Suitability index variables(e.g;land,temperature,rainfall,diversity of vegetation) 
n=N;
Pos=N;
max_it=1000;
ElitistCheck=1; 
Rpower=1;
min_flag=1; % 1: minimization 0: maximization
F_index=1
[Fbest,Lbest,BestChart,MeanChart]=GSA(F_index,N,max_it,ElitistCheck,min_flag,Rpower,k,I,E1,Pos,Siv,n);Fbest,
semilogy(MeanChart,'--k');
title(['\fontsize{12}\bf F',num2str(F_index)]);
xlabel('\fontsize{12}\bf Iteration');ylabel('\fontsize{12}\bf  Average Best-so-far');
legend('\fontsize{10}\bf GSA-BBO',1);

3, Simulation results

 

4, References

Sajad Ahmad Rather (2021). GSA-BBO HYBRIDIZATION ALGORITHM

Tags: MATLAB Algorithm Autonomous vehicles

Posted on Sat, 04 Sep 2021 19:30:34 -0400 by lesliesathish