pso.velocity {gena} | R Documentation |
Velocity
Description
Calculates (updates) velocities of the particles.
Usage
pso.velocity(
population,
method = "hypersphere",
par = list(w = 1/(2 * log(2)), c1 = 0.5 + log(2), c2 = 0.5 + log(2)),
velocity,
best.pn,
best.nh,
best.pn.fitness,
best.nh.fitness,
iter = 1
)
Arguments
population |
numeric matrix which rows are particles i.e. vectors of parameters values. |
method |
string representing method to be used for velocities calculation. See 'Details' for additional information. |
par |
additional parameters to be passed depending on the |
velocity |
matrix which i-th row is a velocity of the i-th particle. |
best.pn |
numeric matrix which i-th row is a best personal position known by the i-th particle. |
best.nh |
numeric matrix which i-th row is a best personal position in a neighbourhood of the i-th particle. |
best.pn.fitness |
numeric vector which i-th row is the value of
a fitness function at point |
best.nh.fitness |
numeric vector which i-th row is the value of
a fitness function at point |
iter |
iteration number of the genetic algorithm. |
Details
If method = "classic"
then classical velocity formula
is used:
v_{i,j,(t+1)}=w\times v_{i,j,t} +
c_{1}\times u_{1,i,j} \times b^{pn}_{i,j,t} +
c_{2}\times u_{2,i,j} \times b^{nh}_{i,j,t}
where v_{i, j, t}
is a velocity of the i
-th particle
respect to the j
-th component at time t
. Random variables
u_{1,i,j}
and u_{2,i,j}
are i.i.d. respect to all indexes and
follow standard uniform distribution U(0, 1)
.
Variable b^{pn}_{i,j,t}
is j
-th component of the best known
particle's (personal) position up to time period t
.
Similarly b^{nh}_{i,j,t}
is j
-th component of the best of best
known particle's position in a neighbourhood of the i
-th particle.
Hyperparameters w
, c_{1}
and c_{2}
may be provided
via par
argument as a list with elements par$w
, par$c1
and par$c2
correspondingly.
If method = "hypersphere"
then rotation invariant formula from
sections 3.4.2 and 3.4.3 of M. Clerc (2012) is used with arguments
identical to the classical method. To simulate a random variate from
the hypersphere function rhypersphere
is used
setting type = "non-uniform"
.
In accordance with M. Clerc (2012)
default values are par$w = 1/(2 * log(2))
,
par$c1 = 0.5 + log(2)
and par$c2 = 0.5 + log(2)
.
Value
This function returns a matrix which i-th row represents updated velocity of the i-th particle.
References
Maurice Clerc (2012). Standard Particle Swarm Optimisation. HAL archieve.