function f=script(x)
f= 60 + sum((x.^2)-10*cos(2*%pi.*x));
endfunction
clear
lines(0)
objective='script' // the objective function file
wmax=0.9; // initial inertia
wmin=0.4; // final inertia
itmax=200; // maximum iteration allowed
c1=2; // personal best knowledge factor
c2=2; // global best knowledge factor
N=20; // number of particle
D=6; // problem dimension
borne_sup=20*[10 10 10 10 10 10]'; // location min. milestone
borne_inf=10*borne_sup; // location max. milestone
vitesse_max=[10 10 10 10 10 10]'; // max. speed milestone
vitesse_min=-1*vitesse_max; // min. speed milestone
radius=1e-4; // minimal radius
//executing PSO
// for inertial PSO
PSO_inertial(objective,wmax,wmin,itmax,c1,c2,N,D,borne_sup,borne_inf,vitesse_min,vitesse_max)
// for inertial radius PSO
PSO_inertial_radius(objective,wmax,wmin,itmax,c1,c2,N,D,borne_sup,borne_inf,vitesse_min,vitesse_max,radius)
// for BSG Starcraft PSO
PSO_bsg_starcraft(objective,wmax,wmin,itmax,c1,c2,N,D,borne_sup,borne_inf,vitesse_min,vitesse_max)
// for BSG Starcraft radius PSO
PSO_bsg_starcraft_radius(objective,wmax,wmin,itmax,c1,c2,N,D,borne_sup,borne_inf,vitesse_min,vitesse_max,radius)