CEC2013 (MATLAB): Genetic Algorithm (GA) solves 28 functions of CEC2013

1. Genetic Algorithm GA

Genetic Algorithm (GA) originated from the computer simulation research on biological systems. It is a stochastic global search optimization method that simulates the replication, crossover and mutation that occur in natural selection and heredity. Starting from any initial population (Population), through random selection, crossover and mutation operations, a group of individuals more suitable for the environment is generated, so that the group evolves to a better and better area in the search space, so that generation after generation continues to reproduce and evolve. Finally, it converges to a group of individuals (Individual) who are most suitable for the environment, so as to obtain a high-quality solution to the problem.

2. Introduction to cec2013

There are 28 test functions in the CEC 2013 Special Session on Real-Parameter Optimization, and their dimensions can be selected as 10/30/50/100. The details of each test function are shown in the table below:

references:

[1] Liang J J , Qu B Y , Suganthan P N ,et al.Problem Definitions and Evaluation Criteria for the CEC 2013 Special Session on Real-Parameter Optimization[J]. 2013.

3. GA solves CEC2013

Test different functions in the code and modify the value of Function_name. The dimension dim of each function can be selected as 10/30/50/100. The population size SearchAgents_no and the maximum number of iterations Max_iteration can be modified as needed.

(1) Partial code

%%
close all
clear 
clc
Function_name=1; %测试函数可以选择 1-28
dim=10;%维度可以选择 10/30/50/100
SearchAgents_no=100; % 种群大小(可以自己修改)
Max_iteration=1000; % 最大迭代次数(可以自己修改)
[Fun_Name,lb,ub,opt_f,err] = get_fun_info_CEC2013(Function_name,dim);
fob=str2func('cec13_0');
fobj=@(x)Fun(x,fob,Function_name,opt_f);
[fMin,bestX,curve]=GA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
figure
plot(curve,'Color','r','linewidth',2.5)
title(Fun_Name)
xlabel('Iteration');
ylabel('Best score obtained so far');
grid on
legend('GA')
display(['The best solution obtained by GA is : ', num2str(bestX)]);
display(['The best optimal value of the objective funciton found by GA is : ', num2str(fMin)]);

(2) Partial results (take F1, F5 and F10 as examples)

4. Complete MATLAB code

Guess you like

Origin blog.csdn.net/weixin_46204734/article/details/132202629