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__/_linprog_highs.cpython-311.pyc
�

d�c8D���dZddlZddlZddlmZmZmZddlm	Z	ddl
mZddlm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(ddl)m*Z*m+Z+m,Z,d	�Z-d
�Z.d�Z/								dd�Z0dS)a^HiGHS Linear Optimization Methods

Interface to HiGHS linear optimization software.
https://highs.dev/

.. versionadded:: 1.5.0

References
----------
.. [1] Q. Huangfu and J.A.J. Hall. "Parallelizing the dual revised simplex
           method." Mathematical Programming Computation, 10 (1), 119-142,
           2018. DOI: 10.1007/s12532-017-0130-5

�N�)�_check_unknown_options�OptimizeWarning�OptimizeResult)�warn)�_highs_wrapper)�CONST_I_INF�	CONST_INF�MESSAGE_LEVEL_NONE�HIGHS_OBJECTIVE_SENSE_MINIMIZE�MODEL_STATUS_NOTSET�MODEL_STATUS_LOAD_ERROR�MODEL_STATUS_MODEL_ERROR�MODEL_STATUS_PRESOLVE_ERROR�MODEL_STATUS_SOLVE_ERROR�MODEL_STATUS_POSTSOLVE_ERROR�MODEL_STATUS_MODEL_EMPTY�MODEL_STATUS_OPTIMAL�MODEL_STATUS_INFEASIBLE�$MODEL_STATUS_UNBOUNDED_OR_INFEASIBLE�MODEL_STATUS_UNBOUNDED�5MODEL_STATUS_REACHED_DUAL_OBJECTIVE_VALUE_UPPER_BOUND�%MODEL_STATUS_REACHED_OBJECTIVE_TARGET�MODEL_STATUS_REACHED_TIME_LIMIT�$MODEL_STATUS_REACHED_ITERATION_LIMIT�HIGHS_SIMPLEX_STRATEGY_CHOOSE�HIGHS_SIMPLEX_STRATEGY_DUAL� HIGHS_SIMPLEX_CRASH_STRATEGY_OFF�)HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_CHOOSE�*HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_DANTZIG�(HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_DEVEX�0HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE�HIGHS_VAR_TYPE_CONTINUOUS)�
csc_matrix�vstack�issparsec�P�idd�td�td�td�td�td�t
d�td�td�td�td�td�td�td�td	�td
�}d}|�||��\}}|�d|�d
|�d�}||fS)zCConverts HiGHS status number/message to SciPy status number/messageN)�z%HiGHS did not provide a status code. )r(�)�r))rz&Optimization terminated successfully. )rzTime limit reached. )rzIteration limit reached. )r*zThe problem is infeasible. )�zThe problem is unbounded. )r(z(The problem is unbounded or infeasible. )r(z*The HiGHS status code was not recognized. z(HiGHS Status z: �))r
rrrrrr�MODEL_STATUS_RDOVUBrrrrrrr�get)�highs_status�
highs_message�scipy_statuses_messages�unrecognized�scipy_status�
scipy_messages      �?/usr/lib/python3/dist-packages/scipy/optimize/_linprog_highs.py�_highs_to_scipy_status_messager6;sE��C��:�C��W�C�	 ��C�	!�'�	C�
	$�W�C�	!�'�
C�	%�g�C�	!�'�C�	�W�C�	.�w�C�	�K�C�	(�)D�C�	-�.N�C�	 �!C�C�	� A�C� 	-�/B�!C��$E�L��#�#�L�,�?�?� �L�-�%�G�G�&2�G�G�6C�G�G�G�M���&�&�c�x�tj|��}tj||��tz||<|S)N)�np�isinf�signr
)�x�infss  r5�_replace_infr>Xs0��
�8�A�;�;�D��g�a��g���y�(�A�d�G��Hr7c�j�	||���S#t$r||cYSt$rytjt
��}|j|j}td|�d|�dt|�
�����d|�d�	td���||cYSwxYw)NzOption z is z, but only values in z are allowed. Using default: �.r+)�
stacklevel)�lower�AttributeError�KeyError�inspect�	signature�_linprog_highs�
parameters�defaultr�set�keysr)�option�
option_str�choices�sig�default_strs     r5�_convert_to_highs_enumrQ_s���$��v�|�|�~�~�&�&�������v������$�$�$����/�/���n�Z�0�8����z���v����G�L�L�N�N�#�#���������	,�	,�	,�	,��{�#�#�#�#�$���s��B2�A?B2�1B2TFc�x	�t|��t|	dtttt
dd����}
|\}}}}}}}}|j���\}}tj	|��tj
z}|}|}|}tj||f��}tj||f��}t|��st|��rt||f��}ntj
||f��}t|��}id|�dt�d|�d|�d	t �d
|�d|�d|�d
|�d|�d|�d|
�dt"�dt$�d|�d|�d|
�}t'|��}t'|��}t'|��}t'|��}|�tj|��dkrtjd��}ntj|��}t/||j|j|j|||||�tj��|�
�
} d| vr[| d}!tj|!t;|��d���}"tj|!dt;|�����}!nd\}!}"d| vr�| d}#tj|#dt;|�����}$tj|#t;|��d���}%tj| dddd�f��}&tj| dddd�f��}'n
d\}$}%d\}&}'dddd�}(| �dd��})| �dd��}*t?|)|*��\}+},d | vrtj| d ��nd}-|-|!|"tA|!|$d!���tA|"|%d!���tA|-�dn|-|z
|'d!���tA|-�dn||-z
|&d!���| �d"��|+| dtBk|,| �d#d��p| �d$d��| �d%��d&�
}.tj"|-��rW|�U|.�#| �d'd��| �d(d)��| �d*d)��d+���|.S),a�
    Solve the following linear programming problem using one of the HiGHS
    solvers:

    User-facing documentation is in _linprog_doc.py.

    Parameters
    ----------
    lp :  _LPProblem
        A ``scipy.optimize._linprog_util._LPProblem`` ``namedtuple``.
    solver : "ipm" or "simplex" or None
        Which HiGHS solver to use.  If ``None``, "simplex" will be used.

    Options
    -------
    maxiter : int
        The maximum number of iterations to perform in either phase. For
        ``solver='ipm'``, this does not include the number of crossover
        iterations.  Default is the largest possible value for an ``int``
        on the platform.
    disp : bool
        Set to ``True`` if indicators of optimization status are to be printed
        to the console each iteration; default ``False``.
    time_limit : float
        The maximum time in seconds allotted to solve the problem; default is
        the largest possible value for a ``double`` on the platform.
    presolve : bool
        Presolve attempts to identify trivial infeasibilities,
        identify trivial unboundedness, and simplify the problem before
        sending it to the main solver. It is generally recommended
        to keep the default setting ``True``; set to ``False`` if presolve is
        to be disabled.
    dual_feasibility_tolerance : double
        Dual feasibility tolerance.  Default is 1e-07.
        The minimum of this and ``primal_feasibility_tolerance``
        is used for the feasibility tolerance when ``solver='ipm'``.
    primal_feasibility_tolerance : double
        Primal feasibility tolerance.  Default is 1e-07.
        The minimum of this and ``dual_feasibility_tolerance``
        is used for the feasibility tolerance when ``solver='ipm'``.
    ipm_optimality_tolerance : double
        Optimality tolerance for ``solver='ipm'``.  Default is 1e-08.
        Minimum possible value is 1e-12 and must be smaller than the largest
        possible value for a ``double`` on the platform.
    simplex_dual_edge_weight_strategy : str (default: None)
        Strategy for simplex dual edge weights. The default, ``None``,
        automatically selects one of the following.

        ``'dantzig'`` uses Dantzig's original strategy of choosing the most
        negative reduced cost.

        ``'devex'`` uses the strategy described in [15]_.

        ``steepest`` uses the exact steepest edge strategy as described in
        [16]_.

        ``'steepest-devex'`` begins with the exact steepest edge strategy
        until the computation is too costly or inexact and then switches to
        the devex method.

        Curently, using ``None`` always selects ``'steepest-devex'``, but this
        may change as new options become available.

    mip_max_nodes : int
        The maximum number of nodes allotted to solve the problem; default is
        the largest possible value for a ``HighsInt`` on the platform.
        Ignored if not using the MIP solver.
    unknown_options : dict
        Optional arguments not used by this particular solver. If
        ``unknown_options`` is non-empty, a warning is issued listing all
        unused options.

    Returns
    -------
    sol : dict
        A dictionary consisting of the fields:

            x : 1D array
                The values of the decision variables that minimizes the
                objective function while satisfying the constraints.
            fun : float
                The optimal value of the objective function ``c @ x``.
            slack : 1D array
                The (nominally positive) values of the slack,
                ``b_ub - A_ub @ x``.
            con : 1D array
                The (nominally zero) residuals of the equality constraints,
                ``b_eq - A_eq @ x``.
            success : bool
                ``True`` when the algorithm succeeds in finding an optimal
                solution.
            status : int
                An integer representing the exit status of the algorithm.

                ``0`` : Optimization terminated successfully.

                ``1`` : Iteration or time limit reached.

                ``2`` : Problem appears to be infeasible.

                ``3`` : Problem appears to be unbounded.

                ``4`` : The HiGHS solver ran into a problem.

            message : str
                A string descriptor of the exit status of the algorithm.
            nit : int
                The total number of iterations performed.
                For ``solver='simplex'``, this includes iterations in all
                phases. For ``solver='ipm'``, this does not include
                crossover iterations.
            crossover_nit : int
                The number of primal/dual pushes performed during the
                crossover routine for ``solver='ipm'``.  This is ``0``
                for ``solver='simplex'``.
            ineqlin : OptimizeResult
                Solution and sensitivity information corresponding to the
                inequality constraints, `b_ub`. A dictionary consisting of the
                fields:

                residual : np.ndnarray
                    The (nominally positive) values of the slack variables,
                    ``b_ub - A_ub @ x``.  This quantity is also commonly
                    referred to as "slack".

                marginals : np.ndarray
                    The sensitivity (partial derivative) of the objective
                    function with respect to the right-hand side of the
                    inequality constraints, `b_ub`.

            eqlin : OptimizeResult
                Solution and sensitivity information corresponding to the
                equality constraints, `b_eq`.  A dictionary consisting of the
                fields:

                residual : np.ndarray
                    The (nominally zero) residuals of the equality constraints,
                    ``b_eq - A_eq @ x``.

                marginals : np.ndarray
                    The sensitivity (partial derivative) of the objective
                    function with respect to the right-hand side of the
                    equality constraints, `b_eq`.

            lower, upper : OptimizeResult
                Solution and sensitivity information corresponding to the
                lower and upper bounds on decision variables, `bounds`.

                residual : np.ndarray
                    The (nominally positive) values of the quantity
                    ``x - lb`` (lower) or ``ub - x`` (upper).

                marginals : np.ndarray
                    The sensitivity (partial derivative) of the objective
                    function with respect to the lower and upper
                    `bounds`.

            mip_node_count : int
                The number of subproblems or "nodes" solved by the MILP
                solver. Only present when `integrality` is not `None`.

            mip_dual_bound : float
                The MILP solver's final estimate of the lower bound on the
                optimal solution. Only present when `integrality` is not
                `None`.

            mip_gap : float
                The difference between the final objective function value
                and the final dual bound, scaled by the final objective
                function value. Only present when `integrality` is not
                `None`.

    Notes
    -----
    The result fields `ineqlin`, `eqlin`, `lower`, and `upper` all contain
    `marginals`, or partial derivatives of the objective function with respect
    to the right-hand side of each constraint. These partial derivatives are
    also referred to as "Lagrange multipliers", "dual values", and
    "shadow prices". The sign convention of `marginals` is opposite that
    of Lagrange multipliers produced by many nonlinear solvers.

    References
    ----------
    .. [15] Harris, Paula MJ. "Pivot selection methods of the Devex LP code."
            Mathematical programming 5.1 (1973): 1-28.
    .. [16] Goldfarb, Donald, and John Ker Reid. "A practicable steepest-edge
            simplex algorithm." Mathematical Programming 12.1 (1977): 361-371.
    �!simplex_dual_edge_weight_strategyN)�dantzig�devexzsteepest-devex�steepestN)rN�presolve�sense�solver�
time_limit�highs_debug_level�dual_feasibility_tolerance�ipm_optimality_tolerance�log_to_console�
mip_max_nodes�output_flag�primal_feasibility_tolerance�simplex_strategy�simplex_crash_strategy�ipm_iteration_limit�simplex_iteration_limit�mip_rel_gapr�slack)NN�lambda�	marg_bndsrz	highs-ipmzhighs-ds)�ipm�simplexN�status�messager<)�residual�	marginals�fun�simplex_nit�ipm_nit�
crossover_nit)
r<rg�con�ineqlin�eqlinrB�upperrprl�successrm�nitrs�mip_node_count�mip_dual_boundg�mip_gap)rzr{r|)$rrQr r!rr"�T�copyr9�	ones_like�inf�concatenater&r%r$rrrrr>�sum�empty�arrayr�indptr�indices�data�astype�uint8�lenr.r6rr�any�update)/�lprYrZrW�disp�maxiterr\rar]rSrfr_�unknown_options�&simplex_dual_edge_weight_strategy_enum�c�A_ub�b_ub�A_eq�b_eq�bounds�x0�integrality�lb�ub�lhs_ub�rhs_ub�lhs_eq�rhs_eq�lhs�rhs�A�options�resrgrt�lamda�marg_ineqlin�
marg_eqlin�
marg_upper�
marg_lower�solversr/r0rlrmr<�sols/                                               r5rGrGpsy��L�?�+�+�+�.D�)�+�F�B�#L�A����.�.�.�*�:<�6�A�t�T�4��v�r�;�
�X�]�]�_�_�F�B���l�4� � �
 ���
'�F�
�F�
�F�
�F�
�.�&�&�)�
*�
*�C�
�.�&�&�)�
*�
*�C���~�~�$��$���$��D�$�<� � ����I�t�T�l�#�#���1�
�
�A���H���/��	�&��	�j�	�
	�/��	%�&@�
�	#�$<��	�$��	���	�t��	'�(D��	,�2��	�7��	!�"B�� 	�w�!�"	"�7�#�$	�{�%�G�,�s�
�
�C�
�s�
�
�C�	�b�	�	�B�	�b�	�	�B���b�f�[�1�1�Q�6�6��h�q�k�k����h�{�+�+��
��A�H�a�i����c��R��!3�!3�B�H�!=�!=�w�H�H�C��#�~�~��G����h�u�S��Y�Y�Z�Z�(�)�)�����z��D�	�	�z�*�+�+����
��s��3����H�
���x��j�s�4�y�y�j� 1�2�2���X�e�C��I�I�J�J�/�0�0�
��X�c�+�.�q�!�!�!�t�4�5�5�
��X�c�+�.�q�!�!�!�t�4�5�5�
�
�#-� ��j�!+��
�J�"�j�
�K�K�G��7�7�8�T�*�*�L��G�G�I�t�,�,�M�4�\�5B�D�D�O�F�G�"�S�j�j����S�����d�A����$� �(�&
�&
���#��&�$
�$
���#�#$�9�4�4�!�b�&�&�$
�$
���#�#$�9�4�4�"�q�&�&�$�$����'�'�%�.�.���(�m�';�;���'�'�-��+�+�D�s�w�w�y�!�/D�/D��G�G�O�4�4�1
�
�C�6
�v�a�y�y��[�,��
�
�!�g�g�&6��:�:�!�g�g�&6��<�<��w�w�y�#�.�.�
�
�	�	�	��Jr7)
NTFNNNNNNN)1�__doc__rE�numpyr9�	_optimizerrr�warningsr�_highs._highs_wrapperr�_highs._highs_constantsr	r
rrr
rrrrrrrrrrrr-rrrrrrrr r!r"r#�scipy.sparser$r%r&r6r>rQrG�r7r5�<module>r�s��
�
���������N�N�N�N�N�N�N�N�N�N�������1�1�1�1�1�1�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�F6�5�5�5�5�5�5�5�5�5�'�'�'�:
�
�
�$�$�$�":>�'+�.2�04�,0�59�#�!%�H�H�H�H�H�Hr7

Youez - 2016 - github.com/yon3zu
LinuXploit