基于分解的多目标进化算法MOEA/D

  • Leslie
    了解作者
  • matlab
    开发工具
  • 5.7KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 3 积分
    下载积分
  • 0
    下载次数
  • 2022-05-28 17:23
    上传日期
2007年张青富提出的基于分解的多目标进化算法MOEA/D
MOEAD.zip
  • MOEAD
  • PlotCosts.m
    591B
  • DecomposedCost.m
    645B
  • moead.m
    4.7KB
  • DetermineDomination.m
    939B
  • M_Dominates.m
    608B
  • Untitled.m
    93B
  • CreateSubProblems.m
    1001B
  • M_Crossover.m
    679B
内容介绍
function [PopX,Pareto,POF_iter] = moead( Problem,popSize,MaxIt, t,init_pop) CostFunction = Problem.FObj; % Cost Function nVar = size(Problem.XLow,1); % Number of Decision Variables VarSize = [nVar 1]; % Decision Variables Matrix Size VarMin = 0; % Decision Variables Lower Bound VarMax = 1; % Decision Variables Upper Bound nObj = Problem.NObj; %number of objectives %% MOEA/D Settings nPop = popSize; % Population Size (Number of Sub-Problems) nArchive = 50; T = max(ceil(0.15*nPop),2); % Number of Neighbors T = min(max(T,2),15); crossover_params.gamma=0.5; crossover_params.VarMin=VarMin; crossover_params.VarMax=VarMax; %% Initialization % Create Sub-problems sp = CreateSubProblems(nObj,nPop,T); %sp所表示的是权重向量和每个权重对应的邻居,lambda是对应的权重向量 % Empty Individual empty_individual.Position = []; empty_individual.Cost = []; empty_individual.g = []; empty_individual.IsDominated = []; % Initialize Goal Point % z = inf(nObj,1); z = zeros(nObj,1); % Create Initial Population pop = repmat(empty_individual,nPop,1); if nargin == 4 %函数输入参数数目 for i = 1:nPop pop(i).Position = unifrnd(VarMin,VarMax,VarSize); %生成一个下界为VarMin,上界为VarMax的均匀随机数数组,数组的大小为VarSize pop(i).Cost = CostFunction(pop(i).Position',t); z = min(z,pop(i).Cost); end elseif nargin == 5 for i = 1:size(init_pop,2) pop(i).Position = init_pop(:,i); pop(i).Cost = CostFunction(pop(i).Position',t); z = min(z,pop(i).Cost); end for i = size(init_pop,2)+1:nPop pop(i).Position = unifrnd(VarMin,VarMax,VarSize); pop(i).Cost = CostFunction(pop(i).Position',t); z = min(z,pop(i).Cost); end end for i = 1:nPop pop(i).g = DecomposedCost(pop(i),z,sp(i).lambda); %分解步骤 %sp所表示的是权重向量和每个权重对应的邻居,lambda是对应的权重向量 end % Determine Population Domination Status 确认种群人口支配关系 pop = DetermineDomination(pop); % Initialize Estimated Pareto Front 初始化估计的Pareto前沿 EP = pop(~[pop.IsDominated]); %记录pop.IsDominated中为0的个体,即非支配个体 %% Main Loop for it = 1:MaxIt %MaxIt is the frequency of change,迭代MaxIt次,取最后一次所得到的的pareto解 for i = 1:nPop % Reproduction (Crossover) K = randsample(T,2); %返回从整数 1 到 T 中无放回随机均匀抽取的2个值 %选取两个邻居 j1 = sp(i).Neighbors(K(1)); p1 = pop(j1); j2 = sp(i).Neighbors(K(2)); p2 = pop(j2); y = empty_individual; y.Position = M_Crossover(p1.Position,p2.Position,crossover_params); %取出两个邻居进行交叉操作 y.Cost = CostFunction(y.Position',t); %计算交叉后的目标函数值 z = min(z,y.Cost); for j = sp(i).Neighbors y.g = DecomposedCost(y,z,sp(j).lambda); if y.g <= pop(j).g pop(j) = y; end end end % Determine Population Domination Status pop = DetermineDomination(pop); ndpop = pop(~[pop.IsDominated]); EP = [EP ndpop]; %#ok EP = DetermineDomination(EP); EP = EP(~[EP.IsDominated]); % 随机去掉多余的个体 if numel(EP) > nArchive Extra = numel(EP)-nArchive; ToBeDeleted = randsample(numel(EP),Extra); %从整数1到numel(EP)中无放回随机取出Extra个值 EP(ToBeDeleted) = []; end % Plot EP % figure(1); % PlotCosts(EP); % pause(0.01); for arcnum = 1:size(EP,1) pareto(:,arcnum) = EP(arcnum).Cost; %这nArchive个个体的目标函数值组成pareto,每个个体的cost个数为目标函数个数 end POF_iter{it} = pareto; %上述过程重复MaxIt次 % Display Iteration Information % disp(['Iteration ' num2str(it) ': Number of Pareto Solutions = ' num2str(numel(EP))]); end %Pareto.F = POF_iter{end}; Pareto.F = [EP.Cost]; %MaxIt次迭代中各个Pareto解的目标函数值 Pareto.X = [EP.Position]; %MaxIt次迭代中各个Pareto解的位置position PopX = Pareto.X; %MaxIt次迭代中各个Pareto解的位置position %% Reults % disp(' '); % % EPC = [EP.Cost]; % for j = 1:nObj % % disp(['Objective #' num2str(j) ':']); % disp([' Min = ' num2str(min(EPC(j,:)))]); % disp([' Max = ' num2str(max(EPC(j,:)))]); % disp([' Range = ' num2str(max(EPC(j,:))-min(EPC(j,:)))]); % disp([' St.D. = ' num2str(std(EPC(j,:)))]); % disp([' Mean = ' num2str(mean(EPC(j,:)))]); % disp(' '); % % end end
评论
    相关推荐