1 简介
编辑
编辑
编辑
编辑
编辑
编辑
2 部分代码
%_________________________________________________________________________%clc;clear;close all;warning off;% Change these details with respect to your problem%%%%%%%%%%%%%%% This program solves the economic dispatch with Bmn coefficients by MOALO% Algorithm % The data matrix should have 5 columns of fuel cost coefficients and plant limits.% 1.a ($/MW^2) 2. b $/MW 3. c ($) 4.lower lomit(MW) 5.Upper limit(MW)%no of rows denote the no of plants(n)data=[0.007 7 240 100 5000.0095 10 200 50 2000.009 8.5 220 80 3000.009 11 200 50 1500.008 10.5 220 50 2000.0075 12 120 50 120];% Loss coefficients it should be squarematrix of size nXn where n is the no% of plantsB=1e-4*[0.14 0.17 0.15 0.19 0.26 0.220.17 0.6 0.13 0.16 0.15 0.20.15 0.13 0.65 0.17 0.24 0.190.19 0.16 0.17 0.71 0.3 0.250.26 0.15 0.24 0.3 0.69 0.320.22 0.2 0.19 0.25 0.32 0.85];% Demand (MW)Pd=700;ObjectiveFunction=@eldnba;dim=length(data(:,1));;lb=0;ub=1;obj_no=1;if size(ub,2)==1 ub=ones(1,dim)*ub; lb=ones(1,dim)*lb;end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Initial parameters of the MODA algorithmmax_iter=100;N=100;ArchiveMaxSize=100;Archive_X=zeros(100,dim);Archive_F=ones(100,obj_no)*inf;Archive_member_no=0;r=(ub-lb)/2;V_max=(ub(1)-lb(1))/10;Elite_fitness=inf*ones(1,obj_no);Elite_position=zeros(dim,1);Ant_Position=initialization(N,dim,ub,lb);fitness=zeros(N,2);V=initialization(N,dim,ub,lb);iter=0;position_history=zeros(N,max_iter,dim);for iter=1:max_iter for i=1:N %Calculate all the objective values first Particles_F(i,:)=ObjectiveFunction(Ant_Position(:,i)'); if dominates(Particles_F(i,:),Elite_fitness) Elite_fitness=Particles_F(i,:); Elite_position=Ant_Position(:,i); end end [Archive_X, Archive_F, Archive_member_no]=UpdateArchive(Archive_X, Archive_F, Ant_Position, Particles_F, Archive_member_no); if Archive_member_no>ArchiveMaxSize Archive_mem_ranks=RankingProcess(Archive_F, ArchiveMaxSize, obj_no); [Archive_X, Archive_F, Archive_mem_ranks, Archive_member_no]=HandleFullArchive(Archive_X, Archive_F, Archive_member_no, Archive_mem_ranks, ArchiveMaxSize); else Archive_mem_ranks=RankingProcess(Archive_F, ArchiveMaxSize, obj_no); end Archive_mem_ranks=RankingProcess(Archive_F, ArchiveMaxSize, obj_no); % Chose the archive member in the least population area as arrtactor % to improve coverage index=RouletteWheelSelection(1./(Archive_mem_ranks+1e-20)); if index==-1 index=1; end Elite_fitness=Archive_F(index,:); Elite_position=Archive_X(index,:)'; Random_antlion_fitness=Archive_F(1,:); Random_antlion_position=Archive_X(1,:)'; for i=1:N index=0; neighbours_no=0; RA=Random_walk_around_antlion(dim,max_iter,lb,ub, Random_antlion_position',iter); [RE]=Random_walk_around_antlion(dim,max_iter,lb,ub, Elite_position',iter); Ant_Position(:,i)=(RE(iter,:)'+RA(iter,:)')/2; Flag4ub=Ant_Position(:,i)>ub'; Flag4lb=Ant_Position(:,i)<lb'; Ant_Position(:,i)=(Ant_Position(:,i).*(~(Flag4ub+Flag4lb)))+ub'.*Flag4ub+lb'.*Flag4lb; end display(['At the iteration ', num2str(iter), ' there are ', num2str(Archive_member_no), ' non-dominated solutions in the archive']); K(iter)=Elite_fitness; end[F P Pl]=eldnba(Elite_position)plot(K)gridtitle('Iteration vs Best Function Value');xlabel('Iteration')ylabel('Function Value')
3 仿真结果
编辑
4 参考文献
[1]彭暄惠, 陈才学, 熊志刚,等. 一种基于改进蚁狮算法的含电动汽车参与的微电网优化调度方法:.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
5 代码下载
编辑