Click here to Skip to main content
15,886,038 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new to Particle Swarm Optimization and trying to write a code in octave.

swarm_size=10; %number of the swarm particles
maxIter = 50; %maximum number of iterations
inertia = 1.0; %i dont know what it does
correction_factor = 2.0 ; % i dont know what it does too
X=csvread('batting_data.csv'); %load file into octave
x=X(:,2:columns(X));
D=reshape(x,[],2);
plotObjFcn=1; %make it 0 if you dont want to plot a grpah
for i =1: columns(x)
local_best=mean(x(:,i));
particle_init=x(randi(x(:,i),1,swarm_size),
initial_vel=0;
end
Now having reached here i need to have an objective function (I am hoping that i am correct till here) The data i have used here can be downloaded from

www.amstat.org/publications/jse/v21n3/scariano/batting_data.csv

Now i am not getting how to write an objective function to maximize value in each column. and at the end i want these five values in matrix form.
Help is deeply appreciated and if you find that my concepts are not correct kindly enlighten me
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900