Home > other >  MB for optimum population initialization function of particle swarm optimization (pso), can't r
MB for optimum population initialization function of particle swarm optimization (pso), can't r

Time:02-04

For the rar file format can decompress after the modification of format
The function main ()
clc; clear all; close all;
Tic. % programs run time
Global particlesize narvs zb lb ub GLB gub weigth
Data ();

MaxNum=100; Maximum number of iterations % particles
Dim=9; % the objective function of the independent variable number
Particlesize=30; % particle swarm size
C1=2; % the individual learning factors of each particle, also known as acceleration constant
C2=2; % of each particle social learning factors, also known as acceleration constant
W=0.6; % inertial factor
Vmax=1; The biggest fly speed
% particlesX=zeros (particlesize, dim); % particle location
Ve=1 * rand (particlesize, dim); % of the particles flying speed velocity


For I=1: particlesize
X (I, :)=initial (); % initialization population
End
For I=1: particlesize
F (I)=goalfunc (x (I, :));
% o objective functionEnd

Personalbest_x=x;
Personalbest_faval=f;
[I] globalbest_faval=min (personalbest_faval);
Globalbest_x=personalbest_x (I);
K=1;
While k<=MaxNum
For I=1: particlesize
If constraints (x (I, :))
F (I)=goalfunc (x (I, :));
The else
F (I)=100;
End
If f (I) & lt; Personalbest_faval (I) % to judge whether the current position in the history of best position
Personalbest_faval (I)=f (I);
Personalbest_x (I, :)=x (I, :);
End
End
[I] globalbest_faval=min (personalbest_faval);
Globalbest_x=personalbest_x (I);
Trace (k, :)=globalbest_faval;
For I=1: particlesize % each individual's latest update particle swarm in
Ve (I * ve:)=w (I, :) + c1 * * (personalbest_x rand (I, :) - x (I, :)) + c2 * rand * (globalbest_x - x (I, :));
For j=1: narvs % judge whether the flight speed of the particle exceeds the maximum flying speed
If ve (I, j) & gt; Vmax;
Ve (I, j)=vmax;
Elseif ve (I, j) & lt; - vmax;
Ve (I, j)=- vmax;
End
End
X (I, :)=x (I, :) + ve (I, :);
End
K=k + 1
End
Globalbest_x % global optimal solutions
Gg=jinixishu (globalbest_x) % after optimization of the gini coefficient values
Globalbest_faval % the optimized target function value
The plot (trace) %

The toc.




The assignment with a subscript dimensions do not match,

Error psomain (line 19)
X (I, :)=initial (); % initialization population

CodePudding user response:

Contact QQ335258089
  • Related