
    J-jq                        d Z ddlmZ ddlmZ ddlmZ [[[dZdZ	dZ
	 ddlZddlZd	d
lmZ 	 ddlZd	dlmZmZmZmZmZmZmZmZmZmZ dZd	dlmZ d	dlm Z  d	dlm!Z!m"Z" d	dlm#Z#m$Z$m%Z%m&Z&m'Z'm(Z( d	dlm)Z) d	dl*m+Z+m,Z, e)Z-d	dl.m/Z/m0Z0m1Z1m2Z2 d	dlm3Z3 d	dl4m5Z5m6Z6m7Z7m8Z8 d	dlm9Z9m:Z: e6e_6        	   ejz                  ddd      d e
j}                  d      d   j}                  d      D         Z? eBd! e
j}                  d      d   j}                  d      D              Z?y# e;$ r  ejx                  d       Y w xY w# e@$ r~ 	   ejz                  dd      d e
j}                  d      d   j}                  d      D         Z?n;# eA$ r3  eBd  e
j}                  d      d   j}                  d      D              Z?Y nw xY wY w xY w)"ad  Package `cma` implements the CMA-ES (Covariance Matrix Adaptation
Evolution Strategy).

CMA-ES is a stochastic optimizer for robust non-linear non-convex
derivative- and function-value-free numerical optimization.

This release was tested with Python versions 3.8 to 3.13. The
implementation is intended to be compatible with Python >= 2.7.

CMA-ES searches for a minimizer (a solution x in :math:`R^n`) of an
objective function f (cost function), such that f(x) is minimal. Regarding
f, only a passably reliable ranking of the candidate solutions in each
iteration is necessary. Neither the function values themselves, nor the
gradient of f need to be available or do matter, like in the downhill
simplex Nelder-Mead algorithm. Some termination criteria however depend on
actual Delta f-values.

The `cma` module provides two independent implementations of the
CMA-ES algorithm in the classes `cma.CMAEvolutionStrategy` and
`cma.purecma.CMAES`.

In each implementation two interfaces are provided:

- functions `fmin2` and `purecma.fmin`:
    run a complete minimization of the passed objective function with
    CMA-ES. `fmin2` also provides optional restarts and noise handling.

- class `CMAEvolutionStrategy` (and the alias `CMA`) and `purecma.CMAES`:
    allow for minimization such that the control of the iteration loop
    remains with the user. `fmin2` returns an instance of
    `CMAEvolutionStrategy`.

Additionally, `fmin_con2` provides constrained optimization.

For a quick start see below or confer to the notebook(s) https://github.com/CMA-ES/pycma/blob/development/notebooks/notebook-usecases-basics.ipynb

`CMAEvolutionStrategy` relies, in contrast to `cma.purecma`, heavily on
`numpy` and optionally on `matplotlib.pyplot` (for `plot` etc., optional
but highly recommended).

The source code is available at https://github.com/CMA-ES/pycma.

Testing
=======
From the system shell::

    python -m cma.test -h
    python -m cma.test
    python -c "import cma.test; cma.test.main()"  # the same

or from any (i)python shell::

    import cma.test
    cma.test.main()

should run without complaints in about between 20 and 100 seconds.

Example
=======
From a python shell::

    import cma
    help(cma)  # "this" help message, use cma? in ipython
    help(cma.fmin)
    help(cma.CMAEvolutionStrategy)
    help(cma.CMAOptions)
    cma.CMAOptions('tol')  # display 'tolerance' termination options
    cma.CMAOptions('verb') # display verbosity options
    x, es = cma.fmin2(cma.ff.tablet, 15 * [1], 1)
    es = cma.CMAEvolutionStrategy(15 * [1], 1).optimize(cma.ff.tablet)
    help(es.result)
    x, es.result[0]  # best evaluated solution
    es.result[5]  # mean solution, presumably better with noise

:See also: `fmin` (), `CMAOptions`, `CMAEvolutionStrategy`

:Author: Nikolaus Hansen, 2008-
:Author: Petr Baudis, 2014
:Author: Youhei Akimoto, 2017-

:License: BSD 3-Clause, see LICENSE file.

    )absolute_import)division)print_functionz2Nikolaus Hansen and Petr Baudis and Youhei AkimotozBSD 3-clausez4.4.4N   )purecma)
constraints_handlerevolution_strategyfitness_functionsfitness_transformations
interfacesoptimization_toolssamplersigma_adaptationtransformations	utilitiesz;type "import cma.test" to access the `test` module of `cma`)s)ff)GlueArgumentsScaleCoordinates)fminfmin2fmin_con	fmin_con2fmin_lq_surrfmin_lq_surr2)CMAEvolutionStrategy)
CMAOptionscma_default_options_)dispplotplot_zipCMADataLogger)NoiseHandler)BoundPenaltyBoundTransform	BoundNoneBoundDomainTransform)ConstrainedFitnessALAugmentedLagrangianz{Only `cma.purecma` has been imported. Install `numpy` ("pip install numpy") if you want to import the entire `cma` package.version_info)majorminormicrocma)modulec              #   2   K   | ]  }t        |        y wNint.0r   s     Z/Users/jameslopez/projects/TradingBot25/.venv/lib/python3.12/site-packages/cma/__init__.py	<genexpr>r7      s     K&Jc!f&J    .c              #   2   K   | ]  }t        |        y wr1   r2   r4   s     r6   r7   r7      s     O*NQ#a&*Nr8   c              #   2   K   | ]  }t        |        y wr1   r2   r4   s     r6   r7   r7      s     R-QSV-Qr8   c              #   2   K   | ]  }t        |        y wr1   r2   r4   s     r6   r7   r7      s     J%ISV%Ir8   )C__doc__
__future__r   _abr   _dir   _pr___author____license____version__collections_collectionswarnings	_warningsmore_algorithmsr   numpy_np r   r	   r
   r   r   r   r   r   r   r   testr   r   r   r   r   r   r   r   r   r   r   options_parametersr   r   CMAloggerr   r    r!   r"   r#   boundary_handlerr$   r%   r&   r'   r(   r)   ImportErrorwarn
namedtuplesplitr*   	TypeError	Exceptiontuple     r6   <module>r\      s  R@ . & ,c C  #  %8  
 ID%Haa8D
C;;0__N)7&
SG*<**7GKk&7&7&<Q&?&E&Ec&JKML J[%6%6s%;A%>%D%DS%IJJI   INN    8  SS=.|.. ;=O+*;*;C*@*C*I*I#*NOQ  SR[->->s-CA-F-L-LS-QRRSSsH   D .A D< D98D9<F?>F F?5F96F?8F99F?>F?