多目标优化问题的研究概述(Matlab代码实现)

  🍒🍒🍒欢迎关注🌈🌈🌈

📝个人主页:我爱Matlab


👍点赞➕评论➕收藏 == 养成习惯(一键三连)🌻🌻🌻

🍌希望大家多多支持🍓~一起加油 🤗

💬语录:将来的我一定会感谢现在奋斗的自己!

🍁🥬🕒摘要🕒🥬🍁

本次介绍作为IDE和代码格式的聚类、回归、图像量化、图像分割、并行机器调度(PMS)、旅行商问题(TSP)和装箱问题(BPP)的七个应用。

✨🔎⚡部分运行结果⚡🔎✨

 

 

 

 

 

 

💂♨️👨‍🎓Matlab代码👨‍🎓♨️💂

% warning('off');

clear;
% Data=load("Data.csv");
% Inputs=Data(:,1:end-1);
% Targets=Data(:,end);
%% Input Model 
% Display uigetfile dialog
filterspec = {'*.csv'};
[f, p] = uigetfile(filterspec);
fileadd=fullfile(p,f);
filecon=load(fileadd);
Inputs=filecon(:,1:end-1);
Targets=filecon(:,end);

%% Learning 

n = 9; % Neurons

%----------------------------------------
% 'trainlm'        Levenberg-Marquardt
% 'trainbr'     Bayesian Regularization (good)
% 'trainrp'      Resilient Backpropagation
% 'traincgf'    Fletcher-Powell Conjugate Gradient
% 'trainoss'    One Step Secant (good)
% 'traingd'     Gradient Descent
% Creating the NN ----------------------------
net = feedforwardnet(n,'trainoss');

%---------------------------------------------
% configure the neural network for this dataset
[net tr]= train(net,Inputs', Targets');

perf = perform(net,Inputs, Targets); % mse
% Current NN Weights and Bias
Weights_Bias = getwb(net);
% MSE Error for Current NN
Outputs=net(Inputs');
Outputs=Outputs';
% Final MSE Error and Correlation Coefficients (CC)
Err_MSE=mse(Targets,Outputs);
CC1= corrcoef(Targets,Outputs);
CC1= CC1(1,2);

%-----------------------------------------------------
%% Nature Inspired Regression
% Create Handle for Error
h = @(x) MSEHandle(x, net, Inputs', Targets');
tic
sizenn=size(Inputs);sizenn=sizenn(1,1);
%-----------------------------------------
%% Please select
MaxIt = 5;       % Maximum Number of Iterations
nPop = 5;        % Population Size 

[x,err,BestCost] = hs(h, sizenn*n+n+n+1,MaxIt,nPop);

% Plot ITR
% figure;
plot(BestCost,'k', 'LineWidth', 2);
xlabel('ITR');
ylabel('Cost Value');
ax = gca; 
ax.FontSize = 14; 
ax.FontWeight='bold';
set(gca,'Color','c')
grid on;

%%-------------------------------------------------------------------------
net = setwb(net, x');
% Optimized NN Weights and Bias
getwb(net);
% Error for Optimized NN
Outputs2=net(Inputs');
Outputs2=Outputs2';
% Final MSE Error and Correlation Coefficients (CC)
Err_MSE2=mse(Targets,Outputs2);
CC2= corrcoef(Targets,Outputs2);
CC2= CC2(1,2);

%% Plot Regression
f = figure;  
f.Position = [100 100 700 550]; 
% Metaheuristics
subplot(3,1,1)
[population3,gof3] = fit(Targets,Outputs2,'poly3');
plot(Targets,Outputs2,'o',...
'LineWidth',1,...
'MarkerSize',8,...
'MarkerEdgeColor','g',...
'MarkerFaceColor',[0.9,0.3,0.1]);
title(['R =  ' num2str(1-gof3.rmse)],['MSE =  ' num2str(Err_MSE2)]); 
hold on
plot(population3,'b-','predobs');
xlabel('Targets');ylabel('Outputs');   grid on;
ax = gca; 
ax.FontSize = 12; ax.LineWidth=2;
% legend({'Regression'},'FontSize',12,'TextColor','blue');hold off
subplot(3,1,2)
% Error
Errors=Targets-Outputs2;
ErrorMean=mean(Errors);
ErrorStd=std(Errors);
subplot(3,1,2);
plot(Targets,'m');hold on;
plot(Outputs2,'k');legend('Target','Output');
title('Training Part');xlabel('Sample Index');grid on;
subplot(3,1,3);
h=histfit(Errors, 50);
h(1).FaceColor = [.3 .8 0.3];
title(['Train Error Mean =    ' num2str(ErrorMean) '   ,' ...
    '   Train Error STD =    ' num2str(ErrorStd)]);grid on;

% Correlation Coefficients
% fprintf('Normal Correlation Coefficients Is =  %0.4f.\n',CC1);
fprintf('New Correlation Coefficients Is =  %0.4f.\n',CC2);
toc

📜📢🌈参考文献🌈📢📜

[1]公茂果,焦李成,杨咚咚,马文萍.进化多目标优化算法研究[J].软件学报,2009,20(02):271-289.

[2]肖晓伟,肖迪,林锦国,肖玉峰.多目标优化问题的研究概述[J].计算机应用研究,2011,28(03):805-808+827.

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
多尺度卷积神经网络(Multi-Scale Convolutional Neural Networks, MSCNN)是一种深度学习模型,它结合了不同尺度的特征信息,以便捕捉输入图像中不同层次的细节。这种网络结构通常用于图像分类、目标检测和图像分割等任务,特别适用于处理具有复杂场景变化的任务。 在MATLAB实现一个多尺度卷积神经网络,你需要使用深度学习工具箱,如Deep Learning Toolbox或者Computer Vision Toolbox。以下是一个简单的步骤概述: 1. **安装所需库**:确保你已经安装了MATLAB的Deep Learning Toolbox。 2. **数据预处理**:加载和预处理图像数据,将其划分为训练集和验证集。 3. **定义网络架构**: - 使用`layers`函数创建卷积层(`conv2d`)、池化层(`maxPooling2d`)、全连接层(`fullyConnected`)以及多尺度模块(这可能需要自定义函数来融合不同尺度的特征)。 - 可能包含ResNet或Inception-like结构来捕获多尺度特征。 ```matlab net = [ imageInputLayer([height width depth]) convolution2dLayer(kernelSize, numFilters, 'Padding', 'same') batchNormalizationLayer reluLayer maxPooling2dLayer(poolSize) % 添加多尺度模块,例如: myMSLayer = @myCustomMultiScaleLayer; net = [net, myMSLayer] % ...重复其他层直到输出层 fullyConnectedLayer(numClasses) softmaxLayer classificationLayer ]; ``` 4. **编译网络**: - 设置优化器(如`adam`或`sgdm`),损失函数(如`crossentropyex`),以及性能指标(如`classificationAccuracy`)。 - `net = trainNetwork(trainData, trainLabels, net, options);` 5. **评估和调整**: - 使用验证集测试网络性能,并根据需要调整网络结构或超参数。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值