optunity.solvers.CMAES module

class optunity.solvers.CMAES.CMA_ES(num_generations, sigma=1.0, Lambda=None, **kwargs)[source]

Bases: optunity.solvers.util.Solver

Please refer to CMA-ES for details about this algorithm.

This solver uses an implementation available in the DEAP library [DEAP2012].

Warning

This solver has dependencies on DEAP and NumPy and will be unavailable if these are not met.

blah

Warning

This solver is not explicitly constrained. The box constraints that are given are used for initialization, but solver may leave the specified region during iterations. If this is unacceptable, you must manually constrain the domain of the objective function prior to using this solver (cfr. Domain constraints).

lambda_
maximize(f, pmap=<built-in function map>)

Maximizes f.

Parameters:
  • f (callable) – the objective function
  • pmap (callable) – the map() function to use
Returns:

  • the arguments which optimize f
  • an optional solver report, can be None

minimize(f, pmap=<built-in function map>)

Minimizes f.

Parameters:
  • f (callable) – the objective function
  • pmap (callable) – the map() function to use
Returns:

  • the arguments which optimize f
  • an optional solver report, can be None

num_generations
optimize(f, maximize=True, pmap=<built-in function map>)[source]

Optimizes f.

Parameters:
  • f (callable) – the objective function
  • maximize (boolean) – do we want to maximizes?
  • pmap (callable) – the map() function to use
Returns:

  • the arguments which optimize f
  • an optional solver report, can be None

sigma
start

Returns the starting point for CMA-ES.

static suggest_from_seed(num_evals, **kwargs)[source]

Verify that we can effectively make a solver. The doctest has to be skipped from automated builds, because DEAP may not be available and yet we want documentation to be generated.

>>> s = CMA_ES.suggest_from_seed(30, x=1.0, y=-1.0, z=2.0)
>>> solver = CMA_ES(**s)