psoptim: Particle Swarm OPTIMization

Description Usage Arguments Details Value Author(s) References Examples

Description

Particle swarm optimization. The maximum is searched.

Usage

1
2
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 TRUE (dafault), animation of the optimization process is shown

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

 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)

Example output

$sol
              x1         x2
[1,] -0.01003505 0.01560359

$val
[1] -0.06823639

psoptim documentation built on May 1, 2019, 9:25 p.m.

Related to psoptim in psoptim...