✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
针对约束优化问题,提出了一种新的进化算法——进化匹配算法(EMA)。该算法采用哈代-温伯格平衡和交叉指数中的随机交配概念,以产生新的后代。在该算法中,环境因素的影响(即捕食者的存在)也被视为一种探索性机制。
⛄ 部分代码
%_________________________________________________________________________________
% Main program for EMA Version 1 solution published in NCAA
%_________________________________________________________________________________
clear all
clc
format long e;
SearchAgents_no=30; % Number of search agents
Function_name='F12'; % Name of the test function that can be from F1 to F23
Max_iteration=500; % Maximum numbef of iterations
% Load details of the selected benchmark function
[lb,ub,dim,fobj]=Get_Functions_details(Function_name);
[Target_score,Target_pos,Cg_curve, Trajectories,fitness_history, position_history]=EMA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
display(['The best solution obtained by OPTIMIZER is : ', num2str(Target_pos)]);
display(['The best optimal value of the objective function found by OPTIMIZER is : ', num2str(Target_score)]);
% 1、画出所选基准函数的三维立体图形
figure;
subplot(121)
func_plot(Function_name);
title(Function_name)
xlabel('x_1');
ylabel('x_2');
zlabel([Function_name,'( x_1 , x_2 )'])
% 2、画出目标函数值变化曲线图
subplot(122)
t = 1:Max_iteration;
semilogy(t,Cg_curve, 'm-','linewidth', 2, 'MarkerSize', 8);
title(Function_name)
xlabel('Iteration');
ylabel('Fitness');
axis fill
grid on
box on
legend('EMA');
⛄ 运行结果