pso algorithm
Show older comments
I have tried writing PSo for eld problem with valve point effects using PSO of the file here but with new function
%function with valve point effects
function [y Pl]=f8(in)
global data B Pd;
c=data(:,1);
b=data(:,2);
a=data(:,3);
e=data(:,4);
f=data(:,5);
pmin=data(:,6);
y1=in.*in*diag(a)+in*diag(b)+(abs(diag(e)*sin(diag(f)*(pmin-in'))))';
Pl1=(in*B).*in;
Pl=sum(Pl1');
lam=abs(Pd+Pl-sum(in'))';
y=(sum(y1')+sum(c))'+100*lam;
when i tried to run it with PSo i am getting errors as
??? Error using ==> minus
Matrix dimensions must agree.
Error in ==> f8 at 9
y1=in.*in*diag(a)+in*diag(b)+(abs(diag(e)*sin(diag(f)*(pmin-in'))))';
Error in ==> pso_Trelea_vectorized at 266
out = feval(functname,pos); % returns column of cost values (1 for each particle)
Error in ==> Untitled2 at 22
[OUT]=pso_Trelea_vectorized('f8',n,1,ran,0,Pdef);
please help me solving this and guide me why i should not use minus there as the function of valve point effects is with -sign
thanking you
my data matrix and the calling program are as follows
clear
clc;
format long;
global data B B0 B00 Pd
data=[561 7.92 0.001562 300 0.0315 100 600
310 7.85 0.001940 200 0.0420 100 400
78 7.97 0.004820 150 0.0630 50 200];
B=.01*[.0218 .0093 .0028;.0093 .0228 .0017;.0028 .0017 .0179];
B0=0*[.0003 .0031 .0015];
B00=100*.00030523;
Pd=850;
Pd=Pd+B00;
l=data(:,6)';
u=data(:,7)';
ran=[l' u'];
n=length(data(:,1));
Pdef = [100 10000 50 2.05 2.05 0.9 0.4 1500 1e-6 5000 NaN 2 0];
[OUT]=pso_Trelea_vectorized('f8',n,1,ran,0,Pdef);
out=abs(OUT)
P=out(1:n)
[F Pl]=f8(P')
this is my calling program and it was done for this program
Accepted Answer
More Answers (1)
Walter Roberson
on 22 Nov 2011
0 votes
Please do not post duplicate questions: it just ends up wasting time all around.
It frustrates me to have spent a long time in the middle of the night analyzing an unknown source, and writing a detailed analysis of all the ways it could have gone wrong, and then to have my analysis ignored with the author reposting exactly the same problem. :(
Categories
Find more on Particle Swarm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!