+
    /i                         ^ RI Ht ^ RIHt ^ 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 ^RIHtHt ^RIHt  ! R	 R
4      t ! R R4      t ! R R4      t ! R R4      t ! R R4      tR# )    )suppress)	signatureN)BoundsLinearConstraintNonlinearConstraintOptimizeResult)PreparedConstraint)PRINT_OPTIONSBARRIER)CallbackSuccessget_arrays_tol)exact_1d_arrayc                   P   a  ] tR t^t o RtR tR t]R 4       t]R 4       t	Rt
V tR# )ObjectiveFunctionz!
Real-valued objective function.
c                    V'       dH   Ve   \        V4      '       g   Q h\        V\        4      '       g   Q h\        V\        4      '       g   Q hWn        W n        W@n        ^ V n        R# )a  
Initialize the objective function.

Parameters
----------
fun : {callable, None}
    Function to evaluate, or None.

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

    where ``x`` is an array with shape (n,) and `args` is a tuple.
verbose : bool
    Whether to print the function evaluations.
debug : bool
    Whether to make debugging tests during the execution.
*args : tuple
    Additional arguments to be passed to the function.
N)callable
isinstancebool_fun_verbose_args_n_eval)selffunverbosedebugargss   &&&&*W/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/_lib/cobyqa/problem.py__init__ObjectiveFunction.__init__   sV    & ;(3--//gt,,,,eT****	
    c           	        \         P                  ! V\        R7      pV P                  f   RpV# \        \         P                  ! V P                  ! V.V P
                  O5!  4      4      pV ;P                  ^,          un        V P                  '       dK   \         P                  ! R/ \        B ;_uu_ 4        \        V P                   RV RV 24       RRR4       V# V#   + '       g   i     T# ; i)z
Evaluate the objective function.

Parameters
----------
x : array_like, shape (n,)
    Point at which the objective function is evaluated.

Returns
-------
float
    Function value at `x`.
dtypeN        () =  )nparrayfloatr   squeezer   r   r   printoptionsr
   printname)r   xfs   && r   __call__ObjectiveFunction.__call__6   s     HHQe$99A  bjj1!:tzz!:;<ALLAL}}}__5}55TYYKq4s34 6q 65s   7C!!C2	c                    V P                   # zZ
Number of function evaluations.

Returns
-------
int
    Number of function evaluations.
)r   r   s   &r   n_evalObjectiveFunction.n_evalO        ||r!   c                    RpV P                   e    V P                   P                  pV# V#   \         d    Rp T# i ; i)Z
Name of the objective function.

Returns
-------
str
    Name of the objective function.
 r   )r   __name__AttributeError)r   r/   s   & r   r/   ObjectiveFunction.name[   sM     99 yy)) t " s   , ==)r   r   r   r   N)r=   
__module____qualname____firstlineno____doc__r   r2   propertyr7   r/   __static_attributes____classdictcell____classdict__s   @r   r   r      s<     :2 	 	  r!   r   c                   \   a  ] tR t^nt o RtR t]R 4       t]R 4       tR t	R t
R tRtV tR	# )
BoundConstraintsz&
Bound constraints ``xl <= x <= xu``.
c                2   \         P                  ! VP                  \        4      V n        \         P                  ! VP
                  \        4      V n        \         P                  ) V P                  \         P                  ! V P                  4      &   \         P                  V P                  \         P                  ! V P                  4      &   \         P                  ! V P                  V P                  8*  4      ;'       dl    \         P                  ! V P                  \         P                  8  4      ;'       d3    \         P                  ! V P                  \         P                  ) 8  4      V n        \         P                  ! V P                  \         P                  ) 8  4      \         P                  ! V P                  \         P                  8  4      ,           V n        \        V\         P                   ! VP                  P"                  4      4      V n        R# )zp
Initialize the bound constraints.

Parameters
----------
bounds : scipy.optimize.Bounds
    Bound constraints.
N)r)   r*   lbr+   _xlub_xuinfxlisnanxuallis_feasiblecount_nonzeromr	   onessizepcs)r   boundss   &&r   r   BoundConstraints.__init__s   sC    88FIIu-88FIIu- ')ffW!"%'VV!" FF477dgg%& * *tww'(* *tww"&&() 	
 !!$''RVVG"34r7G7GGGbff8
 
 &fbggfiinn.EFr!   c                    V P                   # )zL
Lower bound.

Returns
-------
`numpy.ndarray`, shape (n,)
    Lower bound.
)rM   r6   s   &r   rQ   BoundConstraints.xl        xxr!   c                    V P                   # )zL
Upper bound.

Returns
-------
`numpy.ndarray`, shape (n,)
    Upper bound.
)rO   r6   s   &r   rS   BoundConstraints.xu   r_   r!   c                \    \         P                  ! V\        R7      pV P                  V4      # )
Evaluate the maximum constraint violation.

Parameters
----------
x : array_like, shape (n,)
    Point at which the maximum constraint violation is evaluated.

Returns
-------
float
    Maximum constraint violation at `x`.
r#   )r)   asarrayr+   	violationr   r0   s   &&r   maxcvBoundConstraints.maxcv   s#     JJq&~~a  r!   c                    V P                   '       d   \        P                  ! ^ .4      # V P                  P	                  V4      # )r   )rU   r)   r*   rZ   re   rf   s   &&r   re   BoundConstraints.violation   s3    88QC= 88%%a((r!   c                    V P                   '       d,   \        P                  ! WP                  V P                  4      # T# )z
Project a point onto the feasible set.

Parameters
----------
x : array_like, shape (n,)
    Point to be projected.

Returns
-------
`numpy.ndarray`, shape (n,)
    Projection of `x` onto the feasible set.
)rU   r)   cliprQ   rS   rf   s   &&r   projectBoundConstraints.project   s-     04/?/?/?rwwq''477+FQFr!   )rM   rO   rU   rW   rZ   N)r=   r@   rA   rB   rC   r   rD   rQ   rS   rg   re   rm   rE   rF   rG   s   @r   rJ   rJ   n   sN     G4 	 	 	 	!")G Gr!   rJ   c                      a  ] tR t^t o RtR t]R 4       t]R 4       t]R 4       t	]R 4       t
]R 4       t]R 4       tR	 tR
 tRtV tR# )LinearConstraintszC
Linear constraints ``a_ub @ x <= b_ub`` and ``a_eq @ x == b_eq``.
c           	        V'       dR   \        V\        4      '       g   Q hV F  p\        V\        4      '       d   K  Q h	  \        V\        4      '       g   Q h\        P
                  ! ^ V34      V n        \        P
                  ! ^ 4      V n        \        P
                  ! ^ V34      V n        \        P
                  ! ^ 4      V n	        V EF  p\        P                  ! VP                  VP                  ,
          4      \        VP                  VP                  4      8*  p\        P                  ! V4      '       d   \        P                  ! V P                   VP"                  V,          34      V n        \        P$                  ! V P&                  RVP                  V,          VP                  V,          ,           ,          34      V n	        \        P(                  ! V4      '       d   EK   \        P                  ! V P*                  VP"                  V( ,          VP"                  V( ,          ) 34      V n        \        P$                  ! V P,                  VP                  V( ,          VP                  V( ,          ) 34      V n        EK  	  RV P*                  \        P.                  ! V P*                  4      &   RV P                   \        P.                  ! V P                   4      &   \        P.                  ! V P,                  4      \        P0                  ! V P,                  4      ,          p\        P.                  ! V P&                  4      pV P*                  V( R3,          V n        V P,                  V( ,          V n        V P                   V( R3,          V n        V P&                  V( ,          V n	        V Uu. uF@  qP"                  P2                  '       g   K   \5        V\        P6                  ! V4      4      NKB  	  upV n        R# u upi )z
Initialize the linear constraints.

Parameters
----------
constraints : list of LinearConstraint
    Linear constraints.
n : int
    Number of variables.
debug : bool
    Whether to make debugging tests during the execution.
      ?r%   NNNN)r   listr   r   r)   empty_a_ub_b_ub_a_eq_b_eqabsrN   rL   r   anyvstacka_eqAconcatenateb_eqrT   a_ubb_ubrR   isinfrY   r	   rX   rZ   )	r   constraintsnr   
constraintis_equalityundef_ubundef_eqcs	   &&&&     r   r   LinearConstraints.__init__   s    k40000)
!*.>???? *eT****XXq!f%
XXa[
XXq!f%
XXa[
%J&&
-
z}}=>K vvk""YY		:<<3L'MN
^^		&MM+6(mmK89	
 66+&&YY		"k\2#{l33
  ^^		"{l3#|44
1 &B *-		"((499%&),		"((499%&88DII&$)))<<88DII&YYy!|,
YYy)
YYy!|,
YYy)
7B
7B!cchh-q"''!*-{
 
s   6P$Pc                    V P                   # )z
Left-hand side matrix of the linear inequality constraints.

Returns
-------
`numpy.ndarray`, shape (m, n)
    Left-hand side matrix of the linear inequality constraints.
)rv   r6   s   &r   r   LinearConstraints.a_ub       zzr!   c                    V P                   # )z
Right-hand side vector of the linear inequality constraints.

Returns
-------
`numpy.ndarray`, shape (m, n)
    Right-hand side vector of the linear inequality constraints.
)rw   r6   s   &r   r   LinearConstraints.b_ub#  r   r!   c                    V P                   # )z
Left-hand side matrix of the linear equality constraints.

Returns
-------
`numpy.ndarray`, shape (m, n)
    Left-hand side matrix of the linear equality constraints.
)rx   r6   s   &r   r}   LinearConstraints.a_eq/  r   r!   c                    V P                   # )z
Right-hand side vector of the linear equality constraints.

Returns
-------
`numpy.ndarray`, shape (m, n)
    Right-hand side vector of the linear equality constraints.
)ry   r6   s   &r   r   LinearConstraints.b_eq;  r   r!   c                .    V P                   P                  # zl
Number of linear inequality constraints.

Returns
-------
int
    Number of linear inequality constraints.
)r   rY   r6   s   &r   m_ubLinearConstraints.m_ubG       yy~~r!   c                .    V P                   P                  # zh
Number of linear equality constraints.

Returns
-------
int
    Number of linear equality constraints.
)r   rY   r6   s   &r   m_eqLinearConstraints.m_eqS  r   r!   c                P    \         P                  ! V P                  V4      RR7      # )rc   r%   initialr)   maxre   rf   s   &&r   rg   LinearConstraints.maxcv_  s     vvdnnQ'55r!   c                    \        V P                  4      '       d?   \        P                  ! V P                   Uu. uF  q"P	                  V4      NK  	  up4      # \        P
                  ! . 4      # u upi N)lenrZ   r)   r   re   r*   )r   r0   pcs   && r   re   LinearConstraints.violationo  sK    txx==>>TXX"FXr<<?X"FGGxx| #Gs   A0)rx   rv   ry   rw   rZ   N)r=   r@   rA   rB   rC   r   rD   r   r   r}   r   r   r   rg   re   rE   rF   rG   s   @r   rp   rp      s     B
H 	 	 	 	 	 	 	 	 	 	 	 	6  r!   rp   c                   t   a  ] tR tRt o RtR tR t]R 4       t]R 4       t	]R 4       t
RR	 ltRR
 ltRtV tR# )NonlinearConstraintsiu  zA
Nonlinear constraints ``c_ub(x) <= 0`` and ``c_eq(x) == b_eq``.
c                F   V'       dj   \        V\        4      '       g   Q hV F  p\        V\        4      '       d   K  Q h	  \        V\        4      '       g   Q h\        V\        4      '       g   Q hWn        . V n        W n        RV n        RV n        R;V n	        V n
        R# )z
Initialize the nonlinear constraints.

Parameters
----------
constraints : list
    Nonlinear constraints.
verbose : bool
    Whether to print the function evaluations.
debug : bool
    Whether to make debugging tests during the execution.
N)r   rt   r   r   _constraintsrZ   r   _map_ub_map_eq_m_ub_m_eq)r   r   r   r   r   s   &&&& r   r   NonlinearConstraints.__init__z  s     k40000)
!*.ABBBB *gt,,,,eT****' "&&
TZr!   c                
   \        V P                  4      '       g;   ^ ;V n        V n        \        P
                  ! . 4      \        P
                  ! . 4      3# \        P
                  ! V\        R7      p\        V P                  4      '       Eg   . V n        . V n	        ^ V n        ^ V n        V P                   EF  p\        VP                  4      '       g3   \        P                  ! V4      pR Vn        R Vn        \        W14      pM\        W!4      pRVP                  n        V P                  P#                  V4       \        P$                  ! VP                  P&                  4      pVP(                  ^ ,          VP(                  ^,          rv\+        Wg4      p\        P,                  ! Wv,
          4      V8*  p	V P                  P#                  WY,          4       V P                  P#                  WY( ,          4       V ;P                  \        P.                  ! V	4      ,          un        V ;P                  \        P.                  ! V	( 4      ,          un        EK  	  . p
. p\1        V P                  4       EF  w  rVP                  P                  V4      pV P2                  '       d   \        P4                  ! R	/ \6        B ;_uu_ 4        \9        \:        4      ;_uu_ 4        V P                  V,          P                  P<                  p\?        V RV RV 24       RRR4       RRR4       V P                  V,          pV P                  V,          pVV,          p\        V4      '       d   VP(                  ^ ,          V,          pVP(                  ^,          V,          pV\        P@                  ) 8  pVV,          VV,          ,
          pV
P#                  V4       V\        P@                  8  pVV,          VV,          ,
          pV
P#                  V4       W,          p\        V4      '       dJ   RVP(                  ^,          V,          VP(                  ^ ,          V,          ,           ,          pVV,          pVP#                  V4       EK  	  V P                  '       d   \        PB                  ! V4      pM\        P
                  ! . 4      pV P                  '       d   \        PB                  ! V
4      p
M\        P
                  ! . 4      p
V
PD                  V n        VPD                  V n        W3#   + '       g   i     EL; i  + '       g   i     EL+; i)
a_  
Calculates the residual (slack) for the constraints.

Parameters
----------
x : array_like, shape (n,)
    Point at which the constraints are evaluated.

Returns
-------
`numpy.ndarray`, shape (m_nonlinear_ub,)
    Nonlinear inequality constraint slack values.
`numpy.ndarray`, shape (m_nonlinear_eq,)
    Nonlinear equality constraint slack values.
r#   c                     V # r   r(   )x0s   &r   <lambda>/NonlinearConstraints.__call__.<locals>.<lambda>  s    rr!   c                     R # r%   r(   )r   vs   &&r   r   r     s    3r!   Tr&   r'   Nrr   r(   )#r   r   r   r   r)   r*   r+   rZ   r   r   r   jaccopyhessr	   r   	f_updatedappendarangerW   r[   r   rz   rV   	enumerater   r-   r
   r   r>   r=   r.   rP   r   rY   )r   r0   r   r   r   idxrL   rN   arr_tolr   c_ubc_eqivalfun_nameeq_idxub_idxub_valrQ   rS   	finite_xl_v	finite_xueq_valmidpoints   &&                       r   r2   NonlinearConstraints.__call__  s     4$$%%&''DJ88B<"--HHQe$488}}DLDLDJDJ"//

// 		*-A)AE.AF+A1B+J:B $( #ii) 1ryy|B(0 ffRWo8##C$45##C$56 

b..{;;


b..|<<

7 0: txx(EA&&**Q-C}}}__5}55!.11#'#4#4Q#7#;#;#D#D
!A3d3%89 2 6 \\!_F\\!_F[F6{{YYq\&)YYq\&) "&&L		]VI%66B K	I&I6B [F6{{"))A,v"61f9M"MN("KKA )D :::>>$'D88B<D:::>>$'D88B<DYY
YY
zW 211 655s$   U ;T1U1U<	UUc                L    V P                   f   \        R4      hV P                   # )z
Number of nonlinear inequality constraints.

Returns
-------
int
    Number of nonlinear inequality constraints.

Raises
------
ValueError
    If the number of nonlinear inequality constraints is unknown.
z:The number of nonlinear inequality constraints is unknown.)r   
ValueErrorr6   s   &r   r   NonlinearConstraints.m_ub  s*     ::L  ::r!   c                L    V P                   f   \        R4      hV P                   # )z
Number of nonlinear equality constraints.

Returns
-------
int
    Number of nonlinear equality constraints.

Raises
------
ValueError
    If the number of nonlinear equality constraints is unknown.
z8The number of nonlinear equality constraints is unknown.)r   r   r6   s   &r   r   NonlinearConstraints.m_eq  s*     ::J  ::r!   c                    \        V P                  4      '       d(   V P                  ^ ,          P                  P                  # ^ # r5   )r   rZ   r   nfevr6   s   &r   r7   NonlinearConstraints.n_eval/  s,     txx==88A;??'''r!   Nc                T    \         P                  ! V P                  WVR7      RR7      # aT  
Evaluate the maximum constraint violation.

Parameters
----------
x : array_like, shape (n,)
    Point at which the maximum constraint violation is evaluated.
cub_val : array_like, shape (m_nonlinear_ub,), optional
    Values of the nonlinear inequality constraints. If not provided,
    the nonlinear inequality constraints are evaluated at `x`.
ceq_val : array_like, shape (m_nonlinear_eq,), optional
    Values of the nonlinear equality constraints. If not provided,
    the nonlinear equality constraints are evaluated at `x`.

Returns
-------
float
    Maximum constraint violation at `x`.
)cub_valceq_valr%   r   r   )r   r0   r   r   s   &&&&r   rg   NonlinearConstraints.maxcv>  s'    ( vvNN1wN?
 	
r!   c                    \         P                  ! V P                   Uu. uF  qDP                  V4      NK  	  up4      # u upi r   )r)   r   rZ   re   )r   r0   r   r   r   s   &&&& r   re   NonlinearConstraints.violationV  s-    ~~B2||ABCCBs   ?)r   r   r   r   r   r   rZ   NN)r=   r@   rA   rB   rC   r   r2   rD   r   r   r7   rg   re   rE   rF   rG   s   @r   r   r   u  sc     ':jX  *  *  
0D Dr!   r   c                   T  a  ] tR tRt o RtR tRR lt]R 4       t]R 4       t	]R 4       t
]R 4       t]R	 4       t]R
 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       tR tRR ltRR ltR tRtV tR# )ProblemiZ  z
Optimization problem.
c           
        V'       Ed   \        V\        4      '       g   Q h\        V\        4      '       g   Q h\        V\        4      '       g   Q h\        V\        4      '       g   Q h\        V\
        4      '       g   Q h\        V\        4      '       g   Q h\        V	\        4      '       g   Q h\        V
\        4      '       g   Q hV	'       d
   V
^ 8  g   Q h\        V\        4      '       g   Q hV^ 8  g   Q h\        V\        4      '       g   Q hWn        W@n	        WPn
        Ve   \        V4      '       g   \        R4      hW`n        \        VR4      pVP                  pVP                   P                  V8w  d   \#        RV R24      hVP$                  P&                  ^,          V8w  d   \#        RV R24      h\)        VP                   VP*                  4      pVP                   VP*                  8*  \,        P.                  ! VP                   VP*                  ,
          4      V8  ,          V n        RVP                   V P0                  ,          VP*                  V P0                  ,          ,           ,          V n        \,        P4                  ! V P2                  VP                   V P0                  ,          VP*                  V P0                  ,          4      V n        W0n        \        \9        VP                   V P0                  ( ,          VP*                  V P0                  ( ,          4      4      V n        V P:                  P=                  W P0                  ( ,          4      V n        VP@                  VPB                  R	V P0                  3,          V P2                  ,          ,
          p\        \E        VP$                  R	V P0                  ( 3,          \,        PF                  ) VPH                  VP$                  R	V P0                  3,          V P2                  ,          ,
          4      \E        VPB                  R	V P0                  ( 3,          W4      .V PJ                  V4      V n	        T;'       d    V P:                  PL                  ;'       d    \,        PN                  ! \,        PP                  ! V P:                  P                   4      4      ;'       d?    \,        PN                  ! \,        PP                  ! V P:                  P*                  4      4      pV'       Ed=   RV P:                  P*                  V P:                  P                   ,
          ,          V n)        RV P:                  P*                  V P:                  P                   ,           ,          V n*        \        \9        \,        PV                  ! V PJ                  4      ) \,        PV                  ! V PJ                  4      4      4      V n        V P                  P@                  V P                  PB                  V PT                  ,          ,
          p\        \E        V P                  P$                  \,        PX                  ! V PR                  4      ,          \,        PF                  ) V P                  PH                  V P                  P$                  V PT                  ,          ,
          4      \E        V P                  PB                  \,        PX                  ! V PR                  4      ,          VV4      .V PJ                  V4      V n	        V P>                  V PT                  ,
          V PR                  ,          V n        MJ\,        PV                  ! V PJ                  4      V n)        \,        PZ                  ! V PJ                  4      V n*        Wpn.        Wn/        . V n0        . V n1        . V n2        Wn3        Wn4        . V n5        . V n6        . V n7        R# )
ai  
Initialize the nonlinear problem.

The problem is preprocessed to remove all the variables that are fixed
by the bound constraints.

Parameters
----------
obj : ObjectiveFunction
    Objective function.
x0 : array_like, shape (n,)
    Initial guess.
bounds : BoundConstraints
    Bound constraints.
linear : LinearConstraints
    Linear constraints.
nonlinear : NonlinearConstraints
    Nonlinear constraints.
callback : {callable, None}
    Callback function.
feasibility_tol : float
    Tolerance on the constraint violation.
scale : bool
    Whether to scale the problem according to the bounds.
store_history : bool
    Whether to store the function evaluations.
history_size : int
    Maximum number of function evaluations to store.
filter_size : int
    Maximum number of points in the filter.
debug : bool
    Whether to make debugging tests during the execution.
Nz)The callback must be a callable function.z#The initial guess must be a vector.zThe bounds must have z
 elements.z@The left-hand side matrices of the linear constraints must have z	 columns.rr   rs   )8r   r   rJ   rp   r   r+   r   int_obj_linear
_nonlinearr   	TypeError	_callbackr   rY   rQ   r   r   shaper   rS   r)   rz   
_fixed_idx
_fixed_valrl   _orig_boundsr   _boundsrm   _x0r   r}   r   rP   r   r   rU   rT   isfinite_scaling_factor_scaling_shiftrX   diagzeros_feasibility_tol_filter_size_fun_filter_maxcv_filter	_x_filter_store_history_history_size_fun_history_maxcv_history
_x_history)r   objr   r[   linear	nonlinearcallbackfeasibility_tolscalestore_historyhistory_sizefilter_sizer   r   tolr   s   &&&&&&&&&&&&&   r   r   Problem.__init___  s   ` 5c#45555f&67777f&78888i)=>>>>ou5555eT****mT2222lC0000#a'''k3////?"?eT****	#H%% KLL! B EFGG99>>Q4QCzBCC;;Q1$s)%  VYY		2!99		1FF699vyy()C/
 IIdoo&4??)CC
 ''OOIIdoo&IIdoo&
 #'699doo-.		4??:J0KL

 <<''OO+;(<= {{V[[DOO);<tNN( KKDOO#3 34VVGKKkk!T__"45GH !Q0@-@!A4N FF
   5 5((5 5r{{4<<??345 5 r{{4<<??34	 	 5#&$,,//DLLOO*K#LD "%4<<??)J"KD+'9DL <<$$t||'8'84;N;N'NND,$))BGGD4H4H,II)),,++d.A.AAB %))BGGD4H4H,II DL" 4#6#66$:N:NNDH#%77466?D "$((466"2D !0' ,) r!   c                z  aa \         P                  ! V\        R7      pV P                  V4      pV P	                  V4      oV P                  V4      w  rEV P                  WV4      oV P                  '       d   V P                  P                  S4       V P                  P                  S4       V P                  P                  V4       \        V P                  4      V P                  8  dR   V P                  P                  ^ 4       V P                  P                  ^ 4       V P                  P                  ^ 4       \         P                  ! S4      '       d7   \         P                  ! S4      '       d   \        V P                   4      ^ 8H  pEM\         P                  ! S4      '       dy   \"        ;QJ d=    V3R l\%        V P                   V P&                  4       4       F  '       d   K   RM2	  RM.! V3R l\%        V P                   V P&                  4       4       4      pEM\         P                  ! S4      '       dx   \"        ;QJ d=    V3R l\%        V P                   V P&                  4       4       F  '       d   K   RM2	  RM.! V3R l\%        V P                   V P&                  4       4       4      pMx\"        ;QJ d>    VV3R l\%        V P                   V P&                  4       4       F  '       d   K   RM3	  RM/! VV3R l\%        V P                   V P&                  4       4       4      pV'       Edm   V P                   P                  S4       V P&                  P                  S4       V P(                  P                  V4       \+        \        V P                   4      ^,
          RR4       EFz  p\         P                  ! S4      '       d)   \         P                  ! V P                   V,          4      pM\         P                  ! S4      '       d)   \         P                  ! V P&                  V,          4      pM\         P                  ! V P                   V,          4      ;'       gd    \         P                  ! V P&                  V,          4      ;'       g5    SV P                   V,          8*  ;'       d    SV P&                  V,          8*  pV'       g   EK)  V P                   P                  V4       V P&                  P                  V4       V P(                  P                  V4       EK}  	  \        V P                   4      V P,                  8  dR   V P                   P                  ^ 4       V P&                  P                  ^ 4       V P(                  P                  ^ 4       V P.                  e   \1        V P.                  4      p	 V P3                  V4      w  rpV P                  V
4      p
\5        V	P6                  4      R08X  d!   \9        V
VR	7      pV P/                  VR
7       MV P/                  V
4        \         P                  ! S4      '       d   \>        o\>        V\         P                  ! V4      &   \>        V\         P                  ! V4      &   \A        \C        S\>        4      \>        ) 4      o\         PD                  ! \         PF                  ! V\>        4      \>        ) 4      p\         PD                  ! \         PF                  ! V\>        4      \>        ) 4      pSWE3#   \:         d   p\<        ThRp?ii ; i)at  
Evaluate the objective and nonlinear constraint functions.

Parameters
----------
x : array_like, shape (n,)
    Point at which the functions are evaluated.
penalty : float, optional
    Penalty parameter used to select the point in the filter to forward
    to the callback function.

Returns
-------
float
    Objective function value.
`numpy.ndarray`, shape (m_nonlinear_ub,)
    Nonlinear inequality constraint function values.
`numpy.ndarray`, shape (m_nonlinear_eq,)
    Nonlinear equality constraint function values.

Raises
------
`cobyqa.utils.CallbackSuccess`
    If the callback function raises a ``StopIteration``.
r#   c              3      <"   T FH  w  r\         P                  ! V4      ;'       d    SV8  ;'       g    \         P                  ! V4      x  KJ  	  R # 5ir   r)   rR   ).0
fun_filtermaxcv_filter	maxcv_vals   &  r   	<genexpr>#Problem.__call__.<locals>.<genexpr>7  sU       1,J $ - -,* *88L)*1   #AAAFTc              3      <"   T FH  w  r\         P                  ! V4      ;'       d    SV8  ;'       g    \         P                  ! V4      x  KJ  	  R # 5ir   r  )r  r  r  fun_vals   &  r   r  r  A  sU       1,J & ) )j(( (88J'(1r  c              3   L   <"   T F  w  rSV8  ;'       g    SV8  x  K  	  R # 5ir   r(   )r  r  r  r  r  s   &  r   r  r  K  s4       1,J *$@@	L(@@1s   $$Nintermediate_result)r0   r   )r  )$r)   rd   r+   build_xr   r   rg   r   r   r   r   r   r   r   poprR   r   rT   zipr   r   ranger   r   r   	best_evalset
parametersr   StopIterationr   r   r   minmaximumminimum)r   r0   penaltyx_fullr   r   include_pointkremove_pointsigx_bestfun_best_r  excr  r  s   &&&            @@r   r2   Problem.__call__
  sN   6 JJq&a))F#??62JJq73	$$W-&&y1OO""1%4$$%(:(::!!%%a(##''*##A& 88G)!4!4 0 01Q6MXXgC   14$$&&1	 CCC   14$$&&1	  M XXi  C   14$$&&1	 CCC   14$$&&1	  M  C  03$$&&1 CCC  03$$&&1  M =##G,%%i0NN!!!$
 3t//014b"=88G$$#%88D,<,<Q,?#@LXXi((#%88D,>,>q,A#BL !1!1!!45 ? ?88D$6$6q$9:? ?"d&6&6q&99 ? ?%););A)>>	 !  <$$((+&&**1-NN&&q) >$ 4##$t'8'88  $$Q'""&&q)""1% >>%DNN+C/&*nnW&=#!f-s~~&+@*AA*8 $+'
 NN7JNKNN6*
 88GG%,!"%,!"c'7+gX6**RZZ9G8D**RZZ9G8D(( ! /%3./s   A\# (\# #\:.\55\:c                .    V P                   P                  # )zD
Number of variables.

Returns
-------
int
    Number of variables.
)r   rY   r6   s   &r   r   	Problem.n  s     ww||r!   c                .    V P                   P                  # )z
Number of variables in the original problem (with fixed variables).

Returns
-------
int
    Number of variables in the original problem (with fixed variables).
)r   rY   r6   s   &r   n_origProblem.n_orig  s     ###r!   c                    V P                   # )zP
Initial guess.

Returns
-------
`numpy.ndarray`, shape (n,)
    Initial guess.
)r   r6   s   &r   r   
Problem.x0  r_   r!   c                .    V P                   P                  # r5   )r   r7   r6   s   &r   r7   Problem.n_eval  s     yyr!   c                .    V P                   P                  # )r;   )r   r/   r6   s   &r   r   Problem.fun_name  r   r!   c                    V P                   # )zM
Bound constraints.

Returns
-------
BoundConstraints
    Bound constraints.
)r   r6   s   &r   r[   Problem.bounds  r9   r!   c                    V P                   # )zP
Linear constraints.

Returns
-------
LinearConstraints
    Linear constraints.
)r   r6   s   &r   r   Problem.linear  r9   r!   c                .    V P                   P                  # )zT
Number of bound constraints.

Returns
-------
int
    Number of bound constraints.
)r[   rW   r6   s   &r   m_boundsProblem.m_bounds  s     {{}}r!   c                .    V P                   P                  # r   )r   r   r6   s   &r   m_linear_ubProblem.m_linear_ub       {{r!   c                .    V P                   P                  # r   )r   r   r6   s   &r   m_linear_eqProblem.m_linear_eq  rD  r!   c                .    V P                   P                  # )z
Number of nonlinear inequality constraints.

Returns
-------
int
    Number of nonlinear inequality constraints.

Raises
------
ValueError
    If the number of nonlinear inequality constraints is not known.
)r   r   r6   s   &r   m_nonlinear_ubProblem.m_nonlinear_ub       ###r!   c                .    V P                   P                  # )z
Number of nonlinear equality constraints.

Returns
-------
int
    Number of nonlinear equality constraints.

Raises
------
ValueError
    If the number of nonlinear equality constraints is not known.
)r   r   r6   s   &r   m_nonlinear_eqProblem.m_nonlinear_eq  rK  r!   c                N    \         P                  ! V P                  \        R7      # )z
History of objective function evaluations.

Returns
-------
`numpy.ndarray`, shape (n_eval,)
    History of objective function evaluations.
r#   )r)   r*   r   r+   r6   s   &r   fun_historyProblem.fun_history(  s     xx))77r!   c                N    \         P                  ! V P                  \        R7      # )z
History of maximum constraint violations.

Returns
-------
`numpy.ndarray`, shape (n_eval,)
    History of maximum constraint violations.
r#   )r)   r*   r   r+   r6   s   &r   maxcv_historyProblem.maxcv_history4  s     xx++599r!   c                     V P                   ^ 8  g   V P                  ^ 8  d   R# V P                  ^ 8  g   V P                  ^ 8  d   R# V P                  ^ 8  d   R# R#   \
         d     R# i ; i)z
Type of the problem.

The problem can be either 'unconstrained', 'bound-constrained',
'linearly constrained', or 'nonlinearly constrained'.

Returns
-------
str
    Type of the problem.
znonlinearly constrainedzlinearly constrainedzbound-constrainedunconstrained)rI  rM  rB  rF  r?  r   r6   s   &r   typeProblem.type@  si    	-""Q&$*=*=*A0!!A%)9)9A)=-"*& 	- -	-s   "A "A 
A A.-A.c                     V P                   R8H  # )zw
Whether the problem is a feasibility problem.

Returns
-------
bool
    Whether the problem is a feasibility problem.
r<   )r   r6   s   &r   is_feasibilityProblem.is_feasibility^  s     }}""r!   c                   \         P                  ! V P                  4      pV P                  W P                  &   WP
                  ,          V P                  ,           W P                  ( &   V P                  P                  V4      # )z
Build the full vector of variables from the reduced vector.

Parameters
----------
x : array_like, shape (n,)
    Reduced vector of variables.

Returns
-------
`numpy.ndarray`, shape (n_orig,)
    Full vector of variables.
)	r)   ru   r2  r   r   r   r   r   rm   )r   r0   r%  s   && r   r  Problem.build_xj  sc     $++&"&//$%(<(<$<&*&9&9%:   ((00r!   Nc                    V P                  WVR7      p\        P                  ! V4      '       d   \        P                  ! VRR7      # R# r   )re   r)   rV   r   )r   r0   r   r   re   s   &&&& r   rg   Problem.maxcv~  s;    ( NN1wNG	I&&66)S11r!   c                .   . pV P                   P                  '       g-   V P                   P                  V4      pVP                  V4       \	        V P
                  P                  4      '       d-   V P
                  P                  V4      pVP                  V4       \	        V P                  P                  4      '       d.   V P                  P                  WV4      pVP                  V4       \	        V4      '       d   \        P                  ! V4      # R # r   )
r[   rU   re   r   r   r   rZ   r   r)   r   )r   r0   r   r   re   blcnlcs   &&&&    r   re   Problem.violation  s    	{{&&&%%a(AQt{{&&q)BR t""##//++A@CS!y>>>>),, r!   c                   \        V P                  4      ^ 8X  d   V ! V P                  4       \        P                  ! V P                  4      p\        P                  ! V P
                  4      p\        P                  ! V P                  4      p\        P                  ! V4      p\        P                  ! V4      '       Ed   W0P                  8*  p\        P                  ! V4      '       d   \        P                  ! \        P                  ! W&,          4      4      '       g   VV\        P                  ! W&,          4      8*  ,          p\        P                  ! V4      ^8  d&   Ws\        P                  ! W7,          4      8*  ,          p\        P                  ! V4      R,          pEM\        P                  ! V4      '       d    \        P                  ! V4      R,          pEM\        P                   ! V\        P"                  4      p	W%,          WV,          ,          ,           W&   \        P                  ! \        P                  ! V	4      4      '       d9   V\        P                  ! V4      8*  p
\        P                  ! V
4      R,          pEM0V	\        P                  ! V	4      8*  p\        P                  ! V4      ^8  d&   W\        P                  ! W;,          4      8*  ,          p\        P                  ! V4      ^8  d&   W\        P                  ! W+,          4      8*  ,          p\        P                  ! V4      R,          pMy\        P                  ! \        P                  ! V4      4      '       g8   V\        P                  ! V4      8*  p\        P                  ! V4      R,          pM\        V4      ^,
          pV P$                  P'                  WHR3,          4      W(,          W8,          3# )aV  
Return the best point in the filter and the corresponding objective and
nonlinear constraint function evaluations.

Parameters
----------
penalty : float
    Penalty parameter

Returns
-------
`numpy.ndarray`, shape (n,)
    Best point.
float
    Corresponding objective function value.
float
    Corresponding maximum constraint violation.
rs   r  )r   r   r   r)   r*   r   r   r   r{   r   rT   rR   nanminrV   r!  flatnonzero	full_likenanr[   rm   )r   r$  r  r  x_filter
finite_idxfeasible_idxfun_min_idxr   merit_filtermin_maxcv_idxmerit_min_idxs   &&          r   r  Problem.best_eval  s   , t A%M XXd../
xx 2 2388DNN+[[.
66*'+@+@@Lvvl##BFF12- - +"))J,D"EE ##K014266$14 $ K NN;/3%% NN<04  "||J?*WJ7O-OO ( 66"((<011 %1BIIl4K$KM}5b9A %1BIIl4K$KM''6:%(7: *  ''6:%rvv&58 *  }5b9A,--
 %		*(==K{+B/A J!#AKKA/MO
 	
r!   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r=   r@   rA   rB   rC   r   r2   rD   r   r2  r   r7   r   r[   r   r?  rB  rF  rI  rM  rP  rS  rW  rZ  r  rg   re   r  rE   rF   rG   s   @r   r   r   Z  ss    iVB)H 	 	 	$ 	$ 	 	 	  	  	 	 	 	 	 	 	 	 	  	  	  	  $ $  $ $  	8 	8 	: 	: - -: 	# 	#1(4- h
 h
r!   r   )
contextlibr   inspectr   r   numpyr)   scipy.optimizer   r   r   r   scipy.optimize._constraintsr	   settingsr
   r   utilsr   r   r   r   rJ   rp   r   r   r(   r!   r   <module>ry     so         ; - 2 !W Wt]G ]G@d dNbD bDJv

 v

r!   