| Version: | 1.0 |
| Date: | 2016-01-30 |
| Title: | Particle Swarm Optimization |
| Depends: | R (≥ 2.0.0) |
| Author: | Krzysztof Ciupke [aut, cre] |
| Maintainer: | Krzysztof Ciupke <krzysztof.ciupke@polsl.pl> |
| Description: | Particle swarm optimization - a basic variant. |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2.0)] |
| URL: | https://www.r-project.org |
| Packaged: | 2016-01-30 18:13:12 UTC; kciupke |
| NeedsCompilation: | no |
| Repository: | CRAN |
| Date/Publication: | 2016-01-31 12:22:33 |
Particle Swarm OPTIMization
Description
Particle swarm optimization. The maximum is searched.
Usage
psoptim(FUN, n=100, max.loop=100, w=0.9, c1=0.2, c2=0.2,
xmin, xmax, vmax=c(4,4), seed=10, anim=TRUE)
Arguments
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 |
Details
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.
Value
A list with the two components:
sol solution, i.e. the best set of parameters found.
val the best fitness function found.
Author(s)
Krzysztof Ciupke, <krzysztof.ciupke at polsl.pl>
References
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.
Examples
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)