资源简介
侵入性杂草优化(IWO)是自然启发式的元启发式方法,受杂草的传播策略启发,由Alireza Mehrabian和Caro Lucas于2006年提出。在本文中,我们将与您分享MATLAB中侵入性杂草优化(IWO)的结构化开源实现。

代码片段和文件信息
clc;
clear;
close all;
%% Problem Definition
CostFunction = @(x) Sphere(x); % objective Function
nVar = 5; % Number of Decision Variables
VarSize = [1 nVar]; % Decision Variables Matrix Size
VarMin = -10; % Lower Bound of Decision Variables
VarMax = 10; % Upper Bound of Decision Variables
%% IWO Parameters
MaxIt = 200; % Maximum Number of Iterations
nPop0 = 10; % Initial Population Size
nPop = 25; % Maximum Population Size
Smin = 0; % Minimum Number of Seeds
Smax = 5; % Maximum Number of Seeds
Exponent = 2; % Variance Reduction Exponent
sigma_initial = 0.5; % Initial Value of Standard Deviation
sigma_final = 0.001; % Final Value of Standard Deviation
%% Initialization
% Empty Plant Structure
empty_plant.Position = [];
empty_plant.Cost = [];
pop = repmat(empty_plant nPop0 1); % Initial Population Array
for i = 1:numel(pop)
% Initialize Position
pop(i).Position = unifrnd(VarMin VarMax VarSize);
% Evaluation
pop(i).Cost = CostFunction(pop(i).Position);
end
% Initialize Best Cost History
BestCosts = zeros(MaxIt 1);
%% IWO Main Loop
for it = 1:MaxIt
% Update Standard Deviation
sigma = ((MaxIt - it)/(MaxIt - 1))^Exponent * (sigma_initial - sigma_final) + sigma_final;
% Get Best and Worst Cost Values
Costs = [pop.Cost];
BestCost = min(Costs);
WorstCost = max(Costs);
% Initialize Offsprings Population
newpop = [];
% Reproduction
for i = 1:numel(pop)
ratio = (pop(i).Cost - WorstCost)/(BestCost - WorstCost);
S = floor(Smin + (Smax - Smin)*ratio);
for j = 1:S
% Initialize Offspring
newsol = empty_plant;
% Generate Random Location
newsol.Position = pop(i).Position + sigma * randn(VarSize);
% Apply Lower/Upper Bounds
newsol.Position = max(newsol.Position VarMin);
newsol.Position = min(newsol.Position VarMax);
% Evaluate Offsring
newsol.Cost = CostFunction(newsol.Position);
% Add Offpsring to the Population
newpop = [newpop
newsol]; %#ok
end
end
% Merge Populations
pop = [pop
newpop];
% Sort Population
[~ SortOrder]=sort([pop.Cost]);
pop = pop(SortOrder);
% Competitive Exclusion (Delete Extra Members)
if numel(pop)>nPop
pop = pop(1:nPop);
end
% Store Best Solution Ever Found
BestSol = pop(1);
% Store Best Cost History
BestCosts(it) = BestSol.Cost;
% Display Iteration Information
disp([‘Iteration ‘ num2str(it) ‘: Best Cost = ‘ num2str(BestCosts(it))]);
end
%% Results
f
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3132 2019-12-24 19:50 入侵杂草优化IWO\iwo.m
文件 10 2019-12-24 19:50 入侵杂草优化IWO\main.m
文件 55 2019-12-24 19:50 入侵杂草优化IWO\Sphere.m
目录 0 2019-12-24 19:49 入侵杂草优化IWO
----------- --------- ---------- ----- ----
3197 4
- 上一篇:混合蛙跳算法SFLA的matlab实现
- 下一篇:CMA-ES的matlab实现
相关资源
- 串行级联cpm系统MATLAB仿真
- 基于小波变换的数字水印算法115024
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
评论
共有 条评论