Readme.md

What is RcppGO?

RcppGO is an agent based optimization package for R written in C++ aiming at "difficult" optimization problems. [...] Optimization algorithms are guided by objective functions. A function is difficult from a mathematical perspective in this context if it is not continuous, not differentiable, or if it has multiple maxima and minima. (Weise, T., (2009). Global Optimization Algorithms – Theory and Application, p.56)

The RcppGO algorithm is based on Kaveh, A. and Talatahari, (2010). A Novel Heuristic Optimization Method: Charged System Search. Acta Mechanica, 213(3-4):267–289.

What are the key features?

RcppGO applicable to difficult objective functions, is fast due to the implementation in C++ using the Armadillo library, is easy to use within R, is open-source under GPL-2.0 License.

Advantages

RcppGO can be used to solve objective functions meeting the following criteria. The objective function is non-continuous, has prohibited zones, has side-limits, is non-smooth, is non-convex. The algorithm doesn't require a good starting point.

Disadvantages

Continuous optimization problems will converge faster and most likely produce results with higher accuracy using gradient-based methods.

How do I try it

There are several options to install RcppGO:

# option 1
install.packages("remotes")
remotes::install_github("peterkehlerjr/RcppGO")

# option 2
library(githubinstall)
githubinstall("peterkehlerjr/RcppGO")

# option 3
# using the devtools package
devtools::install_github("peterkehlerjr/RcppGO")

# option 4 
# download the package 
# in the terminal use
R CMD build RcppGO
R CMD INSTALL RcppGO

Minimal Example

# load RcppGO after installing. See INSTALLATION file
library(RcppGO)

# define (in this case continous) objective function
AluffiPentiny02 <- function(X)
{
  1/4*X[,1]^4 - 1/2*X[,1]^2 + 1/10*X[,1] + 1/2*X[,2]^2
}

# solve objective function
Example <- RcppGO(ObjectiveFunction=AluffiPentiny02, Args=2, Lower = -10, Upper = 10)

# show results
Example$GMemory

# plot dynamic agent based search
plot(x=Example, plot.type="dynamic", nextposition = TRUE)

Example Plots

Agents exploring the search space Aluffi01

Supported OS

Author

Peter Kehler



peterkehlerjr/RcppGO documentation built on Dec. 29, 2021, 11:20 p.m.