+
    /i^                     x   R t RR.t^ RIt^RIHt ^ RIHt ^RI	H
t
HtHtHtHtHt ^RIHt ^RIHtHt ^ R	IHt ^ R
IHt ^ RIHt ^ RIHt Rt]P>                  ! ]P@                  ! ]PB                  4      PD                  4      t#R t$RRRRRRRRR^dR^R^ ]#R3R lt%RRRR^dR^R]#RRR3R lt&R R lt'R R lt(R# )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_slsqpN)slsqp)norm)OptimizeResult_check_unknown_options_prepare_scalar_function_clip_x_for_func_check_clip_x_wrap_callback)approx_derivative)old_bound_to_new_arr_to_scalar)array_namespace)array_api_extra)_call_callback_maybe_halt)NDArrayzrestructuredtext enc                L    \        WRVVR7      p\        P                  ! V4      # )aC  
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   &&&* V/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/optimize/_slsqp_py.pyr   r   $   s(    6 DI!%'C ==    gư>c                6  a
 Ve   Tp\        VR4      pRVRVRVRV^ 8g  RVRV/pRpT\        ;QJ d    . V
3R lV 4       F  NK  	  5M! V
3R lV 4       4      ,          pT\        ;QJ d    . V
3R	 lV 4       F  NK  	  5M! V
3R	 lV 4       4      ,          pV'       d   VR
RRVRVRS
/3,          pV'       d   VR
RRVRV	RS
/3,          p\        WS
3RVRVRV/VB pV'       d+   VR,          VR,          VR,          VR,          VR,          3# VR,          # )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>`.

r   maxiterftoliprintdispepscallbackc              3   4   <"   T F  pR RRVRS/x  K  	  R# 5i)typeeqfunr   N .0cr   s   & r   	<genexpr>fmin_slsqp.<locals>.<genexpr>   s     I&Q64648&   c              3   4   <"   T F  pR RRVRS/x  K  	  R# 5i)r(   ineqr*   r   Nr+   r,   s   & r   r/   r0      s     LGq665!VT:Gr1   r(   r)   r*   r   r   r3   boundsconstraintsr   nitstatusmessager+   )r   tuple_minimize_slsqp)r   x0eqconsf_eqconsieqcons	f_ieqconsr4   fprimefprime_eqconsfprime_ieqconsr   iteraccr#   r$   full_outputr   r&   optsconsress   &&&&&&&&&&f&&&&&&&   r   r   r   F   sH   `  h0HtCfFaK7"D D 	EEI&IEEI&IIIDEELGLEELGLLLD &$x$  # 	#&&%E>$  # 	# $D 4f 4V 4&*4.24C3xUSZXINN3xr   Fc                  aaa5a6 \        V4       TpV
o5V	'       g   ^ p\        V4      p\        P                  ! VP	                  V4      ^VR7      pVP
                  pVP                  VP                  R4      '       d   VP                  pVP                  VP                  VV4      RP4      pVe   \        V4      ^ 8X  d#   \        P                  ) \        P                  3o6M\        V4      o6\        P                  ! VS6^ ,          S6^,          4      p\        V\         4      '       d   V3pRRQRRQ/p\#        V4       F  w  pp VR,          P%                  4       pVRR9  d   \'        RVR,           R24      h RT9  d   \'        R	T R24      hTP/                  R4      pTf   T5TTT63R lpT! TR,          4      pTT;;,          RTR,          RTRTP/                  RRQ4      /3,          uu&   K  	  RPR^ R^R^R^R^R^R^R^R^R^	R/p\1        \3        \        VR,           Uu. uF/  p\        P4                  ! VR,          ! V.VR,          O5!  4      NK1  	  up4      4      p\1        \3        \        VR,           Uu. uF/  p\        P4                  ! VR,          ! V.VR,          O5!  4      NK1  	  up4      4      pVV,           p\        V4      pVe   \        V4      ^ 8X  dy   \        P6                  ! V\8        R7      p \        P6                  ! V\8        R7      p!V P;                  \        P<                  4       V!P;                  \        P<                  4       EMV\        P>                  ! V U"U#u. uF  w  p"p#\A        V"4      \A        V#4      3NK  	  up#p"\8        4      p$V$PB                  ^ ,          V8w  d   \E        R4      h\        PF                  ! RR 7      ;_uu_ 4        V$RS,          V$RT,          8  p%RRR4       X%PI                  4       '       d&   \'        R!R"PK                  R# V% 4       4       R$24      hV$RS,          PM                  4       V$RT,          PM                  4       p!p \        PN                  ! V$4      ( p&\        P<                  V V&RS,          &   \        P<                  V!V&RT,          &   \Q        V VSW*SS6VR%7      p'\S        V'PT                  S64      p(\S        V'PV                  S64      p)/ R&VbR'R(bR)R(bR*R(bR+R(bR,R(bR-R(bR.R(bR/R(bR0R(bR1R2V,          bR3^ bR4^ bR5^ bR6^ bR7\Y        V4      bR8^ bR9VR:VR;^ R<V/Cp*V^8  d   \[        R=R> R?R@R> R?RARB R?RCRB 24       \        P\                  ! \_        V^V,          ,           ^,           ^4      .\        P`                  R7      p+VV^,           ,          ^,          ^V,          V,          ,           V^V,          ,           ^,           V,          ,
          ^	V,          ,           ^V,          V,          ,           ^#V,          ,           VV,          ,           ^,           p,V^ 8X  d   V,^V,          V^,           ,          ,          p,\        P\                  ! \_        V,^4      \        P
                  R7      p-V(! V4      p.V)! V4      p/\        P\                  ! \_        ^V^V,          ,           ^,           4      .\        P
                  R7      p0\        P\                  ! \_        ^V4      V.\        P
                  RDRE7      p1\        P\                  ! \_        ^V4      .\        P
                  R7      p2\c        V1VVVV4       \e        V2VVVV4       ^ p3 \g        V*V.V/V1V2VV0V V!V-V+4       V*R;,          ^8X  d!   V'PU                  V4      p.\e        V2VVVV4       V*R;,          RP8X  d!   V'PW                  V4      p/\c        V1VVVV4       V*R6,          V38  dt   Ve5   \i        \        PL                  ! V4      V.RF7      p4\k        VV44      '       d   M_V^8  d5   \[        V*R6,          RG R?V'Pl                  RG R?V.RH R?\o        V/4      RH 24       \q        V*R;,          4      ^8w  d   MV*R6,          p3EK  V^8  dw   \[        VV*R;,          ,          RIV*R;,           RJ2,           4       \[        RKV.4       \[        RLV*R6,          4       \[        RMV'Pl                  4       \[        RNV'Pr                  4       \i        VV.V/V*R6,          V'Pl                  V'Pr                  V*R;,          VV*R;,          ,          V*R;,          ^ 8H  V0RV RO7
      #   \(         d   p\)        R	T R
24      ThRp?i\*         d   p\+        R4      ThRp?i\,         d   p\+        R4      ThRp?ii ; iu upi u upi u up#p"i   + '       g   i     EL; i)Ua  
Minimize a scalar function of one or more variables using Sequential
Least Squares Programming (SLSQP).

Parameters
----------
ftol : float
    Precision target for the value of f in the stopping criterion. This value
    controls the final accuracy for checking various optimality conditions;
    gradient of the lagrangian and absolute sum of the constraint violations
    should be lower than ``ftol``. Similarly, computed step size and the
    objective function changes are checked against this value. Default is 1e-6.
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, optional
    Maximum number of iterations. Default value is 100.
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.
workers : int, map-like callable, optional
    A map-like callable, such as `multiprocessing.Pool.map` for evaluating
    any numerical differentiation in parallel.
    This evaluation is carried out as ``workers(fun, iterable)``.

    .. versionadded:: 1.16.0

Returns
-------
res : OptimizeResult
    The optimization result represented as an `OptimizeResult` object.
    In this dict-like object the following fields are of particular importance:
    ``x`` the solution array, ``success`` a Boolean flag indicating if the
    optimizer exited successfully, ``message`` which describes the reason for
    termination, and ``multipliers`` which contains the Karush-Kuhn-Tucker
    (KKT) multipliers for the QP approximation used in solving the original
    nonlinear problem. See ``Notes`` below. See also `OptimizeResult` for a
    description of other attributes.

Notes
-----
The KKT multipliers are returned in the ``OptimizeResult.multipliers``
attribute as a NumPy array. Denoting the dimension of the equality constraints
with ``meq``, and of inequality constraints with ``mineq``, then the returned
array slice ``m[:meq]`` contains the multipliers for the equality constraints,
and the remaining ``m[meq:meq + mineq]`` contains the multipliers for the
inequality constraints. The multipliers corresponding to bound inequalities
are not returned. See [1]_ pp. 321 or [2]_ for an explanation of how to interpret
these multipliers. The internal QP problem is solved using the methods given
in [3]_ Chapter 25.

Note that if new-style `NonlinearConstraint` or `LinearConstraint` were
used, then ``minimize`` converts them first to old-style constraint dicts.
It is possible for a single new-style constraint to simultaneously contain
both inequality and equality constraints. This means that if there is mixing
within a single constraint, then the returned list of multipliers will have
a different length than the original new-style constraints.

References
----------
.. [1] Nocedal, J., and S J Wright, 2006, "Numerical Optimization", Springer,
   New York.
.. [2] Kraft, D., "A software package for sequential quadratic programming",
   1988, Tech. Rep. DFVLR-FB 88-28, DLR German Aerospace Center, Germany.
.. [3] Lawson, C. L., and R. J. Hanson, 1995, "Solving Least Squares Problems",
   SIAM, Philadelphia, PA.

)ndimxpzreal floatingNr)   r3   r(   zUnknown constraint type 'z'.zConstraint z has no type defined.z/Constraints must be defined using a dictionary.z#Constraint's type must be a string.r*   z has no function defined.r   c                    <a  VVV VV3R  lpV# )c           	      n   < \        V S4      p SR9   d   \        SV SVSSR7      # \        SV R SVSR7      # )r   )r   r   rel_stepr4   )r   r   r   r4   )r   z3-pointcs)r
   r   )r   r   r   finite_diff_rel_stepr*   r   
new_boundss   &*r   cjac3_minimize_slsqp.<locals>.cjac_factory.<locals>.cjaca  sT    %a4A::0a$:N8B D D  1a	:A8B D Dr   r+   )r*   rR   r   rP   r   rQ   s   f r   cjac_factory%_minimize_slsqp.<locals>.cjac_factory`  s    
D 
D r   r   z$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 linesearchzIteration limit reached)dtypezDSLSQP Error: the length of bounds is not compatible with that of x0.ignore)invalidzSLSQP Error: lb > ub in bounds z, c              3   8   "   T F  p\        V4      x  K  	  R # 5i)N)str)r-   bs   & r   r/   "_minimize_slsqp.<locals>.<genexpr>  s     )A&Q#a&&&s   .)r   r   r   rP   r4   workersrD   alphag        f0gsh1h2h3h4tt0tolg      $@exactinconsistentresetrC   itermaxlinemmeqmodenNITz>5 FCOBJFUNz>16GNORMF)rV   order)r   r*   5dz16.6Ez    (Exit mode )z#            Current function value:z            Iterations:z!            Function evaluations:z!            Gradient evaluations:)
r   r*   r   r6   nfevnjevr7   r8   successmultipliersr+   )r)   r3   )NNN    )r      ):r   r   xpx
atleast_ndasarrayfloat64isdtyperV   reshapeastypelenr   infr   clip
isinstancedict	enumeratelower
ValueErrorKeyError	TypeErrorAttributeErrorgetsummap
atleast_1demptyfloatfillnanarrayr   shape
IndexErrorerrstateanyjoincopyisfiniter   r	   r*   gradintprintzerosmaxint32_eval_con_normals_eval_constraintr   r   r   r{   lanormabsngev)7r   r;   r   r   r4   r5   r!   r"   r#   r$   r%   r&   rP   r^   unknown_optionsrD   rK   rV   r   rG   icconctypeerR   rT   
exit_modesr.   ro   mieqrn   rq   xlxuloupbndsbnderrinfbndsfwrapped_funwrapped_grad
state_dictindicesbuffer_sizebufferfxgmultCd	iter_previntermediate_resultr   rQ   s7   &&&f&&&&&&&&f&,                                      @@r   r:   r:      sZ	   ^ ?+
CG 
	B	

2Q2	6BJJE	zz"((O,,


299R',A ~V)vvgrvv&
%f-
 	:a=*Q-0A +t$$"o"fb!D[)C	NK%%'E N* #<S[M!LMM + {2$.GHII wwu~<   E
+D 	UE
!46 9 	9S *Z <<<LB;;;JF/
1J c#Dz#!! ahq&=1V9&=>!# $ %Cs3V&$1 qx'>AfI'>?$& ' (D 	d
AAA ~V)XXau%XXau%

xx&,.&,(2r ),nR.@A&,./46::a=A ; < < [[**$Z$t*,F + ::<<> $		)A&)A AB!E F Fd"DJOO$5B ++d##666$<666$< 
"$s7K)3W
FB
 #266:6K#BGGZ8L.s 	c 	c	
 	c 	c 	c 	c 	S 	c 	tCx 	 	 	 	  	3w<!" 	#$ 	QsQ+J2 {r
!D9Ahs^1WSMBC hhA!GaK+,BHH=G 	
1Q3
QqSUa!A#gk3..14qs1u<r!tCc#gMPRR 
 qyqsAE{"XXc+q)<F
 
QBQA 88SA!GaK()<D 	#a)Qrzz=A
#a)BJJ/AaD!S)Q4C(I
j"aAq$BHf"BQ4C0f#
AaD!S1f	)#&4ggaj'# -X7JKK {F+B/qAE
!F1Ie#46 7 z&!"a'v&	 {z&)*z&?Q>RRS-TT	
 	3R8'F);<1277;1277;

6 2rww&!:j6H+IF#q(tBQx M  	K[,ABCJ 	2 * +012 	JABI	Jd#&. +**sZ   e&5f+ 5f05"f5
&f;f(e//f(<f(=f		f(f(f##f(;g	c          
      T    V ^8  d   QhR\         R\         R\        R\        R\        /# )   r   r   rG   rn   ro   r   r   r   )formats   "r   __annotate__r   9  s/       G 4 C c r   c                    V^ 8X  d   R# V^ 8  dr   ^ pVR,           Fb  p\         P                  ! VR,          ! V.VR,          O5!  4      P                  4       pWpWU\        V4      ,           % V\        V4      ,          pKd  	  W48  dr   TpVR,           Fb  p\         P                  ! VR,          ! V.VR,          O5!  4      P                  4       pWpWU\        V4      ,           % V\        V4      ,          pKd  	  R# )r   Nr)   r*   r   r3   )r   r   ravelr   )r   r   rG   rn   ro   rowr   temps   &&&&&   r   r   r   9  s    Av Qw::C==UA!<F!<=CCED%)cD	/"3t9C 
 	w<<C==UA!<F!<=CCED%)cD	/"3t9C  
 r   c          
      T    V ^8  d   QhR\         R\         R\        R\        R\        /# )r   r   r   rG   rn   ro   r   )r   s   "r   r   r   R  s/       W D S s r   c                 
   V^ 8X  d   R# V^ 8  dw   ^ pVR,           Fg  p\         P                  ! VR,          ! V.VR,          O5!  4      pWpWUVP                  ^ ,          ,           1R3&   WWP                  ^ ,          ,          pKi  	  W48  dw   TpVR,           Fg  p\         P                  ! VR,          ! V.VR,          O5!  4      pWpWUVP                  ^ ,          ,           1R3&   WWP                  ^ ,          ,          pKi  	  R# )r   Nr)   r   r   r   r3   )r   r   r   )r   r   rG   rn   ro   r   r   r   s   &&&&&   r   r   r   R  s    Av
Qw::C==UA!<F!<=D,0c

1%%q()::a= C 
 	w<<C==UA!<F!<=D,0c

1%%q()::a= C  
 r   r+   ))__doc____all__numpyr   	_slsqplibr   scipy.linalgr   r   	_optimizer   r   r   r	   r
   r   _numdiffr   _constraintsr   r   scipy._lib._array_apir   
scipy._libr   r   scipy._lib._utilr   numpy.typingr   __docformat__sqrtfinfor   r%   _epsilonr   r   r:   r   r   r+   r   r   <module>r      s    l
+   '7 7 ( : 1 - 6  %77288BJJ'++,D !#T2T"#6d8	Rj $&4 "fQU 4d 	[|
2r   