gRaviopt.Plot: graphical output for functions with two parameters

Description Usage Arguments Value Author(s) References Examples

View source: R/gRaviopt.Plot.R

Description

visualisises the motion of the agents during the optimization process

Usage

1
gRaviopt.Plot(fn, gRaviopt.Result, Par = 2, iterations = 200, n = 20, lower.limits = -10, upper.limits = 10, Movements = FALSE, Nice = TRUE, man.scaling = F, alpha = 0.1)

Arguments

fn

needs a 2D version of the function that is optimized with gRaviopt

gRaviopt.Result

graphical output

Par

number of parameters used. Par should always be two.

iterations

number of iterations used for the optimization process

n

number of agents used for the optimization

lower.limits

the lower limits of the parameters used in "fn".

upper.limits

the upper limits of the parameters used in "fn".

Movements

should the movements be visualised or a static graphic of the optimized function

Nice

if FALSE no velocity, force vectors or new positions are drawn

man.scaling

the user can specicify wether to choose the the radius of local optimization manually or automatically.

alpha

radius that divises between local and global optimization.

Value

either graphical output of the optimized function (usind persp and image) or the movements of the agents during the optimization process

Author(s)

Peter Kehler peter.kehler.jr@googlemail.com

References

A. Kaveh and S. Talatahari: A novel heuristic optimization method: charged system search, Acta Mech 213, 267–289 (2010)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Rastrigin02 function
## The function has a global maximum f(x) = 0 at the point (0,0).  
## gRaviopt searches for maxima of the objective function between
## lower and upper bounds on each parameter to be optimized. 

Rastrigin02  <- function(X){
  -((X[,1]^2 - 10*cos(2*pi*X[,1]^2) + 10) + (X[,2]^2 - 10*cos(2*pi*X[,2]^2) + 10))
}

## This version of the function is needed for gRaviopt.Plot
Rastrigin02.2d  <- function(x,y){
  -((x*x - 10*cos(2*pi*x) + 10) + (y*y - 10*cos(2*pi*y) + 10))
}

# optimization process of Rastrigin02
Rast02 <- gRaviopt(fn= Rastrigin02, Par=2, n=20, lower.limits = -3, upper.limits = 3,man.scaling=TRUE,alpha=0.05)

# the best solutions found
Rast02$Memory

# the movements of the particles during the optimization process
gRaviopt.Plot(fn= Rastrigin02.2d, gRaviopt.Result=Rast02, Par=2, iterations=200, n=20, lower.limits = -3, upper.limits = 3, Movements=TRUE,man.scaling=TRUE,alpha=0.1,Nice=FALSE)

gRaviopt documentation built on May 2, 2019, 6:53 p.m.