cmaesr (version 1.0.3)

cmaes: Covariance-Matrix-Adaptation


Performs non-linear, non-convex optimization by means of the Covariance Matrix Adaptation - Evolution Strategy (CMA-ES).


cmaes(, start.point = NULL, monitor = makeSimpleMonitor(), control = list(stop.ons = c(getDefaultStoppingConditions())))

[smoof_function] Continuous objective function of type smoof_function. The function must expect a vector of numerical values and return a scaler numerical value.
[numeric] Initial solution vector. If NULL, one is generated randomly within the box constraints offered by the paramter set of the objective function. Default is NULL.
[cma_monitor] Monitoring object. Default is makeSimpleMonitor, which produces a console output.
[list] Futher paramters for the CMA-ES. See the details section for more in-depth information. Stopping conditions are also defined here. By default only some stopping conditions are passed. See getDefaultStoppingConditions.


[cma_result] Result object. Internally a list with the following components:


This is a pure R implementation of the popular CMA-ES optimizer for continuous black box optimization [2, 3]. It features a flexible system of stopping conditions and enables restarts [1], which can be triggered by arbitrary stopping conditions and can lead to superior performance on multimodal problems.

You may pass additional parameters to the CMA-ES via the control argument. This argument must be a named list. The following control elements will be considered by the CMA-ES implementation:


[1] Auger and Hansen (2005). A Restart CMA Evolution Strategy With Increasing Population Size. In IEEE Congress on Evolutionary Computation, CEC 2005, Proceedings, pp. 1769-1776. [2] N. Hansen (2006). The CMA Evolution Strategy: A Comparing Review. In J.A. Lozano, P. Larranaga, I. Inza and E. Bengoetxea (Eds.). Towards a new evolutionary computation. Advances in estimation of distribution algorithms. Springer, pp. 75-102. [3] Hansen and Ostermeier (1996). Adapting arbitrary normal mutation distributions in evolution strategies: The covariance matrix adaptation. In Proceedings of the 1996 IEEE International Conference on Evolutionary Computation, pp. 312-317.


# generate objective function from smoof package
fn = makeRosenbrockFunction(dimensions = 2L)
res = cmaes(
  monitor = NULL,
  control = list(
    sigma = 1.5,
    lambda = 40,
    stop.ons = c(list(stopOnMaxIters(100L)), getDefaultStoppingConditions())