jakobbossek / smoof

Single- and Multi-Objective Optimization Test Functions
http://jakobbossek.github.io/smoof/
Other
36 stars 16 forks source link
benchmark-functions multi-objective-optimization r r-package single-objective-optimization

smoof: Single- and Multi-Objective Optimization Test Functions

Visit the package website

CRAN Status
Badge CRAN
Downloads CRAN
Downloads R-CMD-check Codecov test
coverage

This package offers an interface for objective functions in the context of (multi-objective) global optimization. It conveniently builds up on the S3 objects, i. e., an objective function is a S3 object composed of a descriptive name, the function itself, a parameter set, box constraints or other constraints, number of objectives and so on. Moreover, the package contains generators for a load of both single- and multi-objective optimization test functions which are frequently being used in the literature of (benchmarking) optimization algorithms. The bi-objective ZDT function family by Zitzler, Deb and Thiele is included as well as the popular single-objective test functions like De Jong’s function, Himmelblau function and Schwefel function. Moreover, the package offers a R interface to the C implementation of the Black-Box Optimization Benchmarking (BBOB) set of noiseless test functions.

examplary smoof
functions

Installation instructions

Visit the package repository on CRAN. If you want to take a glance at the developement version install the github developement version by executing the following command:

devtools::install_github("jakobbossek/smoof")

Example

Use a build-in generator

Assume the simplifying case where we want to benchmark a set of optimization algorithms on a single objective instance. We decide ourselves for the popular 10-dimensional Rosenbrock banana function. Instead of looking up the function definition, the box constraints and where the global optimum is located, we simply generate the function with smoof and get all the stuff:

library(ggplot2)
library(plot3D)

obj.fn = makeRosenbrockFunction(dimensions = 2L)
print(obj.fn)
print(autoplot(obj.fn))
plot3D(obj.fn, length.out = 50L, contour = TRUE)

Set up an objective function by hand

Let us consider the problem of finding the (global) minimum of the multimodal target function f(x) = x sin(3x) on the closed intervall [0, 2PI]. We define our target function via the makeSingleObjectiveFunction() method providing a name, the function itself and a parameter set. We can display the function within the box constraints with ggplot.

library(ggplot2)

obj.fn = makeSingleObjectiveFunction(
  name = "My fancy function name",
  fn = function(x) x * sin(3*x),
  par.set = makeNumericParamSet("x", len = 1L, lower = 0, upper = 2 * pi)
)
print(obj.fn)
print(getParamSet(obj.fn))
print(autoplot(obj.fn))

The ecr package for evolutionary computing in R needs builds upon smoof functions.

Citation

Please cite my R Journal paper in publications. Get the information via citation("smoof") or use the following BibTex entry:

@Article{,
  author = {Jakob Bossek},
  title = {smoof: Single- and Multi-Objective Optimization Test Functions},
  year = {2017},
  journal = {The R Journal},
  url = {https://journal.r-project.org/archive/2017/RJ-2017-004/index.html},
}

Contact

Please address questions and missing features about the smoof package to the author Jakob Bossek j.bossek@gmail.com. Found some nasty bugs? Please use the issue tracker for this. Pay attention to explain the problem as good as possible. At its best you provide an example, so I can reproduce your problem.