Package 'psoptim'

Title: Particle Swarm Optimization
Description: Particle swarm optimization - a basic variant.
Authors: Krzysztof Ciupke [aut, cre]
Maintainer: Krzysztof Ciupke <[email protected]>
License: GPL (>= 2.0)
Version: 1.0
Built: 2024-12-14 06:39:38 UTC
Source: CRAN

Help Index


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 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

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)