CMA-ES/pycma
Acerca de
Implementación de CMA-ES en Python
Herramientas de desarrolloCrecimiento de estrellas medido
- in 24h
- 0
- in 7 days
- +2
- in 15 days
- 0
- in 1 month
- Recopilando historial
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
README.md
Originalpycma
Nikolaus Hansen, Youhei Akimoto, and Petr Baudis. CMA-ES/pycma on Github. Zenodo, DOI:10.5281/zenodo.2559635, February 2019.
pycma is a Python implementation of CMA-ES and some related numerical optimization tools.
The CMA-ES (Covariance Matrix Adaptation Evolution Strategy) is a randomized derivative-free numerical optimization algorithm for difficult (non-convex, ill-conditioned, multi-modal, rugged, noisy) optimization problems in continuous and mixed-integer search spaces. This package provides an implementation of the CMA-ES algorithm that includes the handling of
- bound constraints via the
'bounds' = [lower, upper]option or thecma.BoundDomainTransformwrapper - linear and nonlinear constraints via the
constraintsargument tofmin2orfmin_con2 - noise via
noise_handler=Trueas argument tofmin2 - integer variables for mixed-integer problems via the
'integer_variables'=index_listoption
Documentation and Getting Started (Links)
The
notebooksfolder provides example code in Jupyter notebooks, namelyHints for how to use this (kind of) optimization module in practice
Installation of the latest release
In a system shell, type
python -m pip install cma
to install the latest release from the Python Package Index (PyPI).
Type install -U instead of install to upgrade a current installation to the latest release.
The release link also provides more
installation hints and a quick start guide.
Installation from Github
The quick way to install the code from, for example, the development branch (this requires git to be installed):
pip install git+https://github.com/CMA-ES/pycma.git@development
The long way:
get the package
- either download and unzip the code by clicking the green button above
- or, with
gitinstalled, typegit clone https://github.com/CMA-ES/pycma.git
"install" the package
either copy (or move) the
cmasource code folder into a folder which is in the Python path (e.g. the current folder)or modify the Python path to point to the folder where the
cmapackage folder can be found. In both cases,import cmaworks without any further installation.or install the
cmapackage by typingpip install -e .in the (
pycma) folder where thecmapackage folder can be found. Moving thecmafolder away from its location invalidates this installation.
It may be necessary to replace pip with python -m pip and/or prefixing
either of these with sudo.
Version History
-
- console output now starts to overwrite the last line after 4 regular lines,
see option
verb_disp_overwritewhich now expresses "number of lines" - introduce number of
runsattribute inCMAEvolutionStrategyResult2 - introduce
all_stoppingsandall_bestmodule attributes with information collected from restarts - major revision of step-size implementations in
sigma_adaptation.py - polishing of
AugmentedLagrangianconstraints handler and initialization bug fix cma.evolution_strategy.TPA_dimension = 300sets TPA as default step-size adaptation for dimension >= 300.- improve implementation of ridge fitness functions
- implement low effective dimension functions and transformations
- implement
optimization_tools.EvaluationsIteratorto compute non-discretized ERT values from non-f-targeted data - implement
s.figpolishands.gridfor convenience - implement
CountWarningsinstancedeliver_warningsto control the number of warnings shown
- console output now starts to overwrite the last line after 4 regular lines,
see option
-
- fix the fix of issue 343
-
- Addressing issue 231, failures
in corner cases with large population size, by increasing the step-size
damping of CSA and TPA. This seems also to improve the performance on
bbob-f24in 10 and 20-D while worsening the performance onbbob-f23in 10 and 40-D. - Provide option
'TPA_dampfac'analogous to'CSA_dampfac'. - Plots now show the current best solution and the distribution mean in two subplots.
- New:
- Provide the two (by far) most useful statistical tests with a tidy
interface in
cma.utilities.math.test... - Provide a
more_algorithmssub-package containingpurecmaandCompactGA. - Provide a provisional
experimentationmodule (requiresimport cma.experimentation).
- Provide the two (by far) most useful statistical tests with a tidy
interface in
- A few smaller fixes and improvements.
- Addressing issue 231, failures
in corner cases with large population size, by increasing the step-size
damping of CSA and TPA. This seems also to improve the performance on
-
- Fix compatibility issues (with
comocma):- add back the (deprecated)
cma.constraints_handling.BoundTransformclass which was missing since4.1.0. Note thatcma.BoundTransformis the recommended way to access this class - remove dependency of
OOOptimizer.optimizeonself.result
- add back the (deprecated)
- fix issue 337 where plotting bails
with some recent version of
matplotlib>3.8.0. - Various improvements of the logger and plotting.
- Remove default f-offset from binary test functions
(
cma.fitness_functions.binary_foffset = 0by default now) - A few new module settings to (better) control corner case behavior.
- Fix compatibility issues (with
-
fmin2accepts a constraints function asconstraintskeyword argument- an improved
CMAEvolutionStrategyResult2class which also contains the best feasible solution - a
reset_optionsmethod which also clears the current termination status - polish the output of
.optimize()and of.result_pretty() - catch final
.stop()value displayed withcma.plot
-
- constraints handling is available also in the ask-and-tell interface (addressing issues #258, #287, and #167)
askhas anignore_integer_variablesargument to not mutate integer variables- an on/off switch for integer centering,
cma.integer_centering.centering_on(by defaultTrue) - polishing and minor bug fixes
- code internals:
- move integer rounding code (applied to delivered solutions) to the
cma.transformations.RoundIntegerVariablesclass utils.SolutionDictcan behave like a queue too
- move integer rounding code (applied to delivered solutions) to the
-
- integer variables of candidate solutions are rounded (addressing also issue #286)
- moved main docstring from
fmintofmin2 - experimental plots for error estimates and sensitivities
- fix
numpyscalar type representations at various places - replace ineffective
use_archivesflag witharchive_sent_solutionsandarchive_after_sent
-
- a stand-alone boundary handling function wrapper
BoundDomainTransform - streamline plot docs, fix symlog plot with newest
matplotlib, plots display the value of.stop()and the version number - a few more minor fixes and improvements
- replace
setup.pywithpyproject.toml - Version
4.1.0(already since5a30571f)- move boundary handling into a separate module
- various small-ish fixes and improvements, in particular an edge case in the initialization of the Lagrange multipliers in the constraints handling
- a stand-alone boundary handling function wrapper
-
- majorly improved mixed-integer handling based on a more concise lower bound of variances and on so-called integer centering
- moved options and parameters code into a new file
- many small-ish fixes and improvements
-
- fix compatibility to
numpy2.0 (thanks to Sait Cakmak) - improved interface to
noise_handlerargument which acceptsTrueas value - improved interface to
ScaleCoordinatesnow also with lower and upper value mapping to [0, 1], see issue #210 - changed:
'ftarget'triggers with <= instead of < - assign
surrogateattribute (for the record) when callingfmin_lq_surr - various (minor) bug fixes
- various (small) improvements of the plots and their usability
- display iterations, evaluations and population size and termination criteria in the plots
- subtract any recorded x from the plotted x-values by
x_opt=index
- plots are now versus iteration number instead of evaluations by default
- provide legacy
bbobbenchmarkswithout downloading - new:
CMADataLogger.zipallows sharing plotting data more easily by a zip file - new:
tolxstagnationtermination condition for when the incumbent seems stuck - new: collect restart terminations in
cma.evalution_strategy.all_stoppings - new:
stall_sigma_change_on_divergence_iterationsoption to stallsigmachange when the median fitness is worsening - new: limit active C update for integer variables
- new: provide a COCO single function
- fix compatibility to
Release
3.3.0implements- diagonal acceleration via diagonal decoding (option
CMA_diagonal_decoding, by default still off). fmin_lq_surr2for running the surrogate assisted lq-CMA-ES.optimization_tools.ShowInFolderto facilitate rapid experimentation.verb_disp_overwriteoption starts to overwrite the last line of the display output instead of continuing adding lines to avoid screen flooding with longish runs (off by default).- various smallish improvements, bug fixes and additional features and functions.
- diagonal acceleration via diagonal decoding (option
Release
3.2.2fixes some smallish interface and logging bugs inConstrainedFitnessALand a bug when printing a warning. Polishing mainly in the plotting functions. Added a notebook for how to use constraints.Release
3.2.1fixes plot of principal axes which were shown squared by mistake in version 3.2.0.Release
3.2.0provides a new interface for constrained optimizationConstrainedFitnessALandfmin_con2and many other minor fixes and improvements.Release
3.1.0fixes the return value offmin_con, improves its usability and provides abest_feasibleattribute inCMAEvolutionStrategy, in addition to various other more minor code fixes and improvements.Release
3.0.3provides parallelization withOOOptimizer.optimize(..., n_jobs=...)(fix for3.0.1/2) and improvedpicklesupport.Release
3.0.0provides non-linear constraints handling, improved plotting and termination options and better resilience to injecting bad solutions, and further various fixes.Version
2.7.1allows for a list of termination callbacks and a light copy ofCMAEvolutionStrategyinstances.Release
2.7.0logger now writes into a folder, new fitness model module, various fixes.Release
2.6.1allow possibly much larger condition numbers, fix corner case with growing more-to-write list.Release
2.6.0allows initial solutionx0to be a callable.Version
2.4.2added the functioncma.fmin2which, similar tocma.purecma.fmin, returns(x_best:numpy.ndarray, es:cma.CMAEvolutionStrategy)instead of a 10-tuple likecma.fmin. The result 10-tuple is accessible ines.result:namedtuple.Version
2.4.1includedbbobtestbed.Version
2.2.0added VkD CMA-ES to the master branch.Version
2.*is a multi-file split-up of the original module.Version
1.x.*is a one file implementation and not available in the history of this repository. The latest1.*version1.1.7can be found here.
Explorar proyectos relacionados
Cargando…