# gRaviopt

### Description

Implementation of an stochastic agent-based optimisation algorithm using the laws of gravity and motion. Loosely based on the CSS algorithm of A. Kaveh and S. Talatahari described in "A novel heuristic optimization method: charged system search", Acta Mech 213, 267-289 (2010).

### Details

Package: | gRaviopt |

Type: | Package |

Version: | 1.0 |

Date: | 2011-05-06 |

License: | GNU |

LazyLoad: | yes |

### Author(s)

Peter Kehler Maintainer: <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)
``` |