Description Usage Arguments Author(s) References See Also Examples
Performs stochastic global optimization via Newtons laws of gravity and motion.
1 |
fn |
the function to be optimized (maximised). |
Par |
number of parameters used in "fn". |
lower.limits |
the lower limits of the parameters used in "fn". |
upper.limits |
the upper limits of the parameters used in "fn". |
n |
number of agents that should be used for the optimization process. |
m |
number of best solutions to be stored in the memory. |
iterations |
number of iterations used for optimization process. |
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. |
The output of the function gRaviopt
contains a matrix GMemory
with the m
best solutions and an array GP
of all calculations.
Peter Kehler peter.kehler.jr@googlemail.com
A. Kaveh and S. Talatahari: A novel heuristic optimization method: charged system search, Acta Mech 213, 267–289 (2010)
gRaviopt.Plot
for graphical output.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.