%___________________________________________________________________%
% Multi-Objective Grey Wolf Optimizer (MOGWO) %
% Source codes demo version 1.0 %
% %
% Developed in MATLAB R2011b(7.13) %
% %
% Author and programmer: Seyedali Mirjalili %
% %
% e-Mail: ali.mirjalili@gmail.com %
% seyedali.mirjalili@griffithuni.edu.au %
% %
% Homepage: http://www.alimirjalili.com %
% %
% Main paper: %
% %
% S. Mirjalili, S. Saremi, S. M. Mirjalili, L. Coelho, %
% Multi-objective grey wolf optimizer: A novel algorithm for %
% multi-criterion optimization, Expert Systems with Applications,%
% in press, DOI: http://dx.doi.org/10.1016/j.eswa.2015.10.039 % %
% %
%___________________________________________________________________%
% I acknowledge that this version of MOGWO has been written using
% a large portion of the following code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MATLAB Code for %
% %
% Multi-Objective Particle Swarm Optimization (MOPSO) %
% Version 1.0 - Feb. 2011 %
% %
% According to: %
% Carlos A. Coello Coello et al., %
% "Handling Multiple Objectives with Particle Swarm Optimization," %
% IEEE Transactions on Evolutionary Computation, Vol. 8, No. 3, %
% pp. 256-279, June 2004. %
% %
% Developed Using MATLAB R2009b (Version 7.9) %
% %
% Programmed By: S. Mostapha Kalami Heris %
% %
% e-Mail: sm.kalami@gmail.com %
% kalami@ee.kntu.ac.ir %
% %
% Homepage: http://www.kalami.ir %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;
close all;
clc;
drawing_flag = false;
% 粒子群算法(PSO)、樽海鞘群算法(SSA)、灰色狼群算法(GWO)结果的综合比较
N = 12; % 补偿装置总数
nVar = 24*N; %维度(决策变量的个数)
% M = 2; % 目标数
M = 3; % 目标数
% Active Powers in kWs Generated by Photovoltatic Arrays at Bus 8, 25, 32
% 第1、2、3、4、5、6、7、8、9、10、11、12组补偿位置分别为
% 母线24、25、7、8、30、32、4、14、29、31、2、23
% 第1组的补偿装置容量范围为0 ~ 0.2Mvar
% 第2组的补偿装置容量范围为-0.2 ~ 0.2Mvar
% 第3组的补偿装置容量范围为0 ~ 0.1Mvar
% 第4组的补偿装置容量范围为-0.1 ~ 0.1Mvar
% 第5组的补偿装置容量范围为0 ~ 0.1Mvar
% 第6组的补偿装置容量范围为-0.1 ~ 0.1Mvar
% 第7组的补偿装置容量范围为0 ~ 0.08Mvar
% 第8组的补偿装置容量范围为0 ~ 0.08Mvar
% 第9组的补偿装置容量范围为0 ~ 0.07Mvar
% 第10组的补偿装置容量范围为0 ~ 0.07Mvar
% 第11组的补偿装置容量范围为0 ~ 0.06Mvar
% 第12组的补偿装置容量范围为0 ~ 0.05Mvar
% 下边界
Lb = zeros(24, N);
Lb(:, 2) = -0.2;
Lb(:, [4, 6]) = -0.1;
% 上边界
Ub = zeros(24, N);
Ub(:, 1:2) = 0.2;
Ub(:, 3:6) = 0.1;
Ub(:, 7:8) = 0.08;
Ub(:, 9:10) = 0.07;
Ub(:, 11) = 0.06;
Ub(:, 12) = 0.05;
% 改变维度布局
min_range = reshape(Lb', 1, nVar);
max_range = reshape(Ub', 1, nVar);
% min_range = zeros(1, V); %下界 生成1*30的个体向量 全为0
% max_range = ones(1, V); %上界 生成1*30的个体向量 全为1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Objective Functions
fobj = @fitness;
% Lower bound and upper bound
GreyWolves_num=200;
MaxIt=200; % Maximum Number of Iterations
Archive_size=200; % Repository Size
alpha=0.1; % Grid Inflation Parameter
nGrid=10; % Number of Grids per each Dimension
beta=4; %=4; % Leader Selection Pressure Parameter
gamma=2; % Extra (to be deleted) Repository Member Selection Pressure
% Initialization
GreyWolves=CreateEmptyParticle(GreyWolves_num);
for i=1:GreyWolves_num
GreyWolves(i).Velocity=0;
GreyWolves(i).Position=zeros(1,nVar);
for j=1:nVar
GreyWolves(i).Position(1,j)=unifrnd(Lb(j),Ub(j),1);
end
GreyWolves(i).Cost=fobj(GreyWolves(i).Position);
GreyWolves(i).Best.Position=GreyWolves(i).Position;
GreyWolves(i).Best.Cost=GreyWolves(i).Cost;
end
GreyWolves=DetermineDomination(GreyWolves);
Archive=GetNonDominatedParticles(GreyWolves);
Archive_costs=GetCosts(Archive);
G=CreateHypercubes(Archive_costs,nGrid,alpha);
for i=1:numel(Archive)
[Archive(i).GridIndex, Archive(i).GridSubIndex]=GetGridIndex(Archive(i),G);
end
% MOGWO main loop
for it=1:MaxIt
a=2-it*((2)/MaxIt);
for i=1:GreyWolves_num
clear rep2
clear rep3
% Choose the alpha, beta, and delta grey wolves
Delta=SelectLeader(Archive,beta);
Beta=SelectLeader(Archive,beta);
Alpha=SelectLeader(Archive,beta);
% If there are less than three solutions in the least crowded
% hypercube, the second least crowded hypercube is also found
% to choose other leaders from.
if size(Archive,1)>1
counter=0;
for newi=1:size(Archive,1)
if sum(Delta.Position~=Archive(newi).Position)~=0
counter=counter+1;
rep2(counter,1)=Archive(newi);
end
end
Beta=SelectLeader(rep2,beta);
end
% This scenario is the same if the second least crowded hypercube
% has one solution, so the delta leader should be chosen from the
% third least crowded hypercube.
if size(Archive,1)>2
counter=0;
for newi=1:size(rep2,1)
if sum(Beta.Position~=rep2(newi).Position)~=0
counter=counter+1;
rep3(counter,1)=rep2(newi);
end
end
Alpha=SelectLeader(rep3,beta);
end
% Eq.(3.4) in the paper
c=2.*rand(1, nVar);
% Eq.(3.1) in the paper
D=abs(c.*Delta.Position-GreyWolves(i).Position);
% Eq.(3.3) in the paper
A=2.*a.*rand(1, nVar)-a;
% Eq.(3.8) in the paper
X1=Delta.Position-A.*abs(D);
% Eq.(3.4) in the paper
c=2.*rand(1, nVar);
% Eq.(3.1) in the paper
D=abs(c.*Beta.Position-GreyWolves(i).Position);
% Eq.(3.3) in the paper
A=2.*a.*rand()-a;
% Eq.(3.9) in the paper
X2=Beta.Position-A.*abs(D);
% Eq.(3.4) in t
评论0