Description Usage Arguments Details Value Author(s) References Examples
Particle swarm optimization. The maximum is searched.
1 2 |
FUN |
the optimized function with a vector as parameter |
n |
number of particles |
max.loop |
maximal number of iterations |
w |
inertia weight |
c1 |
coefficient of the self-recognition component |
c2 |
coefficient of the social component |
xmin |
vector of position constraints - minimal values |
xmax |
vector of position constraints - maximal values |
vmax |
vector of velocity constraints in each direction |
seed |
seed for random values |
anim |
logical; if |
The i
-th particle velocity v
in j
-th direction is calculated in t
iteration according to:
v[ij](t+1) = w*v[ij](t) + c1*r1*(xP[ij](t) - x[ij](t)) + c2*r2*(xS[j](t) - x[ij](t)).
where: r1
and r2
are random values, w
is inertia weight, c1
is a coefficient of the self-recognition component and c2
is a coefficient of the social component. xP
denotes so far best position of the particle and xS
- the best position among the swarm.
The new position (coordinates) is calculated as:
x[ij](t+1) = x[ij](t) + v[ij](t+1).
In the current version of the package, the function works without checking the correctness of the given arguments.
A list with the two components:
sol
solution, i.e. the best set of parameters found.
val
the best fitness function found.
Krzysztof Ciupke, <krzysztof.ciupke at polsl.pl>
Abraham A, Guo H, Liu H. (2006) Swarm Intelligence: Foundations, Perspectives and Applications in Nedjah N, Mourelle L. (eds.): "Swarm Intelligent Systems", Springer, Berlin Heidelberg, pp. 3-25.
Banks A, Vincent J, Anyakoha C. (2007) A review of particle swarm optimization. Part I: background and development. Natural Computing, vol. 6, No. 4, pp. 467-484.
Dorigo M, Stutzle T. (2004) Ant Colony Optimization, MIT Press.
Eberhart R, Yuhui S. (2001) Particle swarm optimization: developments, applications and resources, Congress on Evolutionary Computation. Seoul, Korea.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | n <- 50
m.l <- 50
w <- 0.95
c1 <- 0.2
c2 <- 0.2
xmin <- c(-5.12, -5.12)
xmax <- c(5.12, 5.12)
vmax <- c(4, 4)
g <- function(x){
-(20 + x[,1]^2 + x[,2]^2 - 10*(cos(2*pi*x[,1]) + cos(2*pi*x[,2])))
}
psoptim(FUN=g, n=n, max.loop=m.l, w=w, c1=c1, c2=c2,
xmin=xmin, xmax=xmax, vmax=vmax, seed=5, anim=FALSE)
|
$sol
x1 x2
[1,] -0.01003505 0.01560359
$val
[1] -0.06823639
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.