% Project Title: Multi-Objective Particle Swarm Optimization (MOPSO)
clc; clear; close all;
feature jit off
%% Problem Definition 函数定义
[ model ] = Createmodel( ) ;
CostFunction=@(x)MyCost(x , model ) ; % Cost Function 多目标函数定义
nVar= model.nVar ; % Number of Decision Variables 问题维度
VarSize=[1 nVar]; % Size of Decision Variables Matrix 决策变量的位图
VarMin= model.VarMin ; % Lower Bound of Variables 变量 低阶
VarMax= model.VarMax ; % Upper Bound of Variables 变量高阶
%% MOPSO Parameters MOPSO算法参数设置
MaxIt= 600 ; % Maximum Number of Iterations 迭代次数
nPop= 100 ; % Population Size 种群数目
nRep= nPop ; % Repository Size 外部档案规模
w=0.5; % Inertia Weight 初始化权重
wdamp=0.99; % Intertia Weight Damping Rate 权重退化下属
c1=1; % Personal Learning Coefficient 学习参数1
c2=2; % Global Learning Coefficient 学习参数2
nGrid= 6 ; % Number of Grids per Dimension 各个目标函数维度上 网格划分参数
alpha=0.1 ; % Inflation Rate
beta=2; % Leader Selection Pressure gbest 选择参数
gamma=2; % Deletion Selection Pressure
mu=0.1; % Mutation Rate
%% Initialization 初始化
rand('seed', sum(clock) ) ;
empty_particle.Position=[]; % 位置
empty_particle.Velocity=[]; % 速度
empty_particle.Cost=[]; % 目标函数值
empty_particle.sol = [] ; % 解的具体表达形式
empty_particle.Best.Position=[]; % 自身历史最优位置
empty_particle.Best.Cost=[]; % 自身历史最优目标函数值
empty_particle.Best.sol = [ ] ; %自身历史最优位置 解的具体表达形式
empty_particle.IsDominated=[]; % 表示是否被其他解支配
empty_particle.GridIndex=[]; % 网格 位置的 总下标
empty_particle.GridSubIndex=[]; % 网格 位置的 多维度下标
pop=repmat(empty_particle,nPop,1);
for i=1:nPop
% 随机初始化 并计算目标函数值
pop(i).Position=unifrnd(VarMin,VarMax,VarSize);
pop(i).Velocity=zeros(VarSize);
[ pop(i).Cost , pop(i).sol ] =CostFunction(pop(i).Position);
% Update Personal Best 更新自身历史最优
pop(i).Best.Position=pop(i).Position;
pop(i).Best.Cost=pop(i).Cost;
pop(i).Best.sol =pop(i).sol ;
end
% Determine Domination 确定支配关系
pop=DetermineDomination(pop);
% 确定外部档案集合
rep=pop(~[pop.IsDominated]);
% 构建网格
Grid=CreateGrid(rep,nGrid,alpha);
for i=1:numel(rep)
rep(i)=FindGridIndex(rep(i),Grid);
end
%% MOPSO Main Loop (MPSO 主流程)
for it=1:MaxIt
for i=1:nPop
% 选择一个 全局最优
leader=SelectLeader(rep,beta);
% 更新速度
pop(i).Velocity = w*pop(i).Velocity ...
+c1*rand(VarSize).*(pop(i).Best.Position-pop(i).Position) ...
+c2*rand(VarSize).*(leader.Position-pop(i).Position);
% 更新粒子位置
pop(i).Position = pop(i).Position + pop(i).Velocity;
% pop(i).Position = max(pop(i).Position, VarMin);
% pop(i).Position = min(pop(i).Position, VarMax);
pop(i).Position = VarMin+ mod( pop(i).Position , VarMax-VarMin) ;
% 计算目标函数值
[ pop(i).Cost , pop(i).sol ] = CostFunction(pop(i).Position);
% Apply Mutation 利用变异操作 进一步提升解的质量
pm=(1-(it-1)/(MaxIt-1))^(1/mu);
if rand<pm
NewSol.Position=Mutate(pop(i).Position,pm,VarMin,VarMax);
[ NewSol.Cost , NewSol.sol ] =CostFunction(NewSol.Position);
if Dominates(NewSol,pop(i))
pop(i).Position = NewSol.Position;
pop(i).Cost = NewSol.Cost;
pop(i).sol = NewSol.sol ;
elseif Dominates(pop(i),NewSol)
% Do Nothing
else
if rand<0.5
pop(i).Position = NewSol.Position;
pop(i).Cost = NewSol.Cost;
pop(i).sol = NewSol.sol ;
end
end
end
if Dominates(pop(i),pop(i).Best)
pop(i).Best.Position=pop(i).Position;
pop(i).Best.Cost=pop(i).Cost;
pop(i).Best.sol =pop(i).sol ;
elseif Dominates(pop(i).Best,pop(i))
% Do Nothing
else
if rand<0.5
pop(i).Best.Position=pop(i).Position;
pop(i).Best.Cost=pop(i).Cost;
pop(i).Best.sol =pop(i).sol ;
end
end
end
% Add Non-Dominated Particles to REPOSITORY
rep=[rep
pop(~[pop.IsDominated])]; %#ok
% Determine Domination of New Resository Members
rep=DetermineDomination(rep);
% Keep only Non-Dminated Memebrs in the Repository
rep=rep(~[rep.IsDominated]);
repCosts=[ rep.Cost ]';
[ ~, ia, ~ ] = unique( repCosts ,'rows') ;
rep = rep( ia );
% Update Grid
Grid=CreateGrid(rep,nGrid,alpha);
% Update Grid Indices
for i=1:numel(rep)
rep(i)=FindGridIndex(rep(i),Grid);
end
% Check if Repository is Full
if numel(rep)>nRep
Extra=numel(rep)-nRep;
for e=1:Extra
rep=DeleteOneRepMemebr(rep,gamma);
end
end
repFeasible = rep ;
for p = numel( rep ) : -1 :1
if rep(p).sol.IsFeasible ==0
repFeasible( p ) =[ ] ;
end
end
% Show Iteration Information 显示迭代信息,即外部档案中的粒子个树枝
disp(['Iteration ' num2str(it) ': Number of Feasible Rep Members = ' num2str(numel( repFeasible ))]);
if numel( rep )>0 && ( ~mod(it,20) || it ==MaxIt )
if numel( repFeasible)>0
figure( 1 );
PlotCosts( repFeasible);
pause( 0.01 )
end
end
% Damping Inertia Weight
w=w*wdamp;
end
没有合适的资源?快使用搜索试试~ 我知道了~
【验】多目标粒子群优化,三个目标函数,帕累托非支配解集.zip
共52个文件
mat:17个
m:17个
bmp:17个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 141 浏览量
2023-05-10
11:04:42
上传
评论
收藏 5.46MB ZIP 举报
温馨提示
【验】多目标粒子群优化,三个目标函数,帕累托非支配解集.zip
资源推荐
资源详情
资源评论
收起资源包目录
【验】多目标粒子群优化,三个目标函数,帕累托非支配解集.zip (52个子文件)
3、【验】多目标粒子群优化,三个目标函数,帕累托非支配解集
mopso
图
16.bmp 39.12MB
13.bmp 38.3MB
04.bmp 34.62MB
07.bmp 35.41MB
01.bmp 33.5MB
08.bmp 35.68MB
06.bmp 35.16MB
15.bmp 38.86MB
10.bmp 36.2MB
09.bmp 35.95MB
14.bmp 38.59MB
12.bmp 36.74MB
02.bmp 34.1MB
05.bmp 34.89MB
17.bmp 39.4MB
11.bmp 36.47MB
03.bmp 34.37MB
工作区
01.mat 82KB
03.mat 86KB
17.mat 103KB
12.mat 104KB
11.mat 101KB
04.mat 88KB
10.mat 105KB
05.mat 88KB
09.mat 88KB
14.mat 95KB
16.mat 81KB
13.mat 105KB
06.mat 89KB
15.mat 89KB
07.mat 91KB
02.mat 68KB
08.mat 90KB
RouletteWheelSelection.m 131B
Mutate.m 361B
MyCost.m 2KB
data.xls 34KB
CreateGrid.m 479B
Dominates.m 190B
mopso.m 6KB
Createmodel.m 1KB
PlotCosts.m 583B
FindGridIndex.m 560B
DeleteOneRepMemebr.m 801B
DetermineDomination.m 391B
SelectLeader.m 676B
程序 pso双目标优化
objfun2.m 1KB
MOPSO.m 6KB
main.m 688B
objfun11.m 1KB
main2.m 626B
共 52 条
- 1
资源评论
- 洪顥允2023-08-27资源很好用,有较大的参考价值,资源不错,支持一下。
JGiser
- 粉丝: 7541
- 资源: 5112
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功