clear;
clc;
tic;
format short;
global B Pd
% This program solves the economic dispatch with Bmn coefficients byGenetic
% Algorithm toolbox of MATLAB 7.04.For any discussion&Clarification the
% author can be contacted by mail (salorajan@gmail.com)
% 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.15247 38.53973 756.79886 10 125
0.10587 46.15916 451.32513 10 150
0.02803 40.3965 1049.9977 35 225
0.03546 38.30553 1243.5311 35 210
0.02111 36.32782 1658.569 130 325
0.01799 38.27041 1356.6592 125 315];
B=1e-4*[1.4 .17 .15 .19 .26 .22;.17 .60 .13 .16 .15 .20;.15 .13 .65 .17 .24 .19;.19 .16 .17 .71 .30 .25;.26 .15 .24 .30 .69 .32;.22 .20 .19 .25 .32 .85];
Pd=1100;
% Loss coefficients it should be squarematrix of size nXn where n is the no
% of plants
n=length(data(:,1));
% Initialization and run of differential evolution optimizer.
% A simpler version with fewer explicit parameters is in run0.m
%
% Here for Rosenbrock's function
% Change relevant entries to adapt to your personal applications
%
% The file ofunc.m must also be changed
% to return the objective function
%
% VTR "Value To Reach" (stop when ofunc < VTR)
VTR = 1.e-6;
% D number of parameters of the objective function
D = n-1;
% XVmin,XVmax vector of lower and bounds of initial population
% the algorithm seems to work well only if [XVmin,XVmax]
% covers the region where the global minimum is expected
% *** note: these are no bound constraints!! ***
XVmin=data(2:n,4)';
XVmax=data(2:n,5)';
% NP number of population members
NP = 20;
% itermax maximum number of iterations (generations)
itermax = 500;
% F DE-stepsize F ex [0, 2]
F = 0.8;
% CR crossover probabililty constant ex [0, 1]
CR = 0.8;
% strategy 1 --> DE/best/1/exp 6 --> DE/best/1/bin
% 2 --> DE/rand/1/exp 7 --> DE/rand/1/bin
% 3 --> DE/rand-to-best/1/exp 8 --> DE/rand-to-best/1/bin
% 4 --> DE/best/2/exp 9 --> DE/best/2/bin
% 5 --> DE/rand/2/exp else DE/rand/2/bin
strategy = 1;
% refresh intermediate output will be produced after "refresh"
% iterations. No intermediate output will be produced
% if refresh is < 1
refresh = 10;
[x,f,nf] = devec3('eldde',VTR,D,XVmin,XVmax,data,NP,itermax,F,CR,strategy,refresh);
toc;
[ F P1 Pl]=eldde(x,data)