# 【智能优化算法-热交换法算】基于热交换优化算法求解多目标优化问题附matlab代码

+关注继续查看

## 2 仿真代码

%__________________________________________________________________ %

%                                                                   %

%                                                                   %

%          MOTEO: a novel multi-objective thermal exchange          %

clc;

clear;

close all;

%% Problem Definition

CostFunction=@(x) ZDT1(x);      % Cost Function

nVar=10;             % Number of Decision Variables

VarSize=[1 nVar];   % Size of Decision Variables Matrix

VarMin=0;          % Lower Bound of Variables

VarMax=1;          % Upper Bound of Variables

% Number of Objective Functions

nObj=numel(CostFunction(unifrnd(VarMin,VarMax,VarSize)));

c1=1.1;               % Personal Learning Coefficient

c2=c1*2;            % Global Learning Coefficient

%% MOTEO Parameters

MaxIt=1000;      % Maximum Number of Iterations

nPop=100;        % Population Size

pCrossover=0.7;                         % Crossover Percentage

nCrossover=2*round(pCrossover*nPop/2);  % Number of Parnets (Offsprings)

pMutation=0.4;                          % Mutation Percentage

nMutation=round(pMutation*nPop);        % Number of Mutants

mu=0.02;                    % Mutation Rate

sigma=0.1*(VarMax-VarMin);  % Mutation Step Size

%% MOTEO Initialization

empty_individual.Position=[];

empty_individual.Cost=[];

empty_individual.Rank=[];

empty_individual.DominationSet=[];

empty_individual.DominatedCount=[];

empty_individual.CrowdingDistance=[];

pop=repmat(empty_individual,nPop,1);

for i=1:nPop

pop(i).Position=unifrnd(VarMin,VarMax,VarSize);

pop(i).Cost=CostFunction(pop(i).Position);

end

% Non-Dominated Sorting

[pop, F]=NonDominatedSorting(pop);

% Calculate Crowding Distance

pop=CalcCrowdingDistance(pop,F);

% Sort Population

[pop, F]=SortPopulation(pop);

%% MOTEO Main Loop

for it=1:MaxIt

% Crossover

popc=repmat(empty_individual,nCrossover/2,2);

for k=1:nCrossover/2

i1=randi([1 nPop]);

p1=pop(i1);

i2=randi([1 nPop]);

p2=pop(i2);

MaxRank=max([pop.Rank]);

c=c1+c2*(MaxIt-it)/MaxIt;

ratio=it/MaxIt;

[popc(k,1), popc(k,2)]=Crossover(p1,p2,MaxRank,c,ratio);

popc(k,1).Position=max(min(popc(k,1).Position,VarMax),VarMin);

popc(k,2).Position=max(min(popc(k,2).Position,VarMax),VarMin);

popc(k,1).Cost=CostFunction(popc(k,1).Position);

popc(k,2).Cost=CostFunction(popc(k,2).Position);

end

popc=popc(:);

% Mutation

popm=repmat(empty_individual,nMutation,1);

for k=1:nMutation

i=randi([1 nPop]);

p=pop(i);

popm(k).Position=Mutate(p.Position,mu,sigma);

popm(k).Position=max(min(popm(k).Position,VarMax),VarMin);

popm(k).Cost=CostFunction(popm(k).Position);

end

% Merge

pop=[pop

popc

popm]; %#ok

% Non-Dominated Sorting

[pop, F]=NonDominatedSorting(pop);

% Calculate Crowding Distance

pop=CalcCrowdingDistance(pop,F);

% Sort Population

pop=SortPopulation(pop);

% Truncate

pop=pop(1:nPop);

% Non-Dominated Sorting

[pop, F]=NonDominatedSorting(pop);

% Calculate Crowding Distance

pop=CalcCrowdingDistance(pop,F);

% Sort Population

[pop, F]=SortPopulation(pop);

% Store F1

F1=pop(F{1});

% Show Iteration Information

disp(['Iteration ' num2str(it) ': Number of F1 Members = ' num2str(numel(F1))]);

% Plot F1 Costs

PlotCost(F1);

pause(0.01);

%

end

%% Results

## 4 参考文献

[1]杨明昊, 李云龙. 基于热交换优化算法的多阈值图像分割方法[J]. 科技创新与生产力, 2019(5):3.

[2]李云龙, 杨明昊. 基于莱维飞行的热交换优化算法[J]. 科技创新与生产力, 2019(6):3.

### 博主简介：擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真，相关matlab代码问题可私信交流。

|
2月前
|

SSA-ELM回归预测 | Matlab 基于麻雀优化算法优化极限学习机的回归预测
SSA-ELM回归预测 | Matlab 基于麻雀优化算法优化极限学习机的回归预测
35 0
|
2月前
|

SSA-KELM分类预测 | Matlab麻雀优化算法优化核极限学习机分类预测
SSA-KELM分类预测 | Matlab麻雀优化算法优化核极限学习机分类预测
36 0
|
2月前
|

SMA-KELM分类预测 | Matlab黏菌优化算法优化核极限学习机分类预测
SMA-KELM分类预测 | Matlab黏菌优化算法优化核极限学习机分类预测
23 1
|
2月前
|

FOA-BP分类预测 | Matlab果蝇优化算法优化BP神经网络分类预测
FOA-BP分类预测 | Matlab果蝇优化算法优化BP神经网络分类预测
31 0
|
2月前
|

SMA-BP分类预测 | Matlab黏菌优化算法优化BP神经网络分类预测
SMA-BP分类预测 | Matlab黏菌优化算法优化BP神经网络分类预测
55 0
|
2月前
|

PSO-BP分类预测 | Matlab粒子群优化算法优化BP神经网络分类预测
PSO-BP分类预测 | Matlab粒子群优化算法优化BP神经网络分类预测
41 0
|
3月前
|

32 0
|
3月前
|

GWO-LSTM回归预测 | Matlab灰狼优化算法优化长短时记忆网络回归预测
GWO-LSTM回归预测 | Matlab灰狼优化算法优化长短时记忆网络回归预测
37 0
|
3月前
|

SMA-BP回归预测 | Matlab 黏菌优化算法优化BP神经网络回归预测
SMA-BP回归预测 | Matlab 黏菌优化算法优化BP神经网络回归预测
26 0
|
3月前
|

WOA-BP回归预测 | Matlab 鲸鱼优化算法优化BP神经网络回归预测
WOA-BP回归预测 | Matlab 鲸鱼优化算法优化BP神经网络回归预测
38 0