Name

cma_optim — functional interface to the CMA-ES optimizer, a (stochastic) non-convex function minimizer

Calling Sequence

param = cma_optim()
param = cma_optim([])
[xopt, f, out, param] = cma_optim(costf, x0, sigma0 [, param])

Parameters

costf

objective function (cost function) to be minimized. costf must accept a column vector as input and return the scalar cost to be minimized. The return value %nan is allowed and leads to an immediate resampling (and (re-)evaluation) of the solution during the same iteration.

x0

initial solution, a column vector of real values.

sigma0

the initial standard deviation acting on x0, typically 1/3 of the typical variable ranges. If the ranges of variables are different, use param.scaling_of_variables

param

optional parameters collected in a struct. '[]' or '{}' invokes all default settings. param.verb controls verbosity. After the objective function is debugged and when the returned solution(s) are satisfactory, logmodulo=0 (no data saving) and displaymodulo=0 (no screen output) make the code completely quiet (and faster).

xopt

best found solution vector. On noisy functions and for robust optimization out.solutions.mean.x might be the better choice.

f

function value of xopt: f=costf(xopt)

out

additional useful output collected in a struct.

param

output parameter param contains the actually used parameters (some of them might have been evaluated), including x0 and sigma0.

Description

  • The function cma_optim uses the functions cma_new() and other cma_*() funcions that implement the CMA-ES in a more object oriented way.

    The CMA-ES is a stochastic optimizer. It can make perfect sense to re-run the code several times.

Examples

  getf('fitfuns.sci');    // define frosen and felli, file should be in CMA-ES-vXXX/demos
  [f x out] = cma_optim(frosen, rand(8,1), 0.3); // minimize 8-D Rosenbrock function
  disp(f)                 // display achieved function value, x is the delivered solution 

  p = cma_optim([]);      // get optional parameters
  disp(p.stop);           // lets see the possible and default termination criteria
  p.readme.stop           // lets see what the entries mean
  p.stop.fitness = 1e-9;  // set target function value (minimization)
  p.verb.plotmodulo = 0;  // turn plotting off this time
  [f x out] = cma_optim(felli, ones(15,1), 1, p);  // minimize 15-D hyper-ellipsoid function

  disp(out.solutions.bestever.f);    // show the best-ever function value
  disp(felli(out.solutions.mean.x)); // might be an even better solution
  cma_plot;               // let's finally plot the run 

  

See Also

cma_new , cma_plot , cma_optim_restarted , optim

Authors

Nikolaus Hansen

Bibliography

Used Functions

cma_new()

cma_ask()

cma_tell()

...