devo_numpy

compas.numerical.devo_numpy(fn, bounds, population, generations, limit=0, elites=0.2, F=0.8, CR=0.5, polish=False, args=(), plot=False, frange=[], printout=10, neutrals=0.05, **kwargs)[source]

Call the Differential Evolution solver.

Parameters
  • fn (obj) – The function to evaluate and minimize.

  • bounds (list) – Lower and upper bounds for each DoF [[lb, ub], …].

  • population (int) – Number of starting agents in the population.

  • generations (int) – Number of cross-over cycles/steps to perform.

  • limit (float) – Value of the objective function to terminate optimisation.

  • elites (float) – Fraction of elite agents kept.

  • F (float) – Differential evolution parameter.

  • CR (float) – Differential evolution cross-over ratio parameter.

  • polish (bool) – Polish the final result with L-BFGS-B.

  • args (seq) – Sequence of optional arguments to pass to fn.

  • plot (bool) – Plot progress.

  • frange (list) – Minimum and maximum f value to plot.

  • printout (int) – Print progress to screen.

  • neutrals (float) – Fraction of neutral starting agents.

Returns

  • float – Optimal value of objective function.

  • list – Values that give the optimum (minimized) function.

Notes

References

Examples

>>> from scipy.optimize import rosen
>>> def f(u, *args):
...     return rosen(u.ravel())
...
>>> x0 = [1.3, 0.7, 0.8, 1.9, 1.2]
>>> bounds = [[-10.0, 10.0], [-10.0, 10.0], [-10.0, 10.0], [-10.0, 10.0], [-10.0, 10.0]]
>>> res = devo_numpy(f, bounds, 200, 1000, polish=False, plot=False, frange=[0, 100], neutrals=0)