403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/scipy/optimize/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/scipy/optimize/__pycache__/_slsqp_py.cpython-311.pyc
�

d�cOI�� �dZddgZddlZddlmZddlmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZddlmZmZmZmZmZdd	lmZdd
lmZmZdZe
ee��j��Zd�Z d
dd
dd
dddd
dddddedfd�Z!d
ddd
ddddeddfd�Z"d�Z#d�Z$dS)a

This module implements the Sequential Least Squares Programming optimization
algorithm (SLSQP), originally developed by Dieter Kraft.
See http://www.netlib.org/toms/733

Functions
---------
.. autosummary::
   :toctree: generated/

    approx_jacobian
    fmin_slsqp

�approx_jacobian�
fmin_slsqp�N)�slsqp)�zeros�array�linalg�append�asfarray�concatenate�finfo�sqrt�vstack�isfinite�
atleast_1d�)�OptimizeResult�_check_unknown_options�_prepare_scalar_function�_clip_x_for_func�
_check_clip_x)�approx_derivative)�old_bound_to_new�_arr_to_scalarzrestructuredtext enc�R�t||d||���}tj|��S)a�
    Approximate the Jacobian matrix of a callable function.

    Parameters
    ----------
    x : array_like
        The state vector at which to compute the Jacobian matrix.
    func : callable f(x,*args)
        The vector-valued function.
    epsilon : float
        The perturbation used to determine the partial derivatives.
    args : sequence
        Additional arguments passed to func.

    Returns
    -------
    An array of dimensions ``(lenf, lenx)`` where ``lenf`` is the length
    of the outputs of `func`, and ``lenx`` is the number of elements in
    `x`.

    Notes
    -----
    The approximation is done using forward differences.

    �2-point)�method�abs_step�args)r�np�
atleast_2d)�x�func�epsilonr�jacs     �:/usr/lib/python3/dist-packages/scipy/optimize/_slsqp_py.pyrr"s5��6�D�!�I��!%�'�'�'�C��=�������dg���ư>c�Z�
�|�|}
|||
|
dk||d�}d}|t�
fd�|D����z
}|t�
fd�|D����z
}|r|d||�
d�fz
}|r|d	||	�
d�fz
}t||�
f|||d
�|��}|r%|d|d|d
|d|dfS|dS)a/
    Minimize a function using Sequential Least Squares Programming

    Python interface function for the SLSQP Optimization subroutine
    originally implemented by Dieter Kraft.

    Parameters
    ----------
    func : callable f(x,*args)
        Objective function.  Must return a scalar.
    x0 : 1-D ndarray of float
        Initial guess for the independent variable(s).
    eqcons : list, optional
        A list of functions of length n such that
        eqcons[j](x,*args) == 0.0 in a successfully optimized
        problem.
    f_eqcons : callable f(x,*args), optional
        Returns a 1-D array in which each element must equal 0.0 in a
        successfully optimized problem. If f_eqcons is specified,
        eqcons is ignored.
    ieqcons : list, optional
        A list of functions of length n such that
        ieqcons[j](x,*args) >= 0.0 in a successfully optimized
        problem.
    f_ieqcons : callable f(x,*args), optional
        Returns a 1-D ndarray in which each element must be greater or
        equal to 0.0 in a successfully optimized problem. If
        f_ieqcons is specified, ieqcons is ignored.
    bounds : list, optional
        A list of tuples specifying the lower and upper bound
        for each independent variable [(xl0, xu0),(xl1, xu1),...]
        Infinite values will be interpreted as large floating values.
    fprime : callable `f(x,*args)`, optional
        A function that evaluates the partial derivatives of func.
    fprime_eqcons : callable `f(x,*args)`, optional
        A function of the form `f(x, *args)` that returns the m by n
        array of equality constraint normals. If not provided,
        the normals will be approximated. The array returned by
        fprime_eqcons should be sized as ( len(eqcons), len(x0) ).
    fprime_ieqcons : callable `f(x,*args)`, optional
        A function of the form `f(x, *args)` that returns the m by n
        array of inequality constraint normals. If not provided,
        the normals will be approximated. The array returned by
        fprime_ieqcons should be sized as ( len(ieqcons), len(x0) ).
    args : sequence, optional
        Additional arguments passed to func and fprime.
    iter : int, optional
        The maximum number of iterations.
    acc : float, optional
        Requested accuracy.
    iprint : int, optional
        The verbosity of fmin_slsqp :

        * iprint <= 0 : Silent operation
        * iprint == 1 : Print summary upon completion (default)
        * iprint >= 2 : Print status of each iterate and summary
    disp : int, optional
        Overrides the iprint interface (preferred).
    full_output : bool, optional
        If False, return only the minimizer of func (default).
        Otherwise, output final objective function and summary
        information.
    epsilon : float, optional
        The step size for finite-difference derivative estimates.
    callback : callable, optional
        Called after each iteration, as ``callback(x)``, where ``x`` is the
        current parameter vector.

    Returns
    -------
    out : ndarray of float
        The final minimizer of func.
    fx : ndarray of float, if full_output is true
        The final value of the objective function.
    its : int, if full_output is true
        The number of iterations.
    imode : int, if full_output is true
        The exit mode from the optimizer (see below).
    smode : string, if full_output is true
        Message describing the exit mode from the optimizer.

    See also
    --------
    minimize: Interface to minimization algorithms for multivariate
        functions. See the 'SLSQP' `method` in particular.

    Notes
    -----
    Exit modes are defined as follows ::

        -1 : Gradient evaluation required (g & a)
         0 : Optimization terminated successfully
         1 : Function evaluation required (f & c)
         2 : More equality constraints than independent variables
         3 : More than 3*n iterations in LSQ subproblem
         4 : Inequality constraints incompatible
         5 : Singular matrix E in LSQ subproblem
         6 : Singular matrix C in LSQ subproblem
         7 : Rank-deficient equality constraint subproblem HFTI
         8 : Positive directional derivative for linesearch
         9 : Iteration limit reached

    Examples
    --------
    Examples are given :ref:`in the tutorial <tutorial-sqlsp>`.

    Nr)�maxiter�ftol�iprint�disp�eps�callbackr'c3�$�K�|]
}d|�d�V��dS)�eq��type�funrNr'��.0�crs  �r%�	<genexpr>zfmin_slsqp.<locals>.<genexpr>�s-�����I�I�Q�4��4�8�8�I�I�I�I�I�Ir&c3�$�K�|]
}d|�d�V��dS)�ineqr2Nr'r5s  �r%r8zfmin_slsqp.<locals>.<genexpr>�s-�����L�L�q�6�!�T�:�:�L�L�L�L�L�Lr&r1)r3r4r$rr:)r$�bounds�constraintsr!r4�nit�status�message)�tuple�_minimize_slsqp)r"�x0�eqcons�f_eqcons�ieqcons�	f_ieqconsr;�fprime�
fprime_eqcons�fprime_ieqconsr�iter�accr,r-�full_outputr#r/�opts�cons�ress          `          r%rrDsF���`��������a�K�� �"�"�D��D�	�E�I�I�I�I�&�I�I�I�I�I�I�D��E�L�L�L�L�G�L�L�L�L�L�L�D��#��$�x�
�� � �#�	#���#��&��>�� � �#�	#���$��D�4�f�V�&*�4�4�.2�4�4�C����3�x��U��S��Z��X���I��N�N��3�x�r&Fc

�F���C�D�E�t|
��|dz
}|}|
�C|	sd}t|������E|�t|��dkrtjtjf�Dnt
|���Dt	j�E�Dd�Dd���Et|t��r|f}ddd�}t|��D�]\}}	|d���}|dvrtd|dz���n_#t$r}td|z��|�d}~wt$r}td	��|�d}~wt$r}td
��|�d}~wwxYwd|vrtd|z���|�d
��}|��C���Dfd�}||d��}||xx|d||�dd��d�fz
cc<��dddddddddddd�}t#t%t�Efd�|dD������}t#t%t�Efd�|d D������}||z}t'd|g�����}t�E��}|dz}||z
|z|z}d!|z|z|dzz||z
dz|d"zzzd"|zz||z||z
zzd"|zz|z|dz|zd"zzd"|zzd!|zzd!|zzdz}|} t+|��}!t+| ��}"|�t|��dkrvt	j|t.�#��}#t	j|t.�#��}$|#�tj��|$�tj���n#t'd$�|D��t.��}%|%jd|krt7d%���t	jd&�'��5|%dd�df|%dd�dfk}&ddd��n#1swxYwY|&���r/td(d)�d*�|&D����z���|%dd�df|%dd�df}$}#t?|%��}'tj|#|'dd�df<tj|$|'dd�df<tA|�E�||
��D�+��}(tC|(j"�D��})tC|(j#�D��}*t'dtH��}+t'|t.��}t'|tH��},d}-t'dt.��}.t'dt.��}/t'dt.��}0t'dt.��}1t'dt.��}2t'dt.��}3t'dt.��}4t'dt.��}5t'dt.��}6t'dt.��}7t'dtH��}8t'dtH��}9t'dtH��}:t'dtH��};t'dtH��}<t'dtH��}t'dtH��}=t'dtH��}>|d"krtKd,d-z��|)�E��}?tM|*�E��d.��}@tO�E|��}AtQ�E||||||��}B	tSg|�|��E�|#�|$�|?�|A�|@�|B�|�|,�|+�|!�|"�|.�|/�|0�|1�|2�|3�|4�|5�|6�|7�|8�|9�|:�|;�|<�|�|=�|>�R�|+dkr|)�E��}?tO�E|��}A|+d/kr.tM|*�E��d.��}@tQ�E||||||��}B|,|-krR|�|t	j*�E����|d"kr-tKd0|,|(j+|?tYj-|@��fz��t]|+��dkrntI|,��}-��|dkr�tK|tI|+��d1zt_|+��zd2z��tKd3|?��tKd4|,��tKd5|(j+��tKd6|(j0��tc�E|?|@dd/�tI|,��|(j+|(j0tI|+��|tI|+��|+dk�7�	�	S)8a�
    Minimize a scalar function of one or more variables using Sequential
    Least Squares Programming (SLSQP).

    Options
    -------
    ftol : float
        Precision goal for the value of f in the stopping criterion.
    eps : float
        Step size used for numerical approximation of the Jacobian.
    disp : bool
        Set to True to print convergence messages. If False,
        `verbosity` is ignored and set to 0.
    maxiter : int
        Maximum number of iterations.
    finite_diff_rel_step : None or array_like, optional
        If `jac in ['2-point', '3-point', 'cs']` the relative step size to
        use for numerical approximation of `jac`. The absolute step
        size is computed as ``h = rel_step * sign(x) * max(1, abs(x))``,
        possibly adjusted to fit into the bounds. For ``method='3-point'``
        the sign of `h` is ignored. If None (default) then step is selected
        automatically.
    rrNr')r1r:r3zUnknown constraint type '%s'.z"Constraint %d has no type defined.z/Constraints must be defined using a dictionary.z#Constraint's type must be a string.r4z&Constraint %d has no function defined.r$c���������fd�}|S)Nc���t|���}�dvrt�|�|�����St�|d�|����S)N)rz3-point�cs)rr�rel_stepr;r)rrrr;)rr)r!rr#�finite_diff_rel_stepr4r$�
new_boundss  �����r%�cjacz3_minimize_slsqp.<locals>.cjac_factory.<locals>.cjac%sr���%�a��4�4�A��:�:�:�0��a��$�:N�8B� D� D� D�D� 1��a�	�:A��8B� D� D� D�Dr&r')r4rWr#rUr$rVs` ����r%�cjac_factoryz%_minimize_slsqp.<locals>.cjac_factory$sA����
D�
D�
D�
D�
D�
D�
D�
D�
D��r&r)r4r$rz$Gradient evaluation required (g & a)z$Optimization terminated successfullyz$Function evaluation required (f & c)z4More equality constraints than independent variablesz*More than 3*n iterations in LSQ subproblemz#Inequality constraints incompatiblez#Singular matrix E in LSQ subproblemz#Singular matrix C in LSQ subproblemz2Rank-deficient equality constraint subproblem HFTIz.Positive directional derivative for linesearchzIteration limit reached)���rr��������	c	�T��g|]$}t|d�g|d�R�����%S�r4r�r�r6r7r!s  �r%�
<listcomp>z#_minimize_slsqp.<locals>.<listcomp>GsK���#�#�#��#�8�1�U�8�A�#:��&�	�#:�#:�#:�;�;�#�#�#r&r1c	�T��g|]$}t|d�g|d�R�����%Srcrdres  �r%rfz#_minimize_slsqp.<locals>.<listcomp>IsK���&�&�&��$�H�A�e�H�Q�$;��6��$;�$;�$;�<�<�&�&�&r&r:r[rZ)�dtypec�P�g|]#\}}t|��t|��f��$Sr')r)r6�l�us   r%rfz#_minimize_slsqp.<locals>.<listcomp>bsA��,�,�,� �1�a�&�a�(�(�.��*;�*;�<�,�,�,r&zDSLSQP Error: the length of bounds is not compatible with that of x0.�ignore)�invalidz"SLSQP Error: lb > ub in bounds %s.z, c3�4K�|]}t|��V��dS)N)�str)r6�bs  r%r8z"_minimize_slsqp.<locals>.<genexpr>ms(����&>�&>�!�s�1�v�v�&>�&>�&>�&>�&>�&>r&)r$rr#rUr;z%5s %5s %16s %16s)�NIT�FC�OBJFUN�GNORMgrYz%5i %5i % 16.6E % 16.6Ez    (Exit mode �)z#            Current function value:z            Iterations:z!            Function evaluations:z!            Gradient evaluations:)	r!r4r$r=�nfev�njevr>r?�success)2rr
�flatten�lenr�infr�clip�
isinstance�dict�	enumerate�lower�
ValueError�KeyError�	TypeError�AttributeError�get�sum�mapr�maxr�empty�float�fill�nan�shape�
IndexError�errstate�any�joinrrrr4�grad�int�printr	�_eval_constraint�_eval_con_normalsr�copyrvr�norm�absro�ngevr)Fr"rBrr$r;r<r*r+r,r-r.r/rU�unknown_optionsrJrKrN�ic�con�ctype�erWrX�
exit_modes�meq�mieq�m�la�n�n1�mineq�len_w�len_jw�w�jw�xl�xu�bnds�bnderr�infbnd�sf�wrapped_fun�wrapped_grad�mode�majiter�majiter_prev�alpha�f0�gs�h1�h2�h3�h4�t�t0�tol�iexact�incons�ireset�itermx�line�n2�n3�fx�gr7�ar#rVr!sF   `        `                                                      @@@r%rArA�s�
�������8�?�+�+�+��Q�;�D�
�C��G�����	��������A��~��V����)�)��v�g�r�v�&�
�
�%�f�-�-�
�	���:�a�=�*�Q�-�0�0�A��+�t�$�$�&�"�o���b�!�!�D��[�)�)�+9�+9���C�	P���K�%�%�'�'�E��N�*�*� �!@�3�v�;�!N�O�O�O�+���	M�	M�	M��?�"�D�E�E�1�L������	2�	2�	2��*�+�+�01�
2������	J�	J�	J��A�B�B��I�����	J���������E��J�K�K�K��w�w�u�~�~���<�

�

�

�

�

�

�

�

� �<��E�
�+�+�D�	
�U�����E�
� $�!$�����!4�!4�6�6�9�	9�����=�<�<�L�B�;�;�;�J�F�/�
1�
1�J��c�#�#�#�#�#��D�z�#�#�#�$�$�%�%�C��s�3�&�&�&�&��V��&�&�&�'�'�(�(�D�	�d�
�A�	��1�v���	�	�	�	�B��A���A�
�Q��B�
��G�b�L�2��E�
�r�T�!�V�b��d�O�R��V�A�X��a��0�0�1�U�7�:�B�u�H�r�#�v�;N�N���e�
��
��q�S�!�G�a�<�
(�*+�A�#�
.�01�!��
4�67��d�
;�=>�
?�E�
�F�
�e���A�	�v���B��~��V����)�)�
�X�a�u�
%�
%�
%��
�X�a�u�
%�
%�
%��
��������
����������,�,�$*�,�,�,�-2�4�4���:�a�=�A����;�<�<�
<��[��
*�
*�
*�	-�	-��!�!�!�Q�$�Z�$�q�q�q�!�t�*�,�F�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-��:�:�<�<�	@��A�!�Y�Y�&>�&>�v�&>�&>�&>�>�>�?�@�@�
@��a�a�a��d��T�!�!�!�Q�$�Z�B���4�.�.����6��6�!�!�!�Q�$�<���6��6�!�!�!�Q�$�<��
"�$��s��s�7K�)3�
5�
5�
5�B�
#�2�6�:�6�6�K�#�B�G�Z�8�8�L���C�=�=�D�
��U�
�
�C��D�#���G��L�
�!�U�O�O�E�	�q�%���B�	�q�%���B�	�q�%���B�	�q�%���B�	�q�%���B�	�q�%���B�
�a����A�	�q�%���B�
��5�/�/�C�
�1�c�]�]�F�
�1�c�]�]�F�
�1�c�]�]�F�
�1�c�]�]�F���C�=�=�D�	�q�#���B�	�q�#���B�	�q�#���B���{�{�
�!�$D�D�E�E�E�

��Q���B��|�|�A����$�$�A���D�!�!�A��!�T�2�q�!�S�$�7�7�A�$�
�	�a�	��	�a�	��	�R�	��	�Q�	��	�1�	�c�	�7�	�D�	�!�	�R�	��	��	��	��	�!#�	�%'�	�)+�	�-.�	�02�	�47�	��	��	�$�	�&,�	�.2�	��	��	��	�	�	�	�
�1�9�9���Q���B� ��D�)�)�A��2�:�:��|�|�A����,�,�A�!�!�T�2�q�!�S�$�?�?�A��\�!�!��#��������$�$�$���{�{��/�7�B�G�35�v�{�1�~�~�3G�G�H�H�H��t�9�9��>�>���7�|�|��;$�@��{�{�
�j��T���#�&7�7�#�d�)�)�C�c�I�J�J�J�
�3�R�8�8�8�
�'��1�1�1�
�1�2�7�;�;�;�
�1�2�7�;�;�;��A�2�1�S�b�S�6�s�7�|�|�!�w�R�W�S��Y�Y�",�S��Y�Y�"7�$�!�)�N�N�N�NsB�D
�
E)�D*�*
E)�7E�
E)�E$�$E)�8P�P#�&P#c���|dr"t�fd�|dD����}ntd��}|dr"t�fd�|dD����}ntd��}t||f��}|S)Nr1c	�T��g|]$}t|d�g|d�R�����%Srcrd�r6r�r!s  �r%rfz$_eval_constraint.<locals>.<listcomp>�sK���3�3�3� #�'�z�s�5�z�!�'B�c�&�k�'B�'B�'B�C�C�3�3�3r&rr:c	�T��g|]$}t|d�g|d�R�����%Srcrdr�s  �r%rfz$_eval_constraint.<locals>.<listcomp>�sK���6�6�6�!$�(�
��E�
�1�(C�s�6�{�(C�(C�(C�D�D�6�6�6r&)rr)r!rN�c_eq�c_ieqr7s`    r%r�r��s�����D�z���3�3�3�3�'+�D�z�3�3�3�4�4����Q�x�x���F�|���6�6�6�6�(,�V��6�6�6�7�7����a����	�T�5�M�"�"�A��Hr&c���|dr"t�fd�|dD����}nt||f��}|dr"t�fd�|dD����}nt||f��}|dkrt||f��}	nt||f��}	t|	t|dg��fd��}	|	S)Nr1c�:��g|]}|d�g|d�R���S�r$rr'r�s  �r%rfz%_eval_con_normals.<locals>.<listcomp>�sC���.�.�.��"�s�5�z�!�2�c�&�k�2�2�2�.�.�.r&r:c�:��g|]}|d�g|d�R���Sr�r'r�s  �r%rfz%_eval_con_normals.<locals>.<listcomp>�sC���1�1�1��#��E�
�1�3�s�6�{�3�3�3�1�1�1r&rr)rrr)
r!rNr�r�r�r�r��a_eq�a_ieqr�s
`         r%r�r��s����D�z���.�.�.�.�"&�t�*�.�.�.�/�/����c�1�X�����F�|�!��1�1�1�1�#'��<�1�1�1�2�2����t�Q�i� � ��	�A�v�v��2�q�'�N�N����D�%�=�!�!���Q��r�1�g���'��+�+�A��Hr&)%�__doc__�__all__�numpyr�scipy.optimize._slsqprrrrr	r
rrr
rrr�	_optimizerrrrr�_numdiffr�_constraintsrr�
__docformat__r�r.�_epsilonrrrAr�r�r'r&r%�<module>r�s���
�
��l�
+������'�'�'�'�'�'�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�'�'�'�'�'�'�'�'�'�'�'�'�'�'�(�'�'�'�'�'�:�:�:�:�:�:�:�:�&�
��4���e��� �!�!�����D!#�T�2����T�"��#�6��d��8��	O�O�O�O�d$&�4�� "��f�Q�U� �4�d�wN�wN�wN�wN�t
�
�
�&
�
�
�
�
r&

Youez - 2016 - github.com/yon3zu
LinuXploit