+
    LV-j·à  ã                   óÆ   € ^ RI t ^ RIt^ RIHtHtHtHt ^RIH	t	 ^RI
HtHtHtHtHt ^RIHtHtHtHtHt ^RIHtHtHtHtHtHt RR ltR tR	 tR
 t R t!R t"R t#R t$R# )é    N)ÚBoundsÚLinearConstraintÚNonlinearConstraintÚOptimizeResult)ÚTrustRegion)ÚObjectiveFunctionÚBoundConstraintsÚLinearConstraintsÚNonlinearConstraintsÚProblem)ÚMaxEvalErrorÚTargetSuccessÚCallbackSuccessÚFeasibleSuccessÚexact_1d_array)Ú
ExitStatusÚOptionsÚ	ConstantsÚDEFAULT_OPTIONSÚDEFAULT_CONSTANTSÚPRINT_OPTIONSc                óØ  € Vf   / pM\        V4      pVP                  \        P                  \        \        P                  ,          4      p\        V4      pVP                  \        P                  \        \        P                  ,          4      p	\        V	4      p	VP                  \        P                  \        \        P                  ,          4      p
\        V
4      p
VP                  \        P                  \        \        P                  ,          4      p\        V4      p\        P                  V9   d(   V\        P                  ,          ^ 8:  d   \        R4      hVP                  \        P                  \        \        P                  ,          4      p\        V4      p\        P                  V9   d(   V\        P                  ,          ^ 8:  d   \        R4      hVP                  \        P                  \        \        P                  ,          4      p\        V4      pVP                  \        P                  \        \        P                  ,          4      p\        V4      p\        V\         4      '       g   V3p\#        WV.VO5!  p\%        VR4      '       g   V.p\'        V4      p\)        \+        VV4      4      p\-        V4      w  pp\/        VVV4      p\1        VWŽ4      p\3        VVVVVVV	V
VVVV4      p\5        VVP6                  4       \9        R/ VB pVP:                  P<                  '       g   \?        VRR\@        PB                  ^ V4      # VP6                  ^ 8X  d   \?        VRR\@        PD                  ^ V4      # V'       d¦   \G        R4       \G        R	V\        PH                  ,           R
24       \G        RV\        PJ                  ,           R
24       \G        RV\        PL                  ,           R
24       \G        RV\        PN                  ,           R
24       \G        4         \Q        VVV4      pRp^ pRp^ p^ p^ p TT\        PN                  ,          8¼  d   \@        P`                  pEM&T^,          p\b        Pd                  Pk                  TPl                  TPn                  Pp                  Pr                  ,
          4      T\t        Pv                  ,          TPx                  ,          8¼  d   TP{                  T4       TPx                  pTP}                  T4      w  p p!T T!,           p"\b        Pd                  Pk                  T"4      p#T#T\t        P~                  ,          TP€                  ,          8:  dè   T;Px                  T\t        P‚                  ,          ,          un<        TTP€                  8”  d   ^ p^ pM,T^,          pT^,          pT#RTP€                  ,          8”  d   ^ pT^8¬  ;'       g    T^8¬  p$T$'       d	   ^ p^ pRp%EM& TP…                  4       w  pp&T&\‡        TPx                  T\t        Pˆ                  ,          TP€                  ,          4      8„  p%EMÑTP‹                  T"4      p'T''       Ed´    \�        TTT"T4      w  p(p)p*TP‘                  TPl                  TP’                  TP”                  TP–                  4      p+TP‘                  TPl                  T",           T(T)T*4      p,TP˜                  R8X  d«   T,T+8”  d¤   \b        Pd                  Pk                  T 4      T\t        Pš                  ,          R,          TPx                  ,          8”  dS   TP�                  T"T4      p-\b        Pd                  Pk                  T-4      R8”  d   T"T-,          p" \�        TTT"T4      w  p(p)p*TPŸ                  T"T(T)T*4      p. TP…                  TPl                  T",           4      ^ ,          p TPn                  P¡                  TTPl                  T",           T(T)T*4      p/TP£                  4        TP¥                  T"T.4       TPx                  TP€                  8:  d÷   T.T\t        P¦                  ,          8¼  d   ^ pM×T^,          pTPn                  P©                  TPl                  4      p0 TPn                  P«                  TPl                  4      p1\b        Pd                  Pk                  T04      T\t        P¬                  ,          \b        Pd                  Pk                  T14      ,          8  d   ^ pT^8¼  d    TPn                  P¯                  4        ^ pTP±                  TPl                  T",           4        TP…                  4       w  pp&T/;'       gb    T.T\t        P²                  ,          8*  ;'       d@    T&\‡        TPx                  T\t        Pˆ                  ,          TP€                  ,          4      8„  p%TTP€                  8*  ;'       d*    T.T\t        P²                  ,          8*  ;'       d    T%'       * p$MRp$Rp%T$'       dê   TP€                  T\        PJ                  ,          8:  d   Rp\@        P´                  pEM$TP·                  T4       TP¹                  4        T'       d‡   TP»                  TPl                  TP”                  TP–                  4      p2\½        RTP€                   2TTP¿                  TPl                  4      TP’                  T2TPÀ                  T4       \G        4        T%'       g   EKë   TPÃ                  TT4      p" \�        TTT"T4      w  p(p)p* TPn                  P¡                  TTPl                  T",           T(T)T*4       TP£                  4        EKU  \?        TTPÄ                  TTTT4      #   \R         d"    \?        TRR\@        PT                  ^ T4      u # \V         d"    \?        TRR\@        PX                  ^ T4      u # \Z         d"    \?        TRR\@        P\                  ^ T4      u # \^         d"    \?        TRR\@        P`                  ^ T4      u # \b        Pd                  Pf                   d"    \?        TRR\@        Ph                  ^ T4      u # i ; i  \b        Pd                  Pf                   d    \@        Ph                  p EK8  i ; i  \R         d    \@        PT                  pRp EK]  \Z         d    \@        P\                  pRp EK}  \V         d    \@        PX                  pRp EK�  \^         d    \@        PŽ                  p EK»  i ; i  \R         d    \@        PT                  pRp EKà  \Z         d    \@        P\                  pRp EK   \V         d    \@        PX                  pRp EK   \^         d    \@        PŽ                  p EK>  i ; i  \b        Pd                  Pf                   d    \@        Ph                  p EKu  i ; i  \b        Pd                  Pf                   d    \@        Ph                  p EK¬  i ; i  \b        Pd                  Pf                   d    \@        Ph                  p EKã  i ; i  \b        Pd                  Pf                   d    \@        Ph                  p EK  i ; i  \b        Pd                  Pf                   d    \@        Ph                  p EKQ  i ; i  \b        Pd                  Pf                   d    \@        Ph                  p EKˆ  i ; i  \R         d    \@        PT                  pRp EK­  \Z         d    \@        P\                  pRp EKÍ  \V         d    \@        PX                  pRp EKí  \^         d    \@        PŽ                  p EK  i ; i  \b        Pd                  Pf                   d    \@        Ph                  p EKB  i ; i)a�:  
Minimize a scalar function using the COBYQA method.

The Constrained Optimization BY Quadratic Approximations (COBYQA) method is
a derivative-free optimization method designed to solve general nonlinear
optimization problems. A complete description of COBYQA is given in [3]_.

Parameters
----------
fun : {callable, None}
    Objective function to be minimized.

        ``fun(x, *args) -> float``

    where ``x`` is an array with shape (n,) and `args` is a tuple. If `fun`
    is ``None``, the objective function is assumed to be the zero function,
    resulting in a feasibility problem.
x0 : array_like, shape (n,)
    Initial guess.
args : tuple, optional
    Extra arguments passed to the objective function.
bounds : {`scipy.optimize.Bounds`, array_like, shape (n, 2)}, optional
    Bound constraints of the problem. It can be one of the cases below.

    #. An instance of `scipy.optimize.Bounds`. For the time being, the
       argument ``keep_feasible`` is disregarded, and all the constraints
       are considered unrelaxable and will be enforced.
    #. An array with shape (n, 2). The bound constraints for ``x[i]`` are
       ``bounds[i][0] <= x[i] <= bounds[i][1]``. Set ``bounds[i][0]`` to
       :math:`-\infty` if there is no lower bound, and set ``bounds[i][1]``
       to :math:`\infty` if there is no upper bound.

    The COBYQA method always respect the bound constraints.
constraints : {Constraint, list}, optional
    General constraints of the problem. It can be one of the cases below.

    #. An instance of `scipy.optimize.LinearConstraint`. The argument
       ``keep_feasible`` is disregarded.
    #. An instance of `scipy.optimize.NonlinearConstraint`. The arguments
       ``jac``, ``hess``, ``keep_feasible``, ``finite_diff_rel_step``, and
       ``finite_diff_jac_sparsity`` are disregarded.

    #. A list, each of whose elements are described in the cases above.

callback : callable, optional
    A callback executed at each objective function evaluation. The method
    terminates if a ``StopIteration`` exception is raised by the callback
    function. Its signature can be one of the following:

        ``callback(intermediate_result)``

    where ``intermediate_result`` is a keyword parameter that contains an
    instance of `scipy.optimize.OptimizeResult`, with attributes ``x``
    and ``fun``, being the point at which the objective function is
    evaluated and the value of the objective function, respectively. The
    name of the parameter must be ``intermediate_result`` for the callback
    to be passed an instance of `scipy.optimize.OptimizeResult`.

    Alternatively, the callback function can have the signature:

        ``callback(xk)``

    where ``xk`` is the point at which the objective function is evaluated.
    Introspection is used to determine which of the signatures to invoke.
options : dict, optional
    Options passed to the solver. Accepted keys are:

        disp : bool, optional
            Whether to print information about the optimization procedure.
            Default is ``False``.
        maxfev : int, optional
            Maximum number of function evaluations. Default is ``500 * n``.
        maxiter : int, optional
            Maximum number of iterations. Default is ``1000 * n``.
        target : float, optional
            Target on the objective function value. The optimization
            procedure is terminated when the objective function value of a
            feasible point is less than or equal to this target. Default is
            ``-numpy.inf``.
        feasibility_tol : float, optional
            Tolerance on the constraint violation. If the maximum
            constraint violation at a point is less than or equal to this
            tolerance, the point is considered feasible. Default is
            ``numpy.sqrt(numpy.finfo(float).eps)``.
        radius_init : float, optional
            Initial trust-region radius. Typically, this value should be in
            the order of one tenth of the greatest expected change to `x0`.
            Default is ``1.0``.
        radius_final : float, optional
            Final trust-region radius. It should indicate the accuracy
            required in the final values of the variables. Default is
            ``1e-6``.
        nb_points : int, optional
            Number of interpolation points used to build the quadratic
            models of the objective and constraint functions. Default is
            ``2 * n + 1``.
        scale : bool, optional
            Whether to scale the variables according to the bounds. Default
            is ``False``.
        filter_size : int, optional
            Maximum number of points in the filter. The filter is used to
            select the best point returned by the optimization procedure.
            Default is ``sys.maxsize``.
        store_history : bool, optional
            Whether to store the history of the function evaluations.
            Default is ``False``.
        history_size : int, optional
            Maximum number of function evaluations to store in the history.
            Default is ``sys.maxsize``.
        debug : bool, optional
            Whether to perform additional checks during the optimization
            procedure. This option should be used only for debugging
            purposes and is highly discouraged to general users. Default is
            ``False``.

    Other constants (from the keyword arguments) are described below. They
    are not intended to be changed by general users. They should only be
    changed by users with a deep understanding of the algorithm, who want
    to experiment with different settings.

Returns
-------
`scipy.optimize.OptimizeResult`
    Result of the optimization procedure, with the following fields:

        message : str
            Description of the cause of the termination.
        success : bool
            Whether the optimization procedure terminated successfully.
        status : int
            Termination status of the optimization procedure.
        x : `numpy.ndarray`, shape (n,)
            Solution point.
        fun : float
            Objective function value at the solution point.
        maxcv : float
            Maximum constraint violation at the solution point.
        nfev : int
            Number of function evaluations.
        nit : int
            Number of iterations.

    If ``store_history`` is True, the result also has the following fields:

        fun_history : `numpy.ndarray`, shape (nfev,)
            History of the objective function values.
        maxcv_history : `numpy.ndarray`, shape (nfev,)
            History of the maximum constraint violations.

    A description of the termination statuses is given below.

    .. list-table::
        :widths: 25 75
        :header-rows: 1

        * - Exit status
          - Description
        * - 0
          - The lower bound for the trust-region radius has been reached.
        * - 1
          - The target objective function value has been reached.
        * - 2
          - All variables are fixed by the bound constraints.
        * - 3
          - The callback requested to stop the optimization procedure.
        * - 4
          - The feasibility problem received has been solved successfully.
        * - 5
          - The maximum number of function evaluations has been exceeded.
        * - 6
          - The maximum number of iterations has been exceeded.
        * - -1
          - The bound constraints are infeasible.
        * - -2
          - A linear algebra error occurred.

Other Parameters
----------------
decrease_radius_factor : float, optional
    Factor by which the trust-region radius is reduced when the reduction
    ratio is low or negative. Default is ``0.5``.
increase_radius_factor : float, optional
    Factor by which the trust-region radius is increased when the reduction
    ratio is large. Default is ``numpy.sqrt(2.0)``.
increase_radius_threshold : float, optional
    Threshold that controls the increase of the trust-region radius when
    the reduction ratio is large. Default is ``2.0``.
decrease_radius_threshold : float, optional
    Threshold used to determine whether the trust-region radius should be
    reduced to the resolution. Default is ``1.4``.
decrease_resolution_factor : float, optional
    Factor by which the resolution is reduced when the current value is far
    from its final value. Default is ``0.1``.
large_resolution_threshold : float, optional
    Threshold used to determine whether the resolution is far from its
    final value. Default is ``250.0``.
moderate_resolution_threshold : float, optional
    Threshold used to determine whether the resolution is close to its
    final value. Default is ``16.0``.
low_ratio : float, optional
    Threshold used to determine whether the reduction ratio is low. Default
    is ``0.1``.
high_ratio : float, optional
    Threshold used to determine whether the reduction ratio is high.
    Default is ``0.7``.
very_low_ratio : float, optional
    Threshold used to determine whether the reduction ratio is very low.
    This is used to determine whether the models should be reset. Default
    is ``0.01``.
penalty_increase_threshold : float, optional
    Threshold used to determine whether the penalty parameter should be
    increased. Default is ``1.5``.
penalty_increase_factor : float, optional
    Factor by which the penalty parameter is increased. Default is ``2.0``.
short_step_threshold : float, optional
    Factor used to determine whether the trial step is too short. Default
    is ``0.5``.
low_radius_factor : float, optional
    Factor used to determine which interpolation point should be removed
    from the interpolation set at each iteration. Default is ``0.1``.
byrd_omojokun_factor : float, optional
    Factor by which the trust-region radius is reduced for the computations
    of the normal step in the Byrd-Omojokun composite-step approach.
    Default is ``0.8``.
threshold_ratio_constraints : float, optional
    Threshold used to determine which constraints should be taken into
    account when decreasing the penalty parameter. Default is ``2.0``.
large_shift_factor : float, optional
    Factor used to determine whether the point around which the quadratic
    models are built should be updated. Default is ``10.0``.
large_gradient_factor : float, optional
    Factor used to determine whether the models should be reset. Default is
    ``10.0``.
resolution_factor : float, optional
    Factor by which the resolution is decreased. Default is ``2.0``.
improve_tcg : bool, optional
    Whether to improve the steps computed by the truncated conjugate
    gradient method when the trust-region boundary is reached. Default is
    ``True``.

References
----------
.. [1] J. Nocedal and S. J. Wright. *Numerical Optimization*. Springer Ser.
   Oper. Res. Financ. Eng. Springer, New York, NY, USA, second edition,
   2006. `doi:10.1007/978-0-387-40065-5
   <https://doi.org/10.1007/978-0-387-40065-5>`_.
.. [2] M. J. D. Powell. A direct search optimization method that models the
   objective and constraint functions by linear interpolation. In S. Gomez
   and J.-P. Hennart, editors, *Advances in Optimization and Numerical
   Analysis*, volume 275 of Math. Appl., pages 51--67. Springer, Dordrecht,
   Netherlands, 1994. `doi:10.1007/978-94-015-8330-5_4
   <https://doi.org/10.1007/978-94-015-8330-5_4>`_.
.. [3] T. M. Ragonneau. *Model-Based Derivative-Free Optimization Methods
   and Software*. PhD thesis, Department of Applied Mathematics, The Hong
   Kong Polytechnic University, Hong Kong, China, 2022. URL:
   https://theses.lib.polyu.edu.hk/handle/200/12294.

Examples
--------
To demonstrate how to use `minimize`, we first minimize the Rosenbrock
function implemented in `scipy.optimize` in an unconstrained setting.

.. testsetup::

    import numpy as np
    np.set_printoptions(precision=3, suppress=True)

>>> from cobyqa import minimize
>>> from scipy.optimize import rosen

To solve the problem using COBYQA, run:

>>> x0 = [1.3, 0.7, 0.8, 1.9, 1.2]
>>> res = minimize(rosen, x0)
>>> res.x
array([1., 1., 1., 1., 1.])

To see how bound and constraints are handled using `minimize`, we solve
Example 16.4 of [1]_, defined as

.. math::

    \begin{aligned}
        \min_{x \in \mathbb{R}^2}   & \quad (x_1 - 1)^2 + (x_2 - 2.5)^2\\
        \text{s.t.}                 & \quad -x_1 + 2x_2 \le 2,\\
                                    & \quad x_1 + 2x_2 \le 6,\\
                                    & \quad x_1 - 2x_2 \le 2,\\
                                    & \quad x_1 \ge 0,\\
                                    & \quad x_2 \ge 0.
    \end{aligned}

>>> import numpy as np
>>> from scipy.optimize import Bounds, LinearConstraint

Its objective function can be implemented as:

>>> def fun(x):
...     return (x[0] - 1.0)**2 + (x[1] - 2.5)**2

This problem can be solved using `minimize` as:

>>> x0 = [2.0, 0.0]
>>> bounds = Bounds([0.0, 0.0], np.inf)
>>> constraints = LinearConstraint([
...     [-1.0, 2.0],
...     [1.0, 2.0],
...     [1.0, -2.0],
... ], -np.inf, [2.0, 6.0, 2.0])
>>> res = minimize(fun, x0, bounds=bounds, constraints=constraints)
>>> res.x
array([1.4, 1.7])

To see how nonlinear constraints are handled, we solve Problem (F) of [2]_,
defined as

.. math::

    \begin{aligned}
        \min_{x \in \mathbb{R}^2}   & \quad -x_1 - x_2\\
        \text{s.t.}                 & \quad x_1^2 - x_2 \le 0,\\
                                    & \quad x_1^2 + x_2^2 \le 1.
    \end{aligned}

>>> from scipy.optimize import NonlinearConstraint

Its objective and constraint functions can be implemented as:

>>> def fun(x):
...     return -x[0] - x[1]
>>>
>>> def cub(x):
...     return [x[0]**2 - x[1], x[0]**2 + x[1]**2]

This problem can be solved using `minimize` as:

>>> x0 = [1.0, 1.0]
>>> constraints = NonlinearConstraint(cub, -np.inf, [0.0, 1.0])
>>> res = minimize(fun, x0, constraints=constraints)
>>> res.x
array([0.707, 0.707])

Finally, to see how to supply linear and nonlinear constraints
simultaneously, we solve Problem (G) of [2]_, defined as

.. math::

    \begin{aligned}
        \min_{x \in \mathbb{R}^3}   & \quad x_3\\
        \text{s.t.}                 & \quad 5x_1 - x_2 + x_3 \ge 0,\\
                                    & \quad -5x_1 - x_2 + x_3 \ge 0,\\
                                    & \quad x_1^2 + x_2^2 + 4x_2 \le x_3.
    \end{aligned}

Its objective and nonlinear constraint functions can be implemented as:

>>> def fun(x):
...     return x[2]
>>>
>>> def cub(x):
...     return x[0]**2 + x[1]**2 + 4.0*x[1] - x[2]

This problem can be solved using `minimize` as:

>>> x0 = [1.0, 1.0, 1.0]
>>> constraints = [
...     LinearConstraint(
...         [[5.0, -1.0, 1.0], [-5.0, -1.0, 1.0]],
...         [0.0, 0.0],
...         np.inf,
...     ),
...     NonlinearConstraint(cub, -np.inf, 0.0),
... ]
>>> res = minimize(fun, x0, constraints=constraints)
>>> res.x
array([ 0., -3., -3.])
Nz)The size of the history must be positive.z(The size of the filter must be positive.Ú__len__ç        FTz$Starting the optimization procedure.zInitial trust-region radius: Ú.zFinal trust-region radius: z(Maximum number of function evaluations: zMaximum number of iterations: gš™™™™™¹?znonlinearly constrainedç       @zNew trust-region radius: © )cÚdictÚgetr   ÚVERBOSEr   ÚboolÚFEASIBILITY_TOLÚfloatÚSCALEÚSTORE_HISTORYÚHISTORY_SIZEÚ
ValueErrorÚintÚFILTER_SIZEÚDEBUGÚ
isinstanceÚtupler   ÚhasattrÚlenr	   Ú_get_boundsÚ_get_constraintsr
   r   r   Ú_set_default_optionsÚnÚ_set_default_constantsÚboundsÚis_feasibleÚ_build_resultr   ÚINFEASIBLE_ERRORÚFIXED_SUCCESSÚprintÚRHOBEGÚRHOENDÚMAX_EVALÚMAX_ITERr   r   ÚTARGET_SUCCESSr   ÚCALLBACK_SUCCESSr   ÚFEASIBLE_SUCCESSr   ÚMAX_ITER_WARNINGÚnpÚlinalgÚLinAlgErrorÚLINALG_ERRORÚnormÚx_bestÚmodelsÚinterpolationÚx_baser   ÚLARGE_SHIFT_FACTORÚradiusÚshift_x_baseÚget_trust_region_stepÚSHORT_STEP_THRESHOLDÚ
resolutionÚDECREASE_RESOLUTION_FACTORÚget_index_to_removeÚmaxÚRESOLUTION_FACTORÚincrease_penaltyÚ_evalÚMAX_EVAL_WARNINGÚmeritÚfun_bestÚcub_bestÚceq_bestÚtypeÚBYRD_OMOJOKUN_FACTORÚ get_second_order_correction_stepÚget_reduction_ratioÚupdate_interpolationÚset_best_indexÚupdate_radiusÚVERY_LOW_RATIOÚfun_gradÚfun_alt_gradÚLARGE_GRADIENT_FACTORÚreset_modelsÚset_multipliersÚ	LOW_RATIOÚRADIUS_SUCCESSÚenhance_resolutionÚdecrease_penaltyÚmaxcvÚ_print_stepÚbuild_xÚn_evalÚget_geometry_stepÚpenalty)3ÚfunÚx0Úargsr4   ÚconstraintsÚcallbackÚoptionsÚkwargsÚverboseÚfeasibility_tolÚscaleÚstore_historyÚhistory_sizeÚfilter_sizeÚdebugÚobjÚn_origÚlinear_constraintsÚnonlinear_constraintsÚlinearÚ	nonlinearÚpbÚ	constantsÚ	frameworkÚsuccessÚn_iterÚk_newÚn_short_stepsÚn_very_short_stepsÚn_alt_modelsÚstatusÚradius_saveÚnormal_stepÚtangential_stepÚstepÚs_normrk   Úimprove_geometryÚdist_newÚsame_best_pointÚfun_valÚcub_valÚceq_valÚ	merit_oldÚ	merit_newÚsoc_stepÚratioÚill_conditionedÚgradÚgrad_altÚ	maxcv_vals3   &&&&&&&,                                           Úg/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/scipy/_lib/cobyqa/main.pyÚminimizer¥   $   s  € ðF ‚Ø‰ä�w“-ˆØ�k‰kœ'Ÿ/™/¬?¼7¿?¹?Õ+KÓL€GÜ�7‹m€GØ—k‘kÜ×ÑÜœ×/Ñ/Õ0ó€Oô ˜OÓ,€OØ�K‰KœŸ™¤´w·}±}Õ'EÓF€EÜ�‹K€EØ—K‘KÜ×ÑÜœ×-Ñ-Õ.ó€Mô ˜Ó'€MÜ×Ñ˜wÔ&¨7´7×3GÑ3GÕ+HÈAÔ+MÜÐDÓEÐEØ—;‘;Ü×ÑÜœ×,Ñ,Õ-ó€Lô �|Ó$€LÜ×Ñ˜gÔ%¨'´'×2EÑ2EÕ*FÈ!Ô*KÜÐCÓDÐDØ—+‘+Ü×ÑÜœ×+Ñ+Õ,ó€Kô �kÓ"€KØ�K‰KœŸ™¤´w·}±}Õ'EÓF€EÜ�‹K€Eô �dœE×"Ò"ØˆwˆÜ
˜C¨%Ð
7°$Ó
7€Cô �2�y×!Ò!ØˆTˆÜ�‹W€FÜœk¨&°&Ó9Ó:€Fô 1AÀÓ0MÑ-ÐÐ-ÜÐ1°6¸5ÓA€FÜ$Ð%:¸GÓK€Iô 
ØØ
ØØØØØØØØØØó
€Bô  ˜ "§$¡$Ô'Ü&Ñ0¨Ñ0€Ið �9‰9× × Ð äØØØÜ×'Ñ'ØØó
ð 	
ð 
�‰�ŒäØØØÜ×$Ñ$ØØó
ð 	
÷ ÜÐ4Ô5ÜÐ-¨g´g·n±nÕ.EÐ-FÀaÐHÔIÜÐ+¨G´G·N±NÕ,CÐ+DÀAÐFÔGÜØ6Ø”w×'Ñ'Õ(Ð)¨ð,ô	
ô 	Ð.¨w´w×7GÑ7GÕ/HÐ.IÈÐKÔLÜŒð3
Ü  G¨YÓ7ˆ	ðj €GØ€FØ€EØ€MØÐØ€LØ
ð �WœW×-Ñ-Õ.Ô.Ü×0Ñ0ˆFÙØ�!�ˆô �I‰I�N‰NØ× Ñ  9×#3Ñ#3×#AÑ#A×#HÑ#HÕHóð œ×5Ñ5Õ6¸×9IÑ9IÕIôJð
 ×"Ñ" 7Ô+ð  ×&Ñ&ˆØ'0×'FÑ'FÀwÓ'OÑ$ˆ�_Ø˜_Õ,ˆÜ—‘—‘ Ó%ˆð Øœ×7Ñ7Õ8¸9×;OÑ;OÕOôPð ×Ò 	¬)×*NÑ*NÕ OÕOÕØ˜Y×1Ñ1Ô1Ø !�Ø%&Ñ"à Õ"�Ø" aÕ'Ð"Ø˜C )×"6Ñ"6Õ6Ô6Ø)*Ð&Ø!.°!Ñ!3×!NÐ!NÐ7IÈQÑ7NÐß!Ø !�Ø%&Ð"Ø#(Ò ðØ&/×&CÑ&CÓ&E‘O�E˜8ð $,¬cØ×$Ñ$Øœi×9Ñ9Õ:Ø×*Ñ*õ+ó/ñ $Ò ð (×8Ñ8¸Ó>ˆOßˆðÜ05ØØ!ØØó	1Ñ-�G˜W gð. &ŸO™OØ×$Ñ$Ø×&Ñ&Ø×&Ñ&Ø×&Ñ&ó	�	ð &ŸO™OØ×$Ñ$ tÕ+¨W°g¸wó�	ð —G‘GÐ8Ô8Ø! IÔ-ÜŸ	™	Ÿ™ {Ó3Ø¤	× >Ñ >Õ?À3ÕFØ×&Ñ&õ'ô'ð  )×IÑIØ˜gó �Hô —y‘y—~‘~ hÓ/°#Ô5Ø Õ(˜ð"Ü8=Ø "Ø )Ø $Ø 'ó	9Ñ5˜G W¨gð. "×5Ñ5ØØØØó	�ðØ%×9Ñ9Ø!×(Ñ(¨4Õ/óàõ�EðØ&/×&6Ñ&6×&KÑ&KØ˜y×/Ñ/°$Õ6¸ÀØó'�Oð ×(Ñ(Ô*ð ×'Ñ'¨¨eÔ4ð ×#Ñ# y×';Ñ';Ô;Ø 	¬)×*BÑ*BÕ CÔCØ'(™à$¨Õ)˜Ø(×/Ñ/×8Ñ8¸×9IÑ9IÓJ˜ð"Ø'0×'7Ñ'7×'DÑ'DØ )× 0Ñ 0ó(˜Hô Ÿ9™9Ÿ>™>¨$Ó/°)Ü%×;Ñ;õ3äŸI™IŸN™N¨8Ó4õ35ô 5ð ,-˜LØ'¨1Ô,ð&Ø )× 0Ñ 0× =Ñ =Ô ?ð ,-˜Lð ×)Ñ)¨)×*:Ñ*:¸TÕ*AÔBðØ&/×&CÑ&CÓ&E‘O�E˜8ð
 $÷ ð Ø 	¬)×*=Ñ*=Õ >Ñ>÷ ð Ø ÜØ!×(Ñ(Ø!¤)×"=Ñ"=Õ>Ø#×.Ñ.õ/óñð !ð   9×#7Ñ#7Ñ7÷ -ð -Ø ¬9×+>Ñ+>Õ!?Ñ?÷-ð -à,Ô,ñ #ð &+Ð"Ø#(Ð ÷ Ø×#Ñ# w¬w¯~©~Õ'>Ô>Ø�Ü#×2Ñ2�ÙØ×(Ñ(¨Ô1Ø×&Ñ&Ô(çØŸH™HØ×$Ñ$ i×&8Ñ&8¸)×:LÑ:Ló�	ô Ø/°	×0DÑ0DÐ/EÐFØØ—J‘J˜y×/Ñ/Ó0Ø×&Ñ&ØØ—I‘IØôô ”÷ ÒðØ ×2Ñ2°5¸'ÓB�ðÜ,1°"°iÀÀwÓ,OÑ)�˜ 'ð$
Ø× Ñ ×5Ñ5ØØ×$Ñ$ tÕ+ØØØôð ×$Ñ$×&äØ
Ø×ÑØØØØóð øôq
 ô 	
äØØØÜ×%Ñ%ØØó
ò 	
ô ô 	
äØØØÜ×'Ñ'ØØó
ò 	
ô ô 	
äØØØÜ×'Ñ'ØØó
ò 	
ô ô 	
äØØØÜ×'Ñ'ØØó
ò 	
ô �9‰9× Ñ ô 	
äØØØÜ×#Ñ#ØØó
ò 	
ð	
ûôJ —y‘y×,Ñ,ô Ü'×4Ñ4�FÛðûô( %ô Ü'×6Ñ6�FØ"�GÛÜ&ô Ü'×8Ñ8�FØ"�GÛÜ&ô Ü'×8Ñ8�FØ"�GÛÜ#ô Ü'×8Ñ8�FÛðûôF  -ô "Ü%/×%>Ñ%>˜FØ&*˜GÛ!Ü.ô "Ü%/×%@Ñ%@˜FØ&*˜GÛ!Ü.ô "Ü%/×%@Ñ%@˜FØ&*˜GÛ!Ü+ô "Ü%/×%@Ñ%@˜FÛ!ð"ûô" —y‘y×,Ñ,ô Ü'×4Ñ4�FÛðûô —y‘y×,Ñ,ô Ü'×4Ñ4�FÛðûô&  "Ÿy™y×4Ñ4ô "Ü%/×%<Ñ%<˜FÛ!ð"ûô $&§9¡9×#8Ñ#8ô &Ü)3×)@Ñ)@ Û %ð&ûô —y‘y×,Ñ,ô Ü'×4Ñ4�FÛðûôh —9‘9×(Ñ(ô Ü#×0Ñ0�Ûðûô !ô Ü#×2Ñ2�Ø�ÛÜ"ô Ü#×4Ñ4�Ø�ÛÜ"ô Ü#×4Ñ4�Ø�ÛÜô Ü#×4Ñ4�Ûðûô —9‘9×(Ñ(ô Ü#×0Ñ0�Ûðúst  Ð8o  Ør+ Ú
s" Þ&u% ß)w( ß70x â2%y ä>z å={ ì={; í|2 í#0~5 ï )r(ï+r(ï4r(ðr(ðr(ð?r(ñr(ñ)r(òr(ò'r(ò+/sósó"u"ôu"ôu"ô#u"ô,u"õu"õu"õ!u"õ%w%öw%öw%ö&w%ö/w%÷w%÷w%÷$w%÷(/xøxø/yùyù/z
ú	z
ú/{û {û/{8û7{8û;/|/ü.|/ü2~2ý~2ý~2ý3~2ý<~2þ~2þ~2þ1~2þ5/)ÿ()c                ó€  € V fT   \        \        P                  ! V\        P                  ) 4      \        P                  ! V\        P                  4      4      # \	        V \         4      '       dh   V P
                  P                  V38w  g   V P                  P                  V38w  d   \        RV R24      h\        V P
                  V P                  4      # \        V R4      '       dO   \        P                  ! V 4      p V P                  V^38w  d   \        R4      h\        V R,          V R,          4      # \        R4      h)z
Uniformize the bounds.
zThe bounds must have z
 elements.r   zGThe shape of the bounds is not compatible with the number of variables.zPThe bounds must be an instance of scipy.optimize.Bounds or an array-like object.)ºNNNr   )r§   é   )r   rB   ÚfullÚinfr+   ÚlbÚshapeÚubr'   r-   ÚasarrayÚ	TypeError)r4   r2   s   &&r¤   r/   r/   q  sö   € ð ‚~Ü”b—g’g˜a¤"§&¡& Ó)¬2¯7ª7°1´b·f±fÓ+=Ó>Ð>Ü	�FœF×	#Ò	#Ø�9‰9�?‰?˜q˜dÔ" f§i¡i§o¡o¸!¸Ô&=ÜÐ4°Q°C°zÐBÓCÐCÜ�f—i‘i §¡Ó+Ð+Ü	�˜×	#Ò	#Ü—’˜FÓ#ˆØ�<‰<˜A˜q˜6Ô!Üð+óð ô �f˜T•l F¨4¥LÓ1Ð1äð=ó
ð 	
ó    c                ó¶  € \        V \        4      '       g   \        V R4      '       g   V 3p . p. pV  EF¡  p\        V\        4      '       di   \	        VP
                  R4      p\	        VP                  R4      pVP                  \        VP                  .\        P                  ! WE4      O5!  4       K‚  \        V\        4      '       dj   \	        VP
                  R4      p\	        VP                  R4      pVP                  \        VP                  .\        P                  ! WE4      O5!  4       EK  \        V\        4      '       dƒ   RV9  g   VR,          R9  d   \        R4      hRV9  g   \        VR,          4      '       g   \        R	4      hVP                  RVR,          RVR,          R
VP                  R
R4      /4       EK™  \!        R4      h	  W3# )z/
Extract the linear and nonlinear constraints.
r   z;The lower bound of the linear constraints must be a vector.z;The upper bound of the linear constraints must be a vector.z>The lower bound of the nonlinear constraints must be a vector.z>The upper bound of the nonlinear constraints must be a vector.r\   z+The constraint type must be "eq" or "ineq".rs   z)The constraint function must be callable.ru   zrThe constraints must be instances of scipy.optimize.LinearConstraint, scipy.optimize.NonlinearConstraint, or dict.)ÚeqÚineqr   )r+   r   r-   r   r   r«   r­   ÚappendÚArB   Úbroadcast_arraysr   rs   r'   Úcallabler   r¯   )rv   rƒ   r„   Ú
constraintr«   r­   s   &     r¤   r0   r0   Š  sÈ  € ô �+œt×$Ò$¬G°KÀ×,KÒ,KØ"�nˆð ÐØÐÜ!ˆ
Ü�jÔ"2×3Ò3ÜØ—‘ØMóˆBô  Ø—‘ØMóˆBð ×%Ñ%Ü Ø—L‘Lðä×(Ò(¨Ó0óöô ˜
Ô$7×8Ò8ÜØ—‘ðóˆBô  Ø—‘ðóˆBð "×(Ñ(Ü#Ø—N‘Nðä×(Ò(¨Ó0ó÷ô ˜
¤D×)Ò)Ø˜ZÔ'¨:°fÕ+=ð Fô ,ô !Ð!NÓOÐOØ˜JÔ&¬h°zÀ%Õ7H×.IÒ.IÜ Ð!LÓMÐMØ!×(Ñ(à˜: eÕ,Ø˜J vÕ.Ø˜JŸN™N¨6°2Ó6ð÷ô ð?óð ñg "ðp Ð4Ð4r°   c                ó¶  € \         P                  V 9   d(   V \         P                  ,          R8:  d   \        R4      h\         P                  V 9   d(   V \         P                  ,          R8  d   \        R4      h\         P                  V 9   dT   \         P                  V 9   d?   V \         P                  ,          V \         P                  ,          8  d   \        R4      hEMZ\         P                  V 9   dc   \        P
                  ! \        \         P                  ,          V \         P                  ,          .4      V \         P                  P                  &   Mã\         P                  V 9   dc   \        P                  ! \        \         P                  ,          V \         P                  ,          .4      V \         P                  P                  &   Ml\        \         P                  ,          V \         P                  P                  &   \        \         P                  ,          V \         P                  P                  &   \        V \         P                  ,          4      V \         P                  P                  &   \        V \         P                  ,          4      V \         P                  P                  &   \         P                  V 9   d(   V \         P                  ,          ^ 8:  d   \        R4      h\         P                  V 9   dd   V \         P                  ,          V^,           V^,           ,          ^,          8”  d,   \        RV^,           V^,           ,          ^,           R24      hV P                  \         P                  P                  \        \         P                  ,          ! V4      4       \        V \         P                  ,          4      V \         P                  P                  &   \         P                  V 9   d(   V \         P                  ,          ^ 8:  d   \        R4      hV P                  \         P                  P                  \        P                  ! \        \         P                  ,          ! V4      V \         P                  ,          ^,           .4      4       \        V \         P                  ,          4      V \         P                  P                  &   \         P                  V 9   d(   V \         P                  ,          ^ 8:  d   \        R	4      hV P                  \         P                  P                  \        \         P                  ,          ! V4      4       \        V \         P                  ,          4      V \         P                  P                  &   V P                  \         P                  P                  \        \         P                  ,          4       \        V \         P                  ,          4      V \         P                  P                  &   V P                  \         P                   P                  \        \         P                   ,          4       \        V \         P                   ,          4      V \         P                   P                  &   V P                  \         P"                  P                  \        \         P"                  ,          4       \%        V \         P"                  ,          4      V \         P"                  P                  &   V P                  \         P&                  P                  \        \         P&                  ,          4       \%        V \         P&                  ,          4      V \         P&                  P                  &   V P                  \         P(                  P                  \        \         P(                  ,          4       \        V \         P(                  ,          4      V \         P(                  P                  &   V P                  \         P*                  P                  \        \         P*                  ,          4       \%        V \         P*                  ,          4      V \         P*                  P                  &   V P                  \         P,                  P                  \        \         P,                  ,          4       \        V \         P,                  ,          4      V \         P,                  P                  &   V P                  \         P.                  P                  \        \         P.                  ,          4       \%        V \         P.                  ,          4      V \         P.                  P                  &   V  FH  pV\         P0                  P3                  4       9  g   K(  \4        P6                  ! R
V R2\8        ^4       KJ  	  R# )z
Set the default options.
r   z1The initial trust-region radius must be positive.z2The final trust-region radius must be nonnegative.z_The initial trust-region radius must be greater than or equal to the final trust-region radius.z4The number of interpolation points must be positive.z3The number of interpolation points must be at most r   z<The maximum number of function evaluations must be positive.z2The maximum number of iterations must be positive.zUnknown option: N)r   r:   r'   r;   rB   Úminr   ÚvaluerS   r#   ÚNPTÚ
setdefaultr(   r<   r=   ÚTARGETr"   r    r!   r$   r)   r%   r&   r*   Ú__members__ÚvaluesÚwarningsÚwarnÚRuntimeWarning)rx   r2   Úkeys   && r¤   r1   r1   Ï  sY  € ô ‡~�~˜Ô  W¬W¯^©^Õ%<ÀÔ%CÜÐLÓMÐMÜ‡~�~˜Ô  W¬W¯^©^Õ%<¸sÔ%BÜÐMÓNÐNÜ‡~�~˜Ô ¤W§^¡^°wÔ%>Ø”7—>‘>Õ" W¬W¯^©^Õ%<Ô<ÜðBóð ñ =ô
 
�‰˜7Ô	"Ü(*¯ªä¤§¡Õ/ØœŸ™Õ'ðó)
ˆ”—‘×$Ñ$Ò%ô 
�‰˜7Ô	"Ü(*¯ªä¤§¡Õ/ØœŸ™Õ'ðó)
ˆ”—‘×$Ñ$Ò%ô )8¼¿¹Õ(Gˆ”—‘×$Ñ$Ñ%Ü(7¼¿¹Õ(Gˆ”—‘×$Ñ$Ñ%Ü$)¨'´'·.±.Õ*AÓ$B€GŒG�N‰N× Ñ Ñ!Ü$)¨'´'·.±.Õ*AÓ$B€GŒG�N‰N× Ñ Ñ!Ü‡{�{�gÔ '¬'¯+©+Õ"6¸!Ô";Üð %ó &ð 	&ô 	�‰�wÔØ”G—K‘KÕ  Q¨¥U¨q°1­uÕ$5¸!Õ#;Ô;äØAØ�Q•˜1˜q�5Õ! aÕ'Ð(¨ð+ó
ð 	
ð ×Ñ”w—{‘{×(Ñ(¬/¼'¿+¹+Ö*FÀqÓ*IÔJÜ!$ W¬W¯[©[Õ%9Ó!:€GŒG�K‰K×ÑÑÜ×Ñ˜7Ô" w¬w×/?Ñ/?Õ'@ÀAÔ'EÜØJó
ð 	
ð ×ÑÜ×Ñ×ÑÜ
�Šä¤× 0Ñ 0Ö1°!Ó4ØœŸ™Õ$ qÕ(ðó	
ôô '*¨'´'×2BÑ2BÕ*CÓ&D€GŒG×Ñ×"Ñ"Ñ#Ü×Ñ˜7Ô" w¬w×/?Ñ/?Õ'@ÀAÔ'EÜÐMÓNÐNØ×ÑÜ×Ñ×ÑÜœ×(Ñ(Ö)¨!Ó,ôô '*¨'´'×2BÑ2BÕ*CÓ&D€GŒG×Ñ×"Ñ"Ñ#Ø×Ñ”w—~‘~×+Ñ+¬_¼W¿^¹^Õ-LÔMÜ$)¨'´'·.±.Õ*AÓ$B€GŒG�N‰N× Ñ Ñ!Ø×ÑÜ×Ñ×%Ñ%Üœ×/Ñ/Õ0ôô .3Ø”×'Ñ'Õ(ó.€GŒG×#Ñ#×)Ñ)Ñ*ð ×Ñ”w—‘×,Ñ,¬o¼g¿o¹oÕ.NÔOÜ%)¨'´'·/±/Õ*BÓ%C€GŒG�O‰O×!Ñ!Ñ"Ø×Ñ”w—}‘}×*Ñ*¬O¼G¿M¹MÕ,JÔKÜ#'¨´·±Õ(>Ó#?€GŒG�M‰M×ÑÑ Ø×ÑÜ×Ñ×!Ñ!Üœ×+Ñ+Õ,ôô *-¨W´W×5HÑ5HÕ-IÓ)J€GŒG×Ñ×%Ñ%Ñ&Ø×ÑÜ×Ñ×#Ñ#Üœ×-Ñ-Õ.ôô ,0°¼×8MÑ8MÕ0NÓ+O€GŒG×!Ñ!×'Ñ'Ñ(Ø×ÑÜ×Ñ×"Ñ"Üœ×,Ñ,Õ-ôô +.¨g´g×6JÑ6JÕ.KÓ*L€GŒG× Ñ ×&Ñ&Ñ'Ø×Ñ”w—}‘}×*Ñ*¬O¼G¿M¹MÕ,JÔKÜ#'¨´·±Õ(>Ó#?€GŒG�M‰M×ÑÑ ó ˆØ”g×)Ñ)×0Ñ0Ó2Ö2Ü�MŠMÐ,¨S¨E°Ð3´^ÀQÖGó r°   c                 óœ#  € \        V 4      pVP                  \        P                  P                  \
        \        P                  ,          4       \        V\        P                  ,          4      V\        P                  P                  &   V\        P                  ,          R8:  g   V\        P                  ,          R8¼  d   \        R4      hVP                  \        P                  P                  \
        \        P                  ,          4       \        V\        P                  ,          4      V\        P                  P                  &   V\        P                  ,          R8:  d   \        R4      h\        P                  V9   d(   V\        P                  ,          R8:  d   \        R4      h\        P                  V9   d(   V\        P                  ,          R8:  d   \        R4      h\        P                  V9   dT   \        P                  V9   d?   V\        P                  ,          V\        P                  ,          8¼  d   \        R4      hEMo\        P                  V9   dq   \        P                  ! \
        \        P                  ,          RRV\        P                  ,          ,           ,          .4      V\        P                  P                  &   Mê\        P                  V9   dj   \        P                  ! \
        \        P                  ,          R	V\        P                  ,          ,          .4      V\        P                  P                  &   Ml\
        \        P                  ,          V\        P                  P                  &   \
        \        P                  ,          V\        P                  P                  &   VP                  \        P                  P                  \
        \        P                  ,          4       \        V\        P                  ,          4      V\        P                  P                  &   V\        P                  ,          R8:  g   V\        P                  ,          R8¼  d   \        R
4      h\        P                  V9   d(   V\        P                  ,          R8:  d   \        R4      h\        P                   V9   d(   V\        P                   ,          R8:  d   \        R4      h\        P                  V9   dT   \        P                   V9   d?   V\        P                   ,          V\        P                  ,          8”  d   \        R4      hEMZ\        P                  V9   dc   \        P                  ! \
        \        P                   ,          V\        P                  ,          .4      V\        P                   P                  &   Mã\        P                   V9   dc   \        P                  ! \
        \        P                  ,          V\        P                   ,          .4      V\        P                  P                  &   Ml\
        \        P                  ,          V\        P                  P                  &   \
        \        P                   ,          V\        P                   P                  &   \        P"                  V9   dD   V\        P"                  ,          R8:  g   V\        P"                  ,          R8¼  d   \        R4      h\        P$                  V9   dD   V\        P$                  ,          R8:  g   V\        P$                  ,          R8¼  d   \        R4      h\        P"                  V9   dT   \        P$                  V9   d?   V\        P"                  ,          V\        P$                  ,          8”  d   \        R4      hEMZ\        P"                  V9   dc   \        P                  ! \
        \        P$                  ,          V\        P"                  ,          .4      V\        P$                  P                  &   Mã\        P$                  V9   dc   \        P                  ! \
        \        P"                  ,          V\        P$                  ,          .4      V\        P"                  P                  &   Ml\
        \        P"                  ,          V\        P"                  P                  &   \
        \        P$                  ,          V\        P$                  P                  &   VP                  \        P&                  P                  \
        \        P&                  ,          4       \        V\        P&                  ,          4      V\        P&                  P                  &   V\        P&                  ,          R8:  g   V\        P&                  ,          R8¼  d   \        R4      h\        P(                  V9   d(   V\        P(                  ,          R8  d   \        R4      h\        P*                  V9   d(   V\        P*                  ,          R8:  d   \        R4      h\        P(                  V9   dT   \        P*                  V9   d?   V\        P*                  ,          V\        P(                  ,          8  d   \        R4      hEMZ\        P(                  V9   dc   \        P                  ! \
        \        P*                  ,          V\        P(                  ,          .4      V\        P*                  P                  &   Mã\        P*                  V9   dc   \        P                  ! \
        \        P(                  ,          V\        P*                  ,          .4      V\        P(                  P                  &   Ml\
        \        P(                  ,          V\        P(                  P                  &   \
        \        P*                  ,          V\        P*                  P                  &   VP                  \        P,                  P                  \
        \        P,                  ,          4       \        V\        P,                  ,          4      V\        P,                  P                  &   V\        P,                  ,          R8:  g   V\        P,                  ,          R8¼  d   \        R4      hVP                  \        P.                  P                  \
        \        P.                  ,          4       \        V\        P.                  ,          4      V\        P.                  P                  &   V\        P.                  ,          R8:  g   V\        P.                  ,          R8¼  d   \        R4      hVP                  \        P0                  P                  \
        \        P0                  ,          4       \        V\        P0                  ,          4      V\        P0                  P                  &   V\        P0                  ,          R8:  g   V\        P0                  ,          R8¼  d   \        R4      hVP                  \        P2                  P                  \
        \        P2                  ,          4       \        V\        P2                  ,          4      V\        P2                  P                  &   V\        P2                  ,          R8:  d   \        R4      hVP                  \        P4                  P                  \
        \        P4                  ,          4       \        V\        P4                  ,          4      V\        P4                  P                  &   V\        P4                  ,          R8  d   \        R4      hVP                  \        P6                  P                  \
        \        P6                  ,          4       \        V\        P6                  ,          4      V\        P6                  P                  &   V\        P6                  ,          R8:  d   \        R4      hVP                  \        P8                  P                  \
        \        P8                  ,          4       \        V\        P8                  ,          4      V\        P8                  P                  &   V\        P8                  ,          R8:  d   \        R4      hVP                  \        P:                  P                  \
        \        P:                  ,          4       \=        V\        P:                  ,          4      V\        P:                  P                  &   V  FH  pV\        P>                  PA                  4       9  g   K(  \B        PD                  ! RV R2\F        ^4       KJ  	  V# )z
Set the default constants.
r   g      ð?zCThe constant decrease_radius_factor must be in the interval (0, 1).z>The constant increase_radius_threshold must be greater than 1.z;The constant increase_radius_factor must be greater than 1.z>The constant decrease_radius_threshold must be greater than 1.zPThe constant decrease_radius_threshold must be less than increase_radius_factor.g      à?r   zGThe constant decrease_resolution_factor must be in the interval (0, 1).z?The constant large_resolution_threshold must be greater than 1.zBThe constant moderate_resolution_threshold must be greater than 1.zVThe constant moderate_resolution_threshold must be at most large_resolution_threshold.z6The constant low_ratio must be in the interval (0, 1).z7The constant high_ratio must be in the interval (0, 1).z2The constant low_ratio must be at most high_ratio.z;The constant very_low_ratio must be in the interval (0, 1).zKThe constant penalty_increase_threshold must be greater than or equal to 1.z<The constant penalty_increase_factor must be greater than 1.zaThe constant penalty_increase_factor must be greater than or equal to penalty_increase_threshold.zAThe constant short_step_threshold must be in the interval (0, 1).z>The constant low_radius_factor must be in the interval (0, 1).zAThe constant byrd_omojokun_factor must be in the interval (0, 1).z@The constant threshold_ratio_constraints must be greater than 1.z4The constant large_shift_factor must be nonnegative.z:The constant large_gradient_factor must be greater than 1.z6The constant resolution_factor must be greater than 1.zUnknown constant: r   )$r   r½   r   ÚDECREASE_RADIUS_FACTORr»   r   r#   r'   ÚINCREASE_RADIUS_THRESHOLDÚINCREASE_RADIUS_FACTORÚDECREASE_RADIUS_THRESHOLDrB   rº   rS   rQ   ÚLARGE_RESOLUTION_THRESHOLDÚMODERATE_RESOLUTION_THRESHOLDri   Ú
HIGH_RATIOrc   ÚPENALTY_INCREASE_THRESHOLDÚPENALTY_INCREASE_FACTORrO   ÚLOW_RADIUS_FACTORr]   ÚTHRESHOLD_RATIO_CONSTRAINTSrK   rf   rT   ÚIMPROVE_TCGr!   r¿   rÀ   rÁ   rÂ   rÃ   )ry   rˆ   rÄ   s   ,  r¤   r3   r3   7  sf  € ô �V“€IØ×ÑÜ×(Ñ(×.Ñ.Üœ)×:Ñ:Õ;ôô 9>Ø”)×2Ñ2Õ3ó9€IŒi×.Ñ.×4Ñ4Ñ5ð 	”)×2Ñ2Õ3°sÔ:Ø”Y×5Ñ5Õ6¸#Ô=äðó
ð 	
ð ×ÑÜ×+Ñ+×1Ñ1Üœ)×=Ñ=Õ>ôô <AØ”)×5Ñ5Õ6ó<€IŒi×1Ñ1×7Ñ7Ñ8ð ”×4Ñ4Õ5¸Ô<ÜØLó
ð 	
ô 	×(Ñ(¨IÔ5Ø”i×6Ñ6Õ7¸3Ô>äØIó
ð 	
ô 	×+Ñ+¨yÔ8Ø”i×9Ñ9Õ:¸cÔAäØLó
ð 	
ô 	×(Ñ(¨IÔ5Ü×/Ñ/°9Ô<ð ”i×9Ñ9Õ:Øœ×9Ñ9Õ:ô;ô ð4óð ñ;ô 
×	)Ñ	)¨YÔ	6Ü?A¿vºvä!¤)×"EÑ"EÕFØ�s˜Y¤y×'GÑ'GÕHÕHÕIðó@
ˆ	”)×5Ñ5×;Ñ;Ò<ô 
×	,Ñ	,°	Ô	9Ü<>¿FºFä!¤)×"BÑ"BÕCØ�i¤	× CÑ CÕDÕDðó=
ˆ	”)×2Ñ2×8Ñ8Ò9ô =NÜ×,Ñ,õ=
ˆ	”)×2Ñ2×8Ñ8Ñ9ô œi×AÑAÕBð 	”)×5Ñ5×;Ñ;Ñ<à×ÑÜ×,Ñ,×2Ñ2Üœ)×>Ñ>Õ?ôô =BØ”)×6Ñ6Õ7ó=€IŒi×2Ñ2×8Ñ8Ñ9ð 	”)×6Ñ6Õ7¸3Ô>Ø”Y×9Ñ9Õ:¸cÔAäðó
ð 	
ô
 	×,Ñ,°	Ô9Ø”i×:Ñ:Õ;¸sÔBäØMó
ð 	
ô 	×/Ñ/°9Ô<Ø”i×=Ñ=Õ>À#ÔEäðó
ð 	
ô
 	×,Ñ,°	Ô9Ü×3Ñ3°yÔ@ð ”i×=Ñ=Õ>Øœ	×<Ñ<Õ=ô>ô ð>óð ñ>ô 
×	-Ñ	-°Ô	:ÜCEÇ6Â6ä!¤)×"IÑ"IÕJØœ)×>Ñ>Õ?ðóD
ˆ	”)×9Ñ9×?Ñ?Ò@ô 
×	0Ñ	0°IÔ	=Ü@BÇÂä!¤)×"FÑ"FÕGØœ)×AÑAÕBðóA
ˆ	”)×6Ñ6×<Ñ<Ò=ô œi×BÑBÕCð 	”)×6Ñ6×<Ñ<Ñ=ô œi×EÑEÕFð 	”)×9Ñ9×?Ñ?Ñ@ô ×Ñ˜iÔ'Ø”)×%Ñ%Õ&¨#Ô-Ø”Y×(Ñ(Õ)¨SÔ0äØDó
ð 	
ô ×Ñ˜yÔ(Ø”)×&Ñ&Õ'¨3Ô.Ø”Y×)Ñ)Õ*¨cÔ1äØEó
ð 	
ô ×Ñ˜iÔ'¬I×,@Ñ,@ÀIÔ,MØ”Y×(Ñ(Õ)¨I´i×6JÑ6JÕ,KÔKÜØDóð ñ Lô 
×	Ñ	 	Ô	)Ü02·²ä!¤)×"6Ñ"6Õ7Øœ)×-Ñ-Õ.ðó1
ˆ	”)×&Ñ&×,Ñ,Ò-ô 
×	Ñ	 Ô	*Ü/1¯vªvä!¤)×"5Ñ"5Õ6Øœ)×.Ñ.Õ/ðó0
ˆ	”)×%Ñ%×+Ñ+Ò,ô 0AÜ×Ñõ0
ˆ	”)×%Ñ%×+Ñ+Ñ,ô 1BÜ× Ñ õ1
ˆ	”)×&Ñ&×,Ñ,Ñ-ð ×ÑÜ× Ñ ×&Ñ&Üœ)×2Ñ2Õ3ôô 16Ø”)×*Ñ*Õ+ó1€IŒi×&Ñ&×,Ñ,Ñ-ð 	”)×*Ñ*Õ+¨sÔ2Ø”Y×-Ñ-Õ.°#Ô5äØIó
ð 	
ô 	×,Ñ,°	Ô9Ø”i×:Ñ:Õ;¸cÔAäð*ó
ð 	
ô
 	×)Ñ)¨YÔ6Ø”i×7Ñ7Õ8¸CÔ?äØJó
ð 	
ô 	×,Ñ,°	Ô9Ü×-Ñ-°Ô:ð ”i×7Ñ7Õ8Øœ	×<Ñ<Õ=ô>ô ð.óð ñ>ô 
×	-Ñ	-°Ô	:Ü=?¿VºVä!¤)×"CÑ"CÕDØœ)×>Ñ>Õ?ðó>
ˆ	”)×3Ñ3×9Ñ9Ò:ô 
×	*Ñ	*¨iÔ	7Ü@BÇÂä!¤)×"FÑ"FÕGØœ)×;Ñ;Õ<ðóA
ˆ	”)×6Ñ6×<Ñ<Ò=ô œi×BÑBÕCð 	”)×6Ñ6×<Ñ<Ñ=ô >OÜ×-Ñ-õ>
ˆ	”)×3Ñ3×9Ñ9Ñ:ð ×ÑÜ×&Ñ&×,Ñ,Üœ)×8Ñ8Õ9ôô 7<Ø”)×0Ñ0Õ1ó7€IŒi×,Ñ,×2Ñ2Ñ3ð 	”)×0Ñ0Õ1°SÔ8Ø”Y×3Ñ3Õ4¸Ô;äØOó
ð 	
ð ×ÑÜ×#Ñ#×)Ñ)Üœ)×5Ñ5Õ6ôô 49Ø”)×-Ñ-Õ.ó4€IŒi×)Ñ)×/Ñ/Ñ0ð 	”)×-Ñ-Õ.°#Ô5Ø”Y×0Ñ0Õ1°SÔ8äØLó
ð 	
ð ×ÑÜ×&Ñ&×,Ñ,Üœ)×8Ñ8Õ9ôô 7<Ø”)×0Ñ0Õ1ó7€IŒi×,Ñ,×2Ñ2Ñ3ð 	”)×0Ñ0Õ1°SÔ8Ø”Y×3Ñ3Õ4¸Ô;äØOó
ð 	
ð ×ÑÜ×-Ñ-×3Ñ3Üœ)×?Ñ?Õ@ôô >CØ”)×7Ñ7Õ8ó>€IŒi×3Ñ3×9Ñ9Ñ:ð ”×6Ñ6Õ7¸3Ô>ÜØNó
ð 	
ð ×ÑÜ×$Ñ$×*Ñ*Üœ)×6Ñ6Õ7ôô 5:Ø”)×.Ñ.Õ/ó5€IŒi×*Ñ*×0Ñ0Ñ1ð ”×-Ñ-Õ.°Ô4Üð (ó )ð 	)à×ÑÜ×'Ñ'×-Ñ-Üœ)×9Ñ9Õ:ôô 8=Ø”)×1Ñ1Õ2ó8€IŒi×-Ñ-×3Ñ3Ñ4ð ”×0Ñ0Õ1°SÔ8ÜØHó
ð 	
ð ×ÑÜ×#Ñ#×)Ñ)Üœ)×5Ñ5Õ6ôô 49Ø”)×-Ñ-Õ.ó4€IŒi×)Ñ)×/Ñ/Ñ0ð ”×,Ñ,Õ-°Ô4ÜØDó
ð 	
ð ×ÑÜ×Ñ×#Ñ#Üœ)×/Ñ/Õ0ôô .2Ø”)×'Ñ'Õ(ó.€IŒi×#Ñ#×)Ñ)Ñ*ó
 ˆØ”i×+Ñ+×2Ñ2Ó4Ö4Ü�MŠMÐ.¨s¨e°1Ð5´~ÀqÖIñ ð Ðr°   c                ó´  € V P                   V\        P                  ,          8¼  d   \        hVP                  V,           pV ! WAP
                  4      w  rVpV P                  WFV4      pWS\        P                  ,          8:  d"   Wƒ\        P                  ,          8:  d   \        hV P                  '       d"   Wƒ\        P                  ,          8:  d   \        hWVV3# )z2
Evaluate the objective and constraint functions.
)rp   r   r<   r   rG   rr   rm   r¾   r"   r   Úis_feasibilityr   )	r‡   r‰   r”   rx   Úx_evalr™   rš   r›   Úr_vals	   &&&&     r¤   rV   rV   Ž  s©   € ð 
‡y�y�GœG×,Ñ,Õ-Ô-ÜÐØ×Ñ Õ$€FÙ " 6×+<Ñ+<Ó =Ñ€G�gØ�H‰H�V gÓ.€Eàœ7Ÿ>™>Õ*Ô*ØœW×4Ñ4Õ5Ô5äÐØ	××Ð˜U¬g×.EÑ.EÕ&FÔFÜÐØ˜WÐ$Ð$r°   c                óŽ  € V P                  V4      w  rgpT;'       d5    \        P                  ! V4      ;'       d    \        P                  ! V4      pV\        P                  \        P
                  39  d$   T;'       d    W…\        P                  ,          8*  p\        4       p	\        P                  R\        P                  R\        P                  R\        P                  R\        P
                  R\        P                  R\        P                  R\        P                  R\        P                  R	/	P!                  VR
4      V	n        W)n        VP&                  V	n        V P+                  V4      V	n        Wyn        W‰n        V P2                  V	n        WIn        V\        P8                  ,          '       d#   V P:                  V	n        V P<                  V	n        V\        P>                  ,          '       dN   \A        V	P"                  V V	P,                  V	P.                  V	P0                  V	P4                  V	P6                  4       V	# )z/
Build the result of the optimization process.
z<The lower bound for the trust-region radius has been reachedz4The target objective function value has been reachedz0All variables are fixed by the bound constraintsz9The callback requested to stop the optimization procedurez=The feasibility problem received has been solved successfullyz<The maximum number of function evaluations has been exceededz2The maximum number of iterations has been exceededz$The bound constraints are infeasiblezA linear algebra error occurredzUnknown exit status)!Ú	best_evalrB   Úisfiniter   r>   r@   r   r"   r   rj   r8   r?   rW   rA   r7   rE   r   ÚmessagerŠ   r»   r�   ro   Úxrs   rm   rp   ÚnfevÚnitr%   Úfun_historyÚmaxcv_historyr    rn   )
r‡   rr   rŠ   r�   r‹   rx   rÚ   rs   rm   Úresults
   &&&&&&    r¤   r6   r6   ¡  sÃ  € ð
 —L‘L Ó)�M€AˆEØ×AÐAœ"Ÿ+š+ cÓ*×AÐA¬r¯{ª{¸5Ó/A€GØ”j×/Ñ/´×1LÑ1LÐMÔMØ×GÐG˜e¬w×/FÑ/FÕ'GÑGˆÜÓ€Fä×!Ñ!ð $=ä×!Ñ!ð $2ä× Ñ ð #0ä×#Ñ#ð &>ä×#Ñ#ð &@ä×#Ñ#ð &Eä×#Ñ#ð &5ä×#Ñ#Ð%KÜ×ÑÐ!Bð!÷" 
�cˆ&Ð'Ó(ð# „Nð$ „NØ—L‘L€F„MØ�z‰z˜!‹}€F„HØ„JØ„LØ—)‘)€F„KØ„JØŒw×$Ñ$×%Ô%ØŸ^™^ˆÔØ!×/Ñ/ˆÔð Œw�‰×ÔÜØ�N‰NØØ�H‰HØ�J‰JØ�L‰LØ�K‰KØ�J‰Jô	
ð €Mr°   c                óˆ  € \        4        \        V  R24       \        RV R24       \        RV R24       VP                  '       g   \        RVP                   RV R24       \        RV R24       \        P                  ! R	/ \
        B ;_uu_ 4        \        RV R24       RRR4       R#   + '       g   i     R# ; i)
zH
Print information about the current state of the optimization process.
r   z Number of function evaluations: zNumber of iterations: zLeast value of z: zMaximum constraint violation: zCorresponding point: Nr   )r9   rÓ   Úfun_namerB   Úprintoptionsr   )rÙ   r‡   rÚ   r™   rÕ   rp   r‹   s   &&&&&&&r¤   rn   rn   Ö  s§   € ô 
„GÜ	ˆWˆI�Qˆ-ÔÜ	Ð,¨V¨H°AÐ
6Ô7Ü	Ð" 6 (¨!Ð
,Ô-Ø××ÐÜ� §¡˜}¨B¨w¨i°qÐ9Ô:Ü	Ð*¨5¨'°Ð
3Ô4Ü	�ŠÑ	)œ=×	)Ó	)ÜÐ% a S¨Ð*Ô+÷ 
*×	)×	)Ò	)ús   ÂB0Â0C	)r   Nr   NN)%rÁ   ÚnumpyrB   Úscipy.optimizer   r   r   r   r‰   r   Úproblemr   r	   r
   r   r   Úutilsr   r   r   r   r   Úsettingsr   r   r   r   r   r   r¥   r/   r0   r1   r3   rV   r6   rn   r   r°   r¤   Ú<module>rè      sj   ðÛ ã ÷ó õ #÷õ ÷õ ÷÷ ôJòZ
ò2B5òJeHòPTòn
%ò&2ôj,r°   