【智能优化算法】基于文化和谐和学习算法优化模糊函数FUZZY附matlab代码
【智能优化算法】基于文化和谐和学习算法优化模糊函数FUZZY附matlab代码
TT_Matlab
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,完整matlab代码或者程序定制加qq1575304183。
1 简介
This paper studies the constrained optimization problem for nonlinear diesel blending. A new hybrid algorithm called cultural harmony search algorithm is presented to solve the proposed optimization problem, which uses cultural knowledge in the belief space of the cultural algorithm to guide the evolving and searching process of the harmony search algorithm. Then, an improved harmony improvisation in the population space of cultural algorithm is developed for new harmony generation to enrich the population diversity. Moreover, in order to accelerate convergence, the domain of decision variables is scaled down by a simplex method at the beginning of the algorithm, and a simplex improved cultural harmony search algorithm is provided. Finally, benchmark functions and the results of application in nonlinear diesel blending of a real-world refinery show the feasibility and effectiveness of the proposed algorithms. The contrasted experiments show that our proposed hybrid algorithm is better than other hybrid algorithms, especially in diesel blending optimization problem.
2 部分代码
%% Cultural Harmony Learning Algorithm - Created
in
18
Jan
2022
by
Seyed Muhammad Hossein Mousavi
% Here
is
all about learning with evolutionary algorithms. Harmony search
% and cultural algorithms are two fast optimization algorithms which their
% result are combined here
in
order to train inputs
for
targets
in
a simple
% dataset. Basically, system starts with making initial fuzzy model and fit
% the outputs based
on
inputs
by
harmony search first and then tries to fit the
% harmony search outputs with inputs
in
the second stage. That means we are
using
both
% evolutionary algorithms to improve the accuracy. System easily could be
% used
for
regression, classification and other optimization tasks. You can
%% Cleaning
clc;
clear;
warning(
’off’
);
%% Data Loading
data=JustLoad();
%% Generate Basic Fuzzy Model
% Number of Clusters
in
FCM
ClusNum=
4
;
%
fis=GenerateFuzzy(data,ClusNum);
%
%% Tarining Cultural Harmony Algorithm
% Harmony Search Learning
HarFis=hars(fis,data);
% Harmony Cultural Algorithm Learning
CAHSfis=CulturalFCN(HarFis,data);
%%
Plot Cultural Harmony
Results
(
Train - Test
)
% Train Output Extraction
TrTar
=data.TrainTargets;
TrainOutputs=evalfis(data.TrainInputs,CAHSfis);
% Test Output Extraction
TsTar=data.TestTargets;
TestOutputs=evalfis(data.TestInputs,CAHSfis);
% Train calc
Errors=data.TrainTargets-TrainOutputs;
MSE=mean(Errors.^
2
);RMSE=sqrt(MSE);
error_mean=mean(Errors);error_std=std(Errors);
% Test calc
Errors1=data.TestTargets-TestOutputs;
MSE1=mean(Errors1.^
2
);RMSE1=sqrt(MSE1);
error_mean1=mean(Errors1);error_std1=std(Errors1);
%
Train
figure
(
’units’
,
’normalized’
,
’outerposition’
,[
0
0
1
1
]
)
subplot
(
3
,
2
,
1
)
;
plot(data.TrainTargets,
’c’
);
hold
on
;
plot(TrainOutputs,
’k’
);legend(
’Target’
,
’Output’
);
title(
’Cultural Harmony Training Part’
);xlabel(
’Sample Index’
);grid
on
;
%
Test
subplot
(
3
,
2
,
2
)
;
plot(data.TestTargets,
’c’
);
hold
on
;
plot(TestOutputs,
’k’
);legend(
’Cultural Harmony Target’
,
’Cultural Harmony Output’
);
title(
’Cultural Harmony Testing Part’
);xlabel(
’Sample Index’
);grid
on
;
%
Train
subplot
(
3
,
2
,
3
)
;
plot(Errors,
’k’
);legend(
’Cultural Harmony Training Error’
);
title([
’Train MSE = ’
num2str(MSE)
’ , Train RMSE = ’
num2str(RMSE)]);grid
on
;
%
Test
subplot
(
3
,
2
,
4
)
;
plot(Errors1,
’k’
);legend(
’Cultural Harmony Testing Error’
);
title([
’Test MSE = ’
num2str(MSE1)
’ , Test RMSE = ’
num2str(RMSE1)]);grid
on
;
%
Train
subplot
(
3
,
2
,
5
)
;
h=histfit(Errors,
50
);h(
1
).FaceColor = [
.1
.2
0.9
];
title([
’Train Error Mean = ’
num2str(error_mean)
’ , Train Error STD = ’
num2str(error_std)]);
%
Test
subplot
(
3
,
2
,
6
)
;
h=histfit(Errors1,
50
);h(
1
).FaceColor = [
.1
.2
0.9
];
title([
’Test Error Mean = ’
num2str(error_mean1)
’ , Test Error STD = ’
num2str(error_std1)]);
%%
Plot Just Fuzzy
Results
(
Train - Test
)
% Train Output Extraction
fTrainOutputs
=evalfis(data.TrainInputs,fis);
% Test Output Extraction
fTestOutputs=evalfis(data.TestInputs,fis);
% Train calc
fErrors=data.TrainTargets-fTrainOutputs;
fMSE=mean(fErrors.^
2
);fRMSE=sqrt(fMSE);
ferror_mean=mean(fErrors);ferror_std=std(fErrors);
% Test calc
fErrors1=data.TestTargets-fTestOutputs;
fMSE1=mean(fErrors1.^
2
);fRMSE1=sqrt(fMSE1);
ferror_mean1=mean(fErrors1);ferror_std1=std(fErrors1);
%
Train
figure
(
’units’
,
’normalized’
,
’outerposition’
,[
0
0
1
1
]
)
subplot
(
3
,
2
,
1
)
;
plot(data.TrainTargets,
’m’
);hold
on
;
plot(fTrainOutputs,
’k’
);legend(
’Target’
,
’Output’
);
title(
’Fuzzy Training Part’
);xlabel(
’Sample Index’
);grid
on
;
%
Test
subplot
(
3
,
2
,
2
)
;
plot(data.TestTargets,
’m’
);hold
on
;
plot(fTestOutputs,
’k’
);legend(
’Target’
,
’Output’
);
title(
’Fuzzy Testing Part’
);xlabel(
’Sample Index’
);grid
on
;
%
Train
subplot
(
3
,
2
,
3
)
;
plot(fErrors,
’g’
);legend(
’Fuzzy Training Error’
);
title([
’Train MSE = ’
num2str(fMSE)
’ , Test RMSE = ’
num2str(fRMSE)]);grid
on
;
%
Test
subplot
(
3
,
2
,
4
)
;
plot(fErrors1,
’g’
);legend(
’Fuzzy Testing Error’
);
title([
’Train MSE = ’
num2str(fMSE1)
’ , Test RMSE = ’
num2str(fRMSE1)]);grid
on
;
%
Train
subplot
(
3
,
2
,
5
)
;
h=histfit(fErrors,
50
);h(
1
).FaceColor = [
.3
.8
0.3
];
title([
’Train Error Mean = ’
num2str(ferror_mean)
’ , Train Error STD = ’
num2str(ferror_std)]);
%
Test
subplot
(
3
,
2
,
6
)
;
h=histfit(fErrors1,
50
);h(
1
).FaceColor = [
.3
.8
0.3
];
title([
’Test Error Mean = ’
num2str(ferror_mean1)
’ , Test Error STD = ’
num2str(ferror_std1)]);
3 仿真结果
4 参考文献
[1] Gao M , Zhu Y , Cao C , et al. A Hybrid Cultural Harmony Search Algorithm for Constrained Optimization Problem of Diesel Blending[J]. IEEE Access, 2019, PP(99):1-1.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
-
2023年血糖新标准公布,不是3.9-6.1,快来看看你的血糖正常吗? 2023-02-07
-
2023年各省最新电价一览!8省中午执行谷段电价! 2023-01-03
-
GB 55009-2021《燃气工程项目规范》(含条文说明),2022年1月1日起实施 2021-11-07
-
PPT导出高分辨率图片的四种方法 2022-09-22
-
2023年最新!国家电网27家省级电力公司负责人大盘点 2023-03-14
-
全国消防救援总队主官及简历(2023.2) 2023-02-10
-
盘点 l 中国石油大庆油田现任领导班子 2023-02-28
-
我们的前辈!历届全国工程勘察设计大师完整名单! 2022-11-18
-
关于某送变电公司“4·22”人身死亡事故的快报 2022-04-26
