+
    /iB                         R t ^ RIt^ RIt^RIHtHt ^ RI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 R tR tR	 tRR
 ltR# )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)OptimizeWarningOptimizeResult)warn)_highs_wrapper)	kHighsInfHighsDebugLevelObjSenseHighsModelStatussimplex_constants)	csc_arrayvstackissparsec                r   / RRb\         P                  Rb\         P                  Rb\         P                  Rb\         P                  Rb\         P
                  Rb\         P                  Rb\         P                  Rb\         P                  Rb\         P                  Rb\         P                  Rb\         P                  R	b\         P                  R
b\         P                  Rb\         P                  Rb\         P                  RbpRpVP!                  W4      w  rEV e   \#        V 4      MRpV RV RV R2pWE3# )zCConverts HiGHS status number/message to SciPy status number/messageNz(HiGHS Status z: ))   z%HiGHS did not provide a status code. )r    )   r   )    z&Optimization terminated successfully. )   zTime limit reached. )r   zIteration limit reached. )r   zThe problem is infeasible. )   zThe problem is unbounded. )r   z(The problem is unbounded or infeasible. )r   z*The HiGHS status code was not recognized. )r	   kNotset
kLoadErrorkModelErrorkPresolveErrorkSolveErrorkPostsolveErrorkModelEmptykObjectiveBoundkObjectiveTargetkOptimal
kTimeLimitkIterationLimitkInfeasible
kUnboundedkUnboundedOrInfeasiblegetint)highs_statushighs_messagescipy_statuses_messagesunrecognizedscipy_statusscipy_messagehstats   &&     [/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/optimize/_linprog_highs.py_highs_to_scipy_status_messager/   "   s   F:F  'F 	##WF 	$$g	F
 	''F 	$$gF 	(('F 	$$gF 	(('F 	))7F 	!!#PF 	##%@F 	((*JF 	$$&HF 	##%FF  	// 2E!F$ EL##L?  L!-!9CtE%%eWB}oQ@M&&    c                     \         P                  ! V 4      p\         P                  ! R R7      ;_uu_ 4        \         P                  ! W,          4      \        ,          W&   RRR4       V #   + '       g   i     T # ; i)ignoreinvalidN)npisinferrstatesignr   )xinfss   & r.   _replace_infr;   @   sM    88A;D	X	&	&''!'"9, 
'H 
'	&Hs   *A**A;	c                 d    W P                  4       ,          #   \         d    Y ,          u # \         dy    \        P                  ! \
        4      pTP                  T,          P                  p\        R T RT  R\        TP                  4       4       RT R2	\        ^R7       Y$,          u # i ; i)zOption z is z, but only values in z are allowed. Using default: .
stacklevel)lowerAttributeErrorKeyErrorinspect	signature_linprog_highs
parametersdefaultr   setkeysr   )option
option_strchoicessigdefault_strs   &&&  r.   _convert_to_highs_enumrO   H   s    $||~&&  $/nnZ088wzl$vh.CGLLN#$$A}A 	, ##$s    B/B/A6B/.B/c                
   V'       d   RV R2p\        V\        ^R7       \        V	RR\        P                  P
                  R\        P                  P                  R\        P                  P                  R\        P                  P                  R	R	/R
7      pV w  ppppppppVP                  P                  4       w  pp\        P                  ! RR7      ;_uu_ 4        \        P                  ! V4      ) \        P                  ,          pR	R	R	4       TpTpTp\        P                  ! XV34      p\        P                  ! VV34      p\!        V4      '       g   \!        V4      '       d   \#        VV34      pM\        P"                  ! VV34      p\%        V4      p/ RVbR\&        P(                  bRVbRVbR\*        P,                  bRVbRVbRVbRVbRVbRVbRVbR\        P.                  P0                  bRVbRVbRV
bp V P3                  V4       \5        V4      p\5        V4      p\5        V4      p\5        V4      pVe   \        P6                  ! V4      ^ 8X  d   \        P8                  ! ^ 4      pM\        P:                  ! V4      p\=        VVP>                  VP@                  VPB                  VVVVVPE                  \        PF                  4      V 4
      p!RV!9   dO   V!R,          p"\        P:                  ! V"\I        V4      R	 4      p#\        P:                  ! V"R	\I        V4       4      p"MR	R	p#p"RV!9   d   V!R,          p$\        P:                  ! V$R	\I        V4       4      p%\        P:                  ! V$\I        V4      R	 4      p&\        P:                  ! V!R,          R3,          4      p'\        P:                  ! V!R,          R4,          4      p(MR	R	p&p%R	R	p(p'V!PK                  RR	4      p)V!PK                  R R	4      p*\M        V)V*4      w  p+pV!R!,          p,R!T,RT"R"T#R#\O        R$V"R%V%/4      R&\O        R$V#R%V&/4      R'\O        R$V,f   R	MV,V,
          R%V(/4      R(\O        R$V,f   R	MVV,,
          R%V'/4      R)V!PK                  R)4      RT+R*V!R,          \P        PR                  8H  R TR+V!PK                  R,^ 4      ;'       g    V!PK                  R-^ 4      R.V!PK                  R.4      /p-\        PT                  ! V,4      '       dL   VeH   V-P3                  R/V!PK                  R/^ 4      R0V!PK                  R0R14      R2V!PK                  R2R14      /4       V-#   + '       g   i     ELE; i)5a  
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.

    Currently, 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.
zUnrecognized options detected: z). These will be passed to HiGHS verbatim.r>   !simplex_dual_edge_weight_strategydantzigdevexzsteepest-devexsteepestN)rL   r2   r3   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ipm_iteration_limitsimplex_iteration_limitmip_rel_gapslacklambda	marg_bndsstatusmessager9   conineqlinresidual	marginalseqlinr@   upperfunsuccessnitsimplex_nitipm_nitcrossover_nitmip_node_countmip_dual_boundg        mip_gap)r   NNN)r   rx   )+r   r   rO   s_cSimplexEdgeWeightStrategy!kSimplexEdgeWeightStrategyDantzigkSimplexEdgeWeightStrategyDevex kSimplexEdgeWeightStrategyChoose&kSimplexEdgeWeightStrategySteepestEdgeTcopyr5   r7   	ones_likeinfconcatenater   r   r   r   	kMinimizer   kHighsDebugLevelNoneSimplexStrategykSimplexStrategyDualupdater;   sumemptyarrayr   indptrindicesdataastypeuint8lenr%   r/   r   r	   r   any).lprW   rX   rU   dispmaxiterrZ   r_   r[   rQ   rc   r]   unknown_optionsrh   &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resrd   ri   lamdamarg_ineqlin
marg_eqlin
marg_upper
marg_lowerr'   r(   rg   r9   sols.   &&&&&&&&&&&&,                                 r.   rE   rE   Y   sL   J 4_4E F= =Wo!4 .D)+..PP..NN!..OO..UUt.* :<6AtT4vr;XX]]_FB	X	&	&,,t$$RVV+ 
'FFF
..&&)
*C
..&&)
*C~~$D$< IItTl#!AH## 	& 	j	
 	_AA 	%&@ 	#$< 	$ 	 	t 	'(D 	,2 	C//DD 	w  	"7!" 	{#G& NN?# s
C
s
C	b	B	b	Bbff[1Q6hhqkhh{+
AHHaiicR!3!3BHH!=wHC #~GhhuSYZ()zD	*+4s 3Hxxjs4y 12XXeCIJ/0
XXc+.t45
XXc+.t45
#'j!%tJ

 778T*LGGIt,M4\5BDOFG 	CAE#n5L&  N3J$  N194!b&J$  N194"q&J$  #''%.Vc(m'7'@'@@g#''-+DDswwy!/DCGGO41C6 
vvayy[,

cgg&6:cgg&6<swwy#.
 	 Jc 
'	&	&s    -U		U	)
NTFNNNNNNN)__doc__rC   numpyr5   	_optimizer   r   warningsr   _highspy._highs_wrapperr   _highspy._corer   r   r   r	   r
   ry   scipy.sparser   r   r   r/   r;   rO   rE    r0   r.   <module>r      sB      6  3  5 4'<$"Mr0   