+
    /in                     $   ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	H
t
 ^ RIt^ RIHtHt ^ RIHtHtHtHtHtHtHtHtHt ^ RIHt ^ RIHt ^ RIHt  ! R	 R
4      tR t  ! R R]4      t!]!! RERE.^ ^ .R7      t"]!! RFRF.^ ^ .R7      t#]!! RGRG.^ ^ .R7      t$ ! R R]4      t%]%! RH.R.RI]PL                  ! R.R.R.R.R.R.R.R.R.R..
4      ]PL                  ! . RJO4      R7      t']%! RK.R.RI.]PL                  ! R..4      ]PL                  ! RI.4      R7      t( ! R R]4      t)])! RLRM.RNRO.RR 7      t* ! R! R"]4      t+]+! RP.^,          . RQOR#R 7      t, ! R$ R%]4      t-]-! RRRR.RS.R&R'.R(7      t. ! R) R*]4      t/^t0]1! ]2! RT.^,          R+.^,          4      4      t3]/! ]3RU.RR(7      t4 ! R, R-]4      t5]5! RV.^,          R.]Pl                  ! ^4      R,
          R(7      t7 ! R/ R0]4      t8]8! RPRP.^2.R1R1.R(7      t9 ! R2 R3]4      t:]:! RLRW.RRR(7      t;]Px                  P{                  R44      RXR5 l4       t> ! R6 R74      t? ! R8 R94      t@ ! R: R;4      tA ! R< R=4      tB ! R> R?4      tCR@ tD]Px                  P                  RA4      RB 4       tFRC tGRD tHR# )Y    N)Pool)assert_allcloseIS_PYPY)raiseswarns)	shgoBoundsminimize_scalarminimizerosen	rosen_der
rosen_hessNonlinearConstraintOptimizeWarning)new_constraint_to_old)SHGO)MaratosTestArgsc                   *   a  ] tR t^t o RR ltRtV tR# )StructTestFunctionNc                B    Wn         W n        W0n        W@n        WPn        R # Nbounds
expected_xexpected_funexpected_xlexpected_funl)selfr   r   r   r   r   s   &&&&&&]/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/optimize/tests/test__shgo.py__init__StructTestFunction.__init__   s    $(&*    )r   r   r   r   r   )NNN)__name__
__module____qualname____firstlineno__r    __static_attributes____classdictcell____classdict__s   @r   r   r      s     + +r"   r   c                     . pV eR   \        V \        \        ,          4      '       g   V 3p M V  F  p VP                  RRRV /4       K  	  \        V4      pV# R pV# )Ntypeineqfun)
isinstancetuplelistappend)gconss   & r   wrap_constraintsr5      si    D}!UT\**AAKK# $  T{ K Kr"   c                   <   a  ] tR t^,t o R tR t]! ]4      tRtV t	R# )StructTest1c                L    V^ ,          ^,          V^,          ^,          ,           # r    r   xs   &&r   fStructTest1.f-       tqy1Q419$$r"   c                B    \         P                  ! V ^ R7      R,
          ) # )r   axisg      @npsumr<   s   &r   r3   StructTest1.g0   s    "S())r"   r:   N
r#   r$   r%   r&   r=   r3   r5   r4   r'   r(   r)   s   @r   r7   r7   ,   s     %* ADr"   r7   )r   r   c                   @   a  ] tR t^>t o RtR tR t]! ]4      tRt	V t
R# )StructTest2zF
Scalar function with several minima to test all minimiser retrievals
c                J    V^,
          \         P                  ! V4      ,          # )   )rD   sinr;   s   &&r   r=   StructTest2.fC   s    B"&&)##r"   c                @    ^:\         P                  ! V ^ R7      ,
          # ):   rA   rC   rF   s   &r   r3   StructTest2.gF   s    BFF11%%%r"   r:   Nr#   r$   r%   r&   __doc__r=   r3   r5   r4   r'   r(   r)   s   @r   rJ   rJ   >   s      $& ADr"   rJ   g⡽4$?g GK@g
]<@gI{_H@gi<&,@g>E@gqŤCQ4@g8$B@go.n:@g^5	>@r   c                   j   a  ] tR t^kt o RtR tR tR tR t]	! ]^ ]
P                  4      t]3tRtV tR# )StructTest3ah  
Hock and Schittkowski 18 problem (HS18). Hoch and Schittkowski (1981)
http://www.ai7.uni-bayreuth.de/test_problem_coll.pdf
Minimize: f = 0.01 * (x_1)**2 + (x_2)**2

Subject to: x_1 * x_2 - 25.0 >= 0,
            (x_1)**2 + (x_2)**2 - 25.0 >= 0,
            2 <= x_1 <= 50,
            0 <= x_2 <= 50.

Approx. Answer:
    f([(250)**0.5 , (2.5)**0.5]) = 5.0


c                Z    R V^ ,          ^,          ,          V^,          ^,          ,           # )g{Gz?r:   r;   s   &&r   r=   StructTest3.f}   s"    qtk!QqTaK//r"   c                >    V ^ ,          V ^,          ,          R,
          # r   g      9@r:   rF   s   &r   g1StructTest3.g1   s    tad{T!!r"   c                Z    V ^ ,          ^,          V ^,          ^,          ,           R,
          # rY   r:   rF   s   &r   g2StructTest3.g2   s"    tqy1Q419$t++r"   c                    V ^ ,          V ^,          ,          R,
          V ^ ,          ^,          V ^,          ^,          ,           R,
          3# rY   r:   rF   s   &r   r3   StructTest3.g   s8    tad{T!1Q419qtqy#84#???r"   r:   N)r#   r$   r%   r&   rS   r=   rZ   r]   r3   r   rD   inf_StructTest3__nlcr4   r'   r(   r)   s   @r   rU   rU   k   s:     "0",@  1bff-E8Dr"   rU         ?      @)r   r   r   c                   ^   a  ] tR t^t o RtR tR tR tR tR t	]]]]	3t
]! ]
4      tRtV tR# )	StructTest4z
Hock and Schittkowski 11 problem (HS11). Hoch and Schittkowski (1981)

NOTE: Did not find in original reference to HS collection, refer to
      Henderson (2015) problem 7 instead. 02.03.2016
c                   V^ ,          ^
,
          ^,          ^V^,          ^,
          ^,          ,          ,           V^,          ^,          ,           ^V^,          ^,
          ^,          ,          ,           ^
V^,          ^,          ,          ,           ^V^,          ^,          ,          ,           V^,          ^,          ,           ^V^,          ,          V^,          ,          ,
          ^
V^,          ,          ,
          ^V^,          ,          ,
          # r9   r:   r;   s   &&r   r=   StructTest4.f   s    1q 1!r	a'7#77!A$!)CqtbyQ&&')+adai8:;adai-HJKKK ad(QqT/" %'1I. 12AaD9 	r"   c                    ^V ^ ,          ^,          ,          ^V ^,          ^,          ,          ,           V ^,          ,           ^V ^,          ^,          ,          ,           ^V ^,          ,          ,           ^,
          ) #    r:   rF   s   &r   rZ   StructTest4.g1   s^    QqTQYQqTQY.15AaDAIEqt8!" # 	#r"   c                    ^V ^ ,          ,          ^V ^,          ,          ,           ^
V ^,          ^,          ,          ,           V ^,          ,           V ^,          ,
          R,
          ) # )   g     q@r:   rF   s   &r   r]   StructTest4.g2   sH    QqTA!H$rAaDAI~5!<qtCeKLLr"   c                    ^V ^ ,          ,          V ^,          ^,          ,           ^V ^,          ^,          ,          ,           ^V ^,          ,          ,
          ^,
          ) # )   r:   rF   s   &r   g3StructTest4.g3   sC    adQqTQY&QqTQY6QqTACGHHr"   c                .   ^V ^ ,          ^,          ,          V ^,          ^,          ,           ^V ^ ,          ,          V ^,          ,          ,
          ^V ^,          ^,          ,          ,           ^V ^,          ,          ,           ^V ^,          ,          ,
          ) # )   r:   rF   s   &r   g4StructTest4.g4   sn    QqTQY1*Q1X!_<q1Q419}Lqt8 1Q4i( ) 	)r"   r:   Nr#   r$   r%   r&   rS   r=   rZ   r]   rr   rv   r3   r5   r4   r'   r(   r)   s   @r   rf   rf      s?     #MI) 
RRAADr"   rf   gP{[
E@c                   :   a  ] tR t^t o R tRt]! ]4      tRtV t	R# )StructTest5c                   V^,          R,           ) \         P                  ! \         P                  ! \        V^ ,          R,          V^,          R,           ,           4      4      4      ,          V^ ,          \         P                  ! \         P                  ! \        V^ ,          V^,          R,           ,
          4      4      4      ,          ,
          #    g     G@       @rD   rM   sqrtabsr;   s   &&r   r=   StructTest5.f   s~    dTkN266"''#ad3h!A$+.F*G"HIId266"''#adadTk&:";<==>	
r"   Nr:   rH   r)   s   @r   rz   rz      s     
 	AADr"   rz   g      @gyCy@)r   r   r   c                   >   a  ] tR t^t o RtR tRt]! ]4      tRt	V t
R# )StructTestLJzN
LennardJones objective function. Used to test symmetry constraints
settings.
c                j   \        R V 24       V^ ,          V n        \        V P                  ^,          4      pRp\        V^,
          4       F  p\        V^,           V4       F  p^V,          p^V,          pW,          W,          ,
          p	W^,           ,          W^,           ,          ,
          p
W^,           ,          W^,           ,          ,
          pW,          W,          ,           W,          ,           pW,          V,          pVR8  g   K  VRV,          R,
          V,          ,          pK  	  K  	  V# )zx =               ?r~   )printNintrange)r   r<   argsksijabxdydzdeduds   &&*           r   r=   StructTestLJ.f   s    QCja
Oq1uA1q5!_EETAD[1uXa%(1uXa%(Wrw&0Wr\8#(S.B..A %  r"   N)r   rR   r)   s   @r   r   r      s      
( 	AADr"   r         @c                   :   a  ] tR t^t o R tRt]! ]4      tRtV t	R# )StructTestSc                    V^ ,          R,
          ^,          V^,          R,
          ^,          ,           V^,          R,
          ^,          ,           V^,          R,
          ^,          ,           # )r   rc   r:   r;   s   &&r   r=   StructTestS.f   sS    1!QqTCZA$55Q4#:!#$'(tcza&78 	9r"   Nr:   rH   r)   s   @r   r   r      s     9 	AADr"   r   r   c                   :   a  ] tR tRt o R tRt]! ]4      tRtV t	R# )StructTestTablei  c                B    V^ ,          R8X  d   V^,          R8X  d   ^2# ^d# )r         @r:   r;   s   &&r   r=   StructTestTable.f  s    Q43;1Q43;r"   Nr:   rH   r)   s   @r   r   r     s      	AADr"   r   r   c                   ^   a  ] tR tRt o RtR tR tR tR tR t	]]]]	3t
]! ]
4      tRtV tR	# )
StructTestInfeasiblei  z(
Test function with no feasible domain.
c                L    V^ ,          ^,          V^,          ^,          ,           # r9   r:   )r   r<   r   s   &&*r   r=   StructTestInfeasible.f   r?   r"   c                >    V ^ ,          V ^,          ,           ^,
          # r9   r:   rF   s   &r   rZ   StructTestInfeasible.g1#  s    tad{Qr"   c                @    V ^ ,          V ^,          ,           ^,
          ) # r9   r:   rF   s   &r   r]   StructTestInfeasible.g2&  s    1!q!!r"   c                @    V ^ ,          ) V ^,          ,           ^,
          # r9   r:   rF   s   &r   rr   StructTestInfeasible.g3)  s    !uqt|ar"   c                B    V ^ ,          ) V ^,          ,           ^,
          ) # r9   r:   rF   s   &r   rv   StructTestInfeasible.g4,  s    A$1!""r"   r:   Nrx   r)   s   @r   r   r     s=     %" # 
RRAADr"   r   
Not a testc
                    \        V P                  V P                  WP                  W4VWgWR 7      p
\	        RV
 24       \
        P                  ! RV
 24       V P                  e8   \        P                  P                  V
P                  V P                  VVR7       V P                  e7   \        P                  P                  V
P                  V P                  VR7       V P                  e7   \        P                  P                  V
P                  V P                  VR7       V P                   e7   \        P                  P                  V
P"                  V P                   VR7       R# ))	r   constraintsniterscallbackminimizer_kwargsoptionssampling_methodworkerszres = Nrtolatolr   )r   r=   r   r4   r   logginginfor   rD   testingr   r<   r   r.   r   xlr   funl)testr   	test_atolr   r   r   r   r   r   r   ress   &&&&&&&&&& r   run_testr   9  s+    tvvt{{99( 0.AC
 
F3%.LL6# "


""355$//(1(1 	# 	3
 $


""377#'#4#4(1 	# 	3 #


""366#'#3#3(1 	# 	3 %


""388#'#5#5(1 	# 	3 r"   c                      a  ] tR tRt o RtR tR tR tR tR t	R t
]P                  P                  R	 4       tR
 tR tRtV tR# )TestShgoSobolTestFunctionsi\  z0
Global optimisation tests with Sobol sampling:
c                $    \        \        4       R# )NMultivariate test function 1:
x[0]**2 + x[1]**2 with bounds=[(-1, 6), (-1, 6)]Nr   test1_1r   s   &r   test_f1_1_sobol*TestShgoSobolTestFunctions.test_f1_1_sobolb       	r"   c                $    \        \        4       R# )LMultivariate test function 1:
x[0]**2 + x[1]**2 with bounds=[(0, 1), (0, 1)]Nr   test1_2r   s   &r   test_f1_2_sobol*TestShgoSobolTestFunctions.test_f1_2_sobolg  r   r"   c                0    RR/p\        \        VR7       R# )zWMultivariate test function 1:
x[0]**2 + x[1]**2 with bounds=[(None, None),(None, None)]dispT)r   Nr   test1_3r   r   s   & r   test_f1_3_sobol*TestShgoSobolTestFunctions.test_f1_3_soboll  s     4.'*r"   c                $    \        \        4       R# )JUnivariate test function on
f(x) = (x - 30) * sin(x) with bounds=[(0, 60)]Nr   test2_1r   s   &r   test_f2_1_sobol*TestShgoSobolTestFunctions.test_f2_1_sobolr  r   r"   c                $    \        \        4       R# )FUnivariate test function on
f(x) = (x - 30) * sin(x) bounds=[(0, 4.5)]Nr   test2_2r   s   &r   test_f2_2_sobol*TestShgoSobolTestFunctions.test_f2_2_sobolw  r   r"   c                $    \        \        4       R# )%NLP: Hock and Schittkowski problem 18Nr   test3_1r   s   &r   test_f3_sobol(TestShgoSobolTestFunctions.test_f3_sobol|  s
    r"   c                2    RR/p\        \        RVR7       R# )?NLP: (High dimensional) Hock and Schittkowski 11 problem (HS11)infty_constraintsFr   r   Ni  r   test4_1r   s   & r   test_f4_sobol(TestShgoSobolTestFunctions.test_f4_sobol  s     '.GW5r"   c                (    \        \        ^<R7       R# )NLP: Eggholder, multimodal)r   Nr   test5_1r   s   &r   test_f5_1_sobol*TestShgoSobolTestFunctions.test_f5_1_sobol  s     	Br"   c                *    \        \        ^<^R7       R# )r   )r   r   Nr   r   s   &r   test_f5_2_sobol*TestShgoSobolTestFunctions.test_f5_2_sobol  s     	Ba(r"   r:   N)r#   r$   r%   r&   rS   r   r   r   r   r   r   pytestmarkslowr   r   r   r'   r(   r)   s   @r   r   r   \  sU     


+

 [[6 6 
) )r"   r   c                   X  a  ] tR tRt o RtR tR tR tR tR t	R t
]P                  P                  R	 4       tR
 tR tR t]P                  P%                  ^
4      R 4       t]P                  P)                  R4      R 4       t]P                  P)                  R4      R 4       tRtV tR# )TestShgoSimplicialTestFunctionsi  z5
Global optimisation tests with Simplicial sampling:
c                *    \        \        ^RR7       R# )r   
simplicialr   r   Nr   r   s   &r   test_f1_1_simplicial4TestShgoSimplicialTestFunctions.test_f1_1_simplicial       	A|<r"   c                *    \        \        ^RR7       R# )r   r  r  Nr   r   s   &r   test_f1_2_simplicial4TestShgoSimplicialTestFunctions.test_f1_2_simplicial  r
  r"   c                *    \        \        ^RR7       R# )zWMultivariate test function 1: x[0]**2 + x[1]**2
with bounds=[(None, None),(None, None)]r  r  Nr   r   s   &r   test_f1_3_simplicial4TestShgoSimplicialTestFunctions.test_f1_3_simplicial  r
  r"   c                6    RR/p\        \        ^^VRR7       R# )r   minimize_every_iterFr  r   r   r   r   Nr   r   s   & r   test_f2_1_simplicial4TestShgoSimplicialTestFunctions.test_f2_1_simplicial  s!     )%0Cq'!-	/r"   c                *    \        \        ^RR7       R# )r   r  r  Nr   r   s   &r   test_f2_2_simplicial4TestShgoSimplicialTestFunctions.test_f2_2_simplicial  r
  r"   c                *    \        \        ^RR7       R# )r   r  r  Nr   r   s   &r   test_f3_simplicial2TestShgoSimplicialTestFunctions.test_f3_simplicial  s    A|<r"   c                *    \        \        ^RR7       R# )r   r  r  Nr   r   s   &r   test_f4_simplicial2TestShgoSimplicialTestFunctions.test_f4_simplicial  r
  r"   c           	     @    RRRR/pRp\        \        VRV^RR7       R# )	z&LJ: Symmetry-constrained test functionsymmetryTr   ,  r  r   r   r   r   r   N   r   testLJr   r   r   s   &  r   test_lj_symmetry_old4TestShgoSimplicialTestFunctions.test_lj_symmetry_old  s.    t4!dc !-	/r"   c           	     P    R^ .^,          RR/pRp\        \        VRV^RR7       R# )	z&LJ: Symmetry constrained test functionr   r   Tr!  r  r"  Nr#  r%  r'  s   &  r   test_f5_1_lj_symmetry5TestShgoSimplicialTestFunctions.test_f5_1_lj_symmetry  s4    uqy4!dc !-	/r"   c                >    R^ ^ .RR/p\        \        ^V^RR7       R# )z"Symmetry constrained test functionr   r   Tr  r   r   r   r   Nr   r   s   & r   test_f5_2_cons_symmetry7TestShgoSimplicialTestFunctions.test_f5_2_cons_symmetry  s-    1v4! 	C !-	/r"   c                >    R. RORR/p\        \        RV^RR7       R# )	z(Asymmetrically constrained test functionr   r   Ti'  r  r.  N)r   r   r      )r   test_sr   s   & r   test_f5_3_cons_symmetry7TestShgoSimplicialTestFunctions.test_f5_3_cons_symmetry  s,     |4! 	5 !-	/r"   r   c                   a RoRRRV3R l/p\        \        P                  ^R
.,          VR7      pVP                  '       g   Q h\	        VP
                  ^ RR7       \	        VP                  R4       R	# )zCReturn a minimum on a perfectly symmetric problem, based on
gh10429rc   r,   eqr.   c                 >   < \         P                  ! V 4      S,
          # r   )rD   mean)r<   avgs   &r   <lambda>FTestShgoSimplicialTestFunctions.test_f0_min_variance.<locals>.<lambda>  s    rwwqzC/?r"   r   r   V瞯<r   Nr   r}   )r   rD   varsuccessr   r.   r<   )r   r4   r   r:  s   &  @r   test_f0_min_variance4TestShgoSimplicialTestFunctions.test_f0_min_variance  s_     e%?@ 266!vh,DA{{{{/s#r"   c                    R pR.p\        WR7      p\        W^ ,          R7      pVP                  '       g   Q h\        VP                  VP                  4       \        VP
                  VP
                  RR7       R# )zFReturn a minimum on a perfectly symmetric 1D problem, based on
gh10538c                 <    W R ,
          ,          V R,
          ,          # )r   rc   r:   rF   s   &r   r.   DTestShgoSimplicialTestFunctions.test_f0_min_variance_1D.<locals>.fun  s    C=AG,,r"   )r   ư>)r   Nr?  )r   r
   rA  r   r.   r<   )r   r.   r   r   refs   &    r   test_f0_min_variance_1D7TestShgoSimplicialTestFunctions.test_f0_min_variance_1D  s\    
	- 3&c)4{{{{)suu40r"   r:   N)r#   r$   r%   r&   rS   r  r  r  r  r  r  r   r  r  r  r(  r+  r/  	fail_slowr4  skiprB  rI  r'   r(   r)   s   @r   r  r    s     =
=
=
/=
= [[= =/// [[2/ / [[l#
$ $
$ [[l#1 $1r"   r  c                     a  ] tR tRt o R tR tR tR tR tR t	R t
R	 t]P                  P                  R
 4       t]P                  P                  R 4       tR tR tR tR tR tR tR tR tR tR t]P                  P7                  ];'       d    ]P<                  R8H  RR7      R 4       tR t ]P                  PC                  RR7      R 4       t"R t#R t$R t%R  t&R! t'R" t(]P                  PS                  ^
4      R# 4       t*R$ t+R% t,]P                  P[                  R&. R,O4      R' 4       t.R( t/R) t0R*t1V t2R+# )-TestShgoArgumentsi  c                ,    \        \        R^RR7       R# )z>Iterative simplicial sampling on TestFunction 1 (multivariate)Nr  r   r   r   r   r   s   &r   test_1_1_simpl_iter%TestShgoArguments.test_1_1_simpl_iter  s    D<Hr"   c                6    RR/p\        \        R^	VRR7       R# )z3Iterative simplicial on TestFunction 2 (univariate)r  FNr  r  r   r   s   & r   test_1_2_simpl_iter%TestShgoArguments.test_1_2_simpl_iter  s    (%0D7!-	/r"   c                ,    \        \        R^RR7       R# )z9Iterative Sobol sampling on TestFunction 1 (multivariate)NsobolrP  r   r   s   &r   test_2_1_sobol_iter%TestShgoArguments.test_2_1_sobol_iter  s    D7Cr"   c           	     f   \        \        P                  \        P                  \        P                  R^RR7      p\
        P                  P                  VP                  \        P                  RRR7       \
        P                  P                  VP                  \        P                  RR7       R# )z7Iterative Sobol sampling on TestFunction 2 (univariate)NrW  )r   r   r   r   h㈵>r   r   )r   r   r=   r   r4   rD   r   r   r<   r   r.   r   r   r   s   & r   test_2_2_sobol_iter%TestShgoArguments.test_2_2_sobol_iter  so    799gnn',,G= 	

""355'*<*<4d"S


""377G,@,@t"Lr"   c           
         R p\         \        3 FQ  p\        VP                  VP                  ^RVRR/R7       \        VP                  VP                  ^RVRR/R7       KS  	  R# )zKIterative sampling on TestFunction 1 and 2  (multi and univariate)
        c                     \        R 4       R# z Local minimization callback testNr   rF   s   &r   callback_funcATestShgoArguments.test_3_1_disp_simplicial.<locals>.callback_func      45r"   r  r   Tr   r   r   r   r   r   r   r   Nr   r   r   r=   r   r   rc  r   s   &  r   test_3_1_disp_simplicial*TestShgoArguments.test_3_1_disp_simplicial  s_    	6 g&DA!-'&$A <'&$A	 'r"   c           
         R p\         \        3 FQ  p\        VP                  VP                  ^RVRR/R7       \        VP                  VP                  ^RVRR/R7       KS  	  R# )	zAIterative sampling on TestFunction 1 and 2 (multi and univariate)c                     \        R 4       R# ra  rb  rF   s   &r   rc  <TestShgoArguments.test_3_2_disp_sobol.<locals>.callback_func+  re  r"   rW  r   Trf  r  rg  Nrh  ri  s   &  r   test_3_2_disp_sobol%TestShgoArguments.test_3_2_disp_sobol(  s^    	6 g&DAw'&$A <'&$A	 'r"   c                    \        R R.RR7      p\        R R.R7      p\        VP                  VP                  4       \        VP                  VP                  4       R# )zEUsing `args` used to cause `shgo` to fail; see #14589, #15986,
#16506c                      W,          V,           # r   r:   )r<   yzs   &&&r   r;  5TestShgoArguments.test_args_gh14589.<locals>.<lambda>8  s
    	r"   )funcr   r   c                 "    ^V ,          ^,           # rj   r:   rF   s   &r   r;  ru  :  s    !a%!)r"   )rv  r   N)r   r2  )r}   rk   )r   r   r.   r<   )r   r   rH  s   &  r   test_args_gh14589#TestShgoArguments.test_args_gh145895  sJ     16( +VH=)suu%r"   c                   \        R^4      p\        RR.^^.4      Vn        \        VP                  RR.VP
                  VP                  RRVP                  R7      p\        VP                  VP                  RR7       \        R^4      p\        RR.RR.4      Vn        \        P                  ! 4       ;_uu_ 4        \        P                  ! R\        \        34       \        VP                  VP                  RR	RR
VP
                  RVP                  RVP                  RR/VP
                  RR7      p\        VP                  VP                  RR7       \        VP                  VP                  RR	RR
VP
                  RVP                  RVP                  RVP                   /VP
                  RR7      p\        VP                  VP                  RR7       RRR4       R#   + '       g   i     R# ; i)z7
Checks that using `args` for func, jac and hess works
r   r   trust-constr)r   r   methodr   jacrG  r   g      $@ignorer|  r   r   r}  r   rW  )rv  r   r   r   r   r   hessN)r      g      $)r   r	   r   r   r.   constrgradr   r<   x_optwarningscatch_warningssimplefilterr   RuntimeWarningr   r  )r   objres2r   s   &   r   test_args_gh23517#TestShgoArguments.test_args_gh23517>  s    c3'RHq!f-
GG#J

::!
 			5c3'T4L3*5
$$&& !! .1 WWzzn!3::cjj388J"  JJ 'C CEE39948WWzzn!3::cjj388CHH"  JJ 'C CEE39948K '&&&s   >DG&&G7	c                Z    R\         P                  RRRR/p\        \         RRVRR	7       R# )
z,Test known function minima stopping criteriaf_minf_tolrG  r  TNr[  r  r   r   r   r   r   r   r   r   s   & r   test_4_1_known_f_min&TestShgoArguments.test_4_1_known_f_minx  s5     G00D($0 	DD'!-	/r"   c                ^    R\         P                  RRRRR^/p\        \         RRVR	R
7       R# )z+Test Global mode limiting local evaluationsr  r  rG  r  T
local_iterNr[  r  r  r  r   s   & r   test_4_2_known_f_min&TestShgoArguments.test_4_2_known_f_min  s:     W))T!4! 	DD'!-	/r"   c           
     (   R\         P                  RRRRR^RR/p\        \         P                  \         P                  \         P
                  R	R	VR
R7      p\        P                  P                  VP                  \         P                  RRR7       R	# )z8Test Global mode limiting local evaluations for 1D funcsr  r  rG  r  Tr  r   FNrW  )r   r   r   r   r   r[  r   )r   r   r   r=   r   r4   rD   r   r   r<   r   r   r   r   s   &  r   test_4_4_known_f_min&TestShgoArguments.test_4_4_known_f_min  sy     W))T!4!( 799gnn',,w#*, 	

""355'*<*<4d"Sr"   c                    \        \        P                  \        P                  \        P                  R7      p\
        P                  P                  VP                  \        P                  RRR7       R# )z;Test Default simplicial sampling settings on TestFunction 1r   r[  r   N
r   r   r=   r   r4   rD   r   r   r<   r   r\  s   & r   test_5_1_simplicial_argless-TestShgoArguments.test_5_1_simplicial_argless  sA    799gnn',,G


""355'*<*<4d"Sr"   c                    \        \        P                  \        P                  \        P                  RR7      p\
        P                  P                  VP                  \        P                  RRR7       R# )z6Test Default sobol sampling settings on TestFunction 1rW  r   r   r[  r   Nr  r\  s   & r   test_5_2_sobol_argless(TestShgoArguments.test_5_2_sobol_argless  sF    799gnn',,#*,


""355'*<*<4d"Sr"   c                l   R^/p\        \        P                  \        P                  \        P                  VRR7      p\
        P                  P                  VP                  \        P                  RRR7       \
        P                  P                  VP                  \        P                  RR7       R# ):Test that maximum iteration option works on TestFunction 3max_iterr  r   r   r   r[  r   r   Nr   r   r=   r   r4   rD   r   r   r<   r   r.   r   r  s   &  r   test_6_1_simplicial_max_iter.TestShgoArguments.test_6_1_simplicial_max_iter  u    q/799gnn',,"LB


""355'*<*<4d"S


""377G,@,@t"Lr"   c                l   R^/p\        \        P                  \        P                  \        P                  VRR7      p\
        P                  P                  VP                  \        P                  RRR7       \
        P                  P                  VP                  \        P                  RR7       R# )r  min_iterr  r  r[  r   r   Nr  r  s   &  r   test_6_2_simplicial_min_iter.TestShgoArguments.test_6_2_simplicial_min_iter  r  r"   c           	     h    R F+  pRVR\         P                  /p\        \         ^dRVRR7       K-  	  R# )z@Test the minimizer_kwargs arguments for solvers with constraintsr|  r   MbP?rW  r   r   r   r   N)COBYLACOBYQASLSQP)r   r4   r   )r   solverr   s   &  r   test_7_1_minkwargs$TestShgoArguments.test_7_1_minkwargs  s:     4F !)& -w|| =Wt&6%,. 4r"   c                    RR/pRR/p\        \        P                  \        P                  \        P                  ^ ,          WR7       R# )z'Test the minimizer_kwargs default initsftolr[  r   T)r   r   r   Nr   r   r=   r   r4   )r   r   r   s   &  r   test_7_2_minkwargs$TestShgoArguments.test_7_2_minkwargs  s7    "D>4.WYYGLLO.	Ar"   c           	         R FT  pR pR pRVRVRV/p\         P                  ! RV 24       \         P                  ! R4       \        \        ^dRVRR	7       KV  	  R
# )z?Test minimizer_kwargs arguments for solvers without constraintsc                 ~    \         P                  ! ^V ^ ,          ,          ^V ^,          ,          .4      P                  # rj   )rD   arrayTrF   s   &r   r}  1TestShgoArguments.test_7_3_minkwargs.<locals>.jac  s,    xxQqT1qt8 45777r"   c                 :    \         P                  ! ^^ .^ ^..4      # rj   )rD   r  rF   s   &r   r  2TestShgoArguments.test_7_3_minkwargs.<locals>.hess  s    xx!Q!Q 011r"   r|  r}  r  z	Solver = r  rW  r  N)zNelder-MeadPowellCGBFGS	Newton-CGzL-BFGS-BTNCdoglegz	trust-ncgztrust-exactztrust-krylovzd====================================================================================================)r   r   r   r   )r   r  r}  r  r   s   &    r   test_7_3_minkwargs$TestShgoArguments.test_7_3_minkwargs  sf    'F82 !)& %s & . LL9VH-.LL#Wt&6%,.'r"   c                :    R ^RR/p\        \        RRVRR7       R# )minhgrdr  TNr  r  r   r   s   & r   test_8_homology_group_diff,TestShgoArguments.test_8_homology_group_diff  s(    a($0 	Dg!-	/r"   c                    \        \        P                  \        P                  \        P                  ^ ,          R7       R# )'Test single function constraint passingr  Nr  r   s   &r   test_9_cons_gTestShgoArguments.test_9_cons_g  s    WYYGLLODr"   win32z2Failing and fix in PyPy not planned (see gh-18632))reasonc                t    RR/pR p\        V\        P                  ^VR7      pVP                  ^8X  g   Q hR# )r  maxtimer>  c                 2    \         P                  ! R 4       R# )g+=r   )timesleeprF   s   &r   r=   0TestShgoArguments.test_10_finite_time.<locals>.f  s    JJur"   )r   r   N)r   r   r   nit)r   r   r=   r   s   &   r   test_10_finite_time%TestShgoArguments.test_10_finite_time  s9     e$	 1gnnAw?ww!||r"   c           	     0   RRRR/p\        \        P                  \        P                  ^
RVRR7      p\        P
                  P                  ^ VP                  ^ ,          4       \        P
                  P                  ^ VP                  ^,          4       R# )*Test to cover the case where f_lowest == 0r  r   r   TNrW  r  )r   r   r=   r   rD   r   assert_equalr<   r  s   &  r   test_11_f_min_0!TestShgoArguments.test_11_f_min_0  sj    C4!799gnn$"G=


3558,


3558,r"   z no way of currently testing thisc           	         RRRR/p\        \        P                  \        P                  ^RVRR7      p\        P
                  P                  RVP                  4       R# )r  r  r>  r  r   NrW  r  )r   r   r=   r   rD   r   r  r.   r  s   &  r   test_12_sobol_inf_cons(TestShgoArguments.test_12_sobol_inf_cons  sL     eC!799gnn"G=


SWW-r"   c                ^    R pR.^),          p\        WRR7      pVP                  ^^24       R# )z-Test init of high-dimensional sobol sequencesc                     ^ # r9   r:   rF   s   &r   r=   /TestShgoArguments.test_13_high_sobol.<locals>.f      r"   NrW  r   NN)r   sampling_function)r   r=   r   SHGOcs   &   r   test_13_high_sobol$TestShgoArguments.test_13_high_sobol  s2    	 !B&Q82&r"   c                2    R^/p\        \        ^<VR7       R# )z6Test limited local iterations for a pseudo-global moder  r   Nr   r   s   & r   test_14_local_iter$TestShgoArguments.test_14_local_iter  s    #B0r"   c                6    RR/p\        \        ^^VRR7       R# )z9Test minimize every iter options and cover function cacher  TrW  r  Nr   r   s   & r   test_15_min_every_iter(TestShgoArguments.test_15_min_every_iter   s    ($/AQ!(	*r"   c                :    RR/pRR/p\        \        RW#R7       R# )z:Test disp=True with minimizers that do not support bounds r   Tr|  znelder-meadr  )r   r   r   Nr   )r   capsysr   r   s   &&  r   test_16_disp_bounds_minimizer/TestShgoArguments.test_16_disp_bounds_minimizer&  s&    4.$m4, 	Er"   c                0    R p\        \        ^VR7       R# )=Test the functionality to add custom sampling methods to shgoc                 D    \         P                  P                  W3R 7      # ))size)rD   randomuniform)r   ds   &&r   sample9TestShgoArguments.test_17_custom_sampling.<locals>.sample0  s    99$$1&$11r"   r  Nr   )r   r  s   & r   test_17_custom_sampling)TestShgoArguments.test_17_custom_sampling-  s    	2 	B7r"   c                    R  p. ROp. ROp\        \        W#4      4      p\        W#4      p\        W4      p\        W4      pVP                  VP                  8X  g   Q hVP
                  VP
                  8X  g   Q hVP                  VP                  8X  g   Q h\        P                  ! . RO4      p\        P                  P                  VP                  V4       \        P                  P                  VP                  VP                  4       R# )c                 J    \         P                  ! V 4      P                  4       # r   )rD   squarerE   rF   s   &r   r=   1TestShgoArguments.test_18_bounds_class.<locals>.f7  s    99Q<##%%r"   N)g      r   g      )      r   rd   )r  r   r   )r1   zipr	   r   nfevmessagerA  rD   r  r   r   r<   )	r   r=   lbub
bounds_old
bounds_newres_old_boundsres_new_boundsr  s	   &        r   test_18_bounds_class&TestShgoArguments.test_18_bounds_class5  s    	& #b+&
B^
a,a,""n&9&9999%%)?)????%%)?)????'


"">#3#3U;


"">#3#3^5E5EFr"   c                   \        ^4      ;_uu_ 4       p\        \        ^VP                  R7       RRR4       \        \        ^\        R7       \        ^4      ;_uu_ 4       p\        \        ^VP                  R7       RRR4       \        \        ^\        R7       R#   + '       g   i     Lv; i  + '       g   i     L;; i)r  )r   r   N)r   r   r   mapr3  )r   ps   & r   test_19_parallelization)TestShgoArguments.test_19_parallelizationI  sl     !WWWAEE2 B,!WWVr1551 2s+ W Ws   B"B2B/	2C	c           	         R pR pR.^,          pR pR pR pRRRVR	R/RRRV/RR
RV/3p\        W#R^VR7       \        W#R^VRR7       R# )z0Test that constraints can be passed to argumentsc                    V ^,          R,           ) \         P                  ! \         P                  ! \        V ^ ,          R,          V ^,          R,           ,           4      4      4      ,          V ^ ,          \         P                  ! \         P                  ! \        V ^ ,          V ^,          R,           ,
          4      4      4      ,          ,
          # r|   r   rF   s   &r   	eggholder=TestShgoArguments.test_20_constrained_args.<locals>.eggholderW  s    A$+rvvbggc!A$*!t2L.M&NOOA$rvvbggc!A$!A$+*>&?@AABr"   c                     R V ^ ,          ,          RV ^,          ,          ,           ^'V ^,          ,          ,           RV ^,          ,          ,           # )ǧ8@g     :@g     @D@r:   rF   s   &r   r=   5TestShgoArguments.test_20_constrained_args.<locals>.f]  s7    1Q4<%!A$,.ad:UQqT\IIr"   c                     VR ,          V ^ ,          ,          VR,          V ^,          ,          ,           RV ^,          ,          ,           RV ^,          ,          ,           ^,
          # )gffffff@gffffff@g333333&@g?r:   )r<   r   s   &&r   g1_modified?TestShgoArguments.test_20_constrained_args.<locals>.g1_modifiedb  sT    s7QqT>AGadN2TAaD[@3J D  r"   c                    ^V ^ ,          ,          RV ^,          ,          ,           RV ^,          ,          ,           RV ^,          ,          ,           ^,
          R\         P                  ! RV ^ ,          ^,          ,          RV ^,          ^,          ,          ,           RV ^,          ^,          ,          ,           RV ^,          ^,          ,          ,           4      ,          ,
          # )	   g'@gfffffD@gJ@gRQ?gQ?gRQ?g     4@gףp=
?)rD   r   rF   s   &r   r]   6TestShgoArguments.test_20_constrained_args.<locals>.g2f  s    1Q4$qt)#d1Q4i/$qt);b@1qL4!a</$qtQw,>adAgM r"   c                 v    V ^ ,          V ^,          ,           V ^,          ,           V ^,          ,           ^,
          # r9   r:   rF   s   &r   h16TestShgoArguments.test_20_constrained_args.<locals>.h1n  s+    Q4!A$;1%!,q00r"   r,   r-   r.   r   r7  r!  )r   r   r   rW  )r   r   r   r   Nr   r   r9   )r   )r   r  r=   r   r$  r]   r*  r4   s   &       r   test_20_constrained_args*TestShgoArguments.test_20_constrained_argsT  s~    		J !			1 VTB+ub)+ 	Q#QD9Q#QD$	&r"   c           
     l   R pRRRR/pRR/p\        VR^.^^..^d^RVVR7       VR,          RJ g   Q hRV9   g   Q hR pR^.^^.R^.^^.^ ^..p\        WRRRRR/R	7      p\        V. ROVRR
7      pVP                  '       g   Q h\        VP                  VP                  4       \        VP
                  VP
                  RR7       \        WRRR/RR/R7      pVP                  '       g   Q h\        VP                  VP                  4       \        VP
                  VP
                  RR7       R# )ztTest that shgo can handle objective functions that return the
gradient alongside the objective value. Fixes gh-13547c                 j    \         P                  ! \         P                  ! V ^4      4      ^V ,          3# rj   )rD   rE   powerrF   s   &r   rv  2TestShgoArguments.test_21_1_jac_true.<locals>.func~  s$    66"((1a.)1q500r"   r|  r  r}  TrW  )r   r   r   r   r   r   c                 N    \         P                  ! V ^,          4      ^V ,          3# rj   rC   rF   s   &r   rv  r2    s    66!q&>1q5((r"   )r   r   r   )x0r   r}  r>  r   )r   r   r   r   N)r}   r}   r}   r}   r}   )r   r   rA  r   r.   r<   )r   rv  min_kwdsopt_kwdsr   r   rH  s   &      r   test_21_1_jac_true$TestShgoArguments.test_21_1_jac_truez  sM   	1 gud34=GaV$#%	
 $&&&   	) q'Aq6B7QFQF;4%-wt$DFt!{{{{)suu51 4%-w$7!4=* {{{{)suu51r"   
derivativec                   R pR pR pR pRVRVRV/pWV,          /pRR	/pR.p	\        W)VVR
7      p
\        V3R^ .RV	/VBVB pV
P                  '       g   Q h\        P                  P                  V
P                  VP                  4       \        P                  P                  V
P                  VP                  4       R# )zjshgo used to raise an error when passing `options` with 'jac'
# see gh-12963. check that this is resolved
c                 v    ^V ^ ,          ,          V ^ ,          ,          ^V ^ ,          ,          ,           ^,           # )r2  r:   rF   s   &r   	objectiveATestShgoArguments.test_21_2_derivative_options.<locals>.objective  s*    qt8ad?Q1X-11r"   c                 0    ^V ^ ,          ,          ^,           # r#  r:   rF   s   &r   gradient@TestShgoArguments.test_21_2_derivative_options.<locals>.gradient  s    qt8a<r"   c                     ^# r#  r:   rF   s   &r   r  <TestShgoArguments.test_21_2_derivative_options.<locals>.hess  r  r"   c                     ^V,          # r#  r:   )r<   r  s   &&r   hessp=TestShgoArguments.test_21_2_derivative_options.<locals>.hessp  s    q5Lr"   r}  r  rE  r|  r{  r   r   r4  r   N)id   )r   r   rA  rD   r   r   r.   r<   )r   r:  r=  r@  r  rE  derivative_funcsr   r   r   r   rH  s   &&          r   test_21_2_derivative_options.TestShgoArguments.test_21_2_derivative_options  s    	2	 		 "8VT7EJ
;<$n597G"$y "aS " ";K " " {{{{


""377CGG4


""355#%%0r"   c                P   . R	OpR\         R\        /pRR/p\        \        WVR7      p\	        \        \
        P                  ! ^4      3RR/VB pVP                  '       g   Q h\        VP                  VP                  4       \        VP                  VP                  RR7       R# )
zcEnsure the Hessian gets passed correctly to the local minimizer
routine. Previous report gh-14533.
r}  r  r|  r  rG  r>  r   N)r   g?rM  r   gffffff?rN  rN  )r   r   r   r   r   rD   zerosrA  r   r.   r<   )r   r   r   r   r   rH  s   &     r   test_21_3_hess_options_rosen.TestShgoArguments.test_21_3_hess_options_rosen  s     D)VZ8$k25&"$ubhhqk "+ " "{{{{)suu51r"   c                .   R pRRRR /pR
.p\        WRVRR7      p\        V\        P                  ! ^4      VRVR7      pVP                  '       g   Q h\        VP                  VP                  4       \        VP                  VP                  4       R	# )zoshgo used to raise an error when passing `args` with Sobol sampling
# see gh-12114. check that this is resolvedc                 "    V ^ ,          V,          # r9   r:   )r<   r   s   &&r   r.   6TestShgoArguments.test_21_arg_tuple_sobol.<locals>.fun  s    Q419r"   r,   r-   r.   c                 "    V ^ ,          ^,
          # r9   r:   rF   s   &r   r;  ;TestShgoArguments.test_21_arg_tuple_sobol.<locals>.<lambda>  s    1r"   rW  )r   r   r   )r   r   r   Nr   
   r}   )r   r   rD   rO  rA  r   r.   r<   )r   r.   r   r   r   rH  s   &     r   test_21_arg_tuple_sobol)TestShgoArguments.test_21_arg_tuple_sobol  s    	 /AB3T{#*,sBHHQKT#.0{{{{)suu%r"   r:   N)r}  r  rE  )3r#   r$   r%   r&   rQ  rT  rX  r]  rj  ro  rx  r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  xfailr   sysplatformr  r  rL  r  r  r  r  r  r  r  rK  r  r-  r8  parametrizerJ  rP  rZ  r'   r(   r)   s   @r   rN  rN    s    I/DMAA&89t [[/ / [[
/ 
/TT
TMM
.A.(/E [[w::3<<7#:G  I
I
- [[?@	. A	.	'1
*E8G( [[2, ,$&L(2T [[\+CD1 E1>2& &r"   rN  c                   b   a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tRtV tR# )TestShgoFailuresi  c           	        R^/p\        \        P                  \        P                  ^RVRR7      p\        P
                  P                  RVP                  4       \        P
                  P                  ^VP                  4       R# )z'Test failure on insufficient iterationsmaxiterNrW  r  F)	r   r   r=   r   rD   r   r  rA  tnevr  s   &  r   test_1_maxiterTestShgoFailures.test_1_maxiter  s\    a.799gnn"G= 	

s{{3


388,r"   c                n    \        \        \        \        P                  \        P
                  RR7       R# )z$Rejection of unknown sampling method	not_Sobolr  N)assert_raises
ValueErrorr   r   r=   r   r   s   &r   test_2_sampling TestShgoFailures.test_2_sampling  s    j$		7>>&1	3r"   c                   R^
RR/p\        \        P                  \        P                  ^VRR7      p\        P
                  P                  RVP                  4       \        P
                  P                  ^VP                  4       R# )zdCheck that the routine stops when no minimiser is found
after maximum specified function evaluationsmaxfevr   TrW  r   r   r   FN)	r   
test_tabler=   r   rD   r   r  rA  r  r  s   &  r   test_3_1_no_min_pool_sobol+TestShgoFailures.test_3_1_no_min_pool_sobol  sf     R4! :<<!2!2a#*,


s{{3


CHH-r"   c                    R^
RR/p\        \        P                  \        P                  ^VRR7      p\        P
                  P                  RVP                  4       R# )zdCheck that the routine stops when no minimiser is found
after maximum specified sampling evaluationsmaxevr   Tr  ro  FN)r   rp  r=   r   rD   r   r  rA  r  s   &  r   test_3_2_no_min_pool_simplicial0TestShgoFailures.test_3_2_no_min_pool_simplicial  sL     B4!:<<!2!2a#/1


s{{3r"   c                V    RR.p\        \        \        \        P                  V4       R# )zSpecified bounds ub > lbN)r$  r2  r2     ri  rj  r   r   r=   r   r   s   & r   test_4_1_bound_err#TestShgoFailures.test_4_1_bound_err  s    &!j$		6:r"   c                V    RR.p\        \        \        \        P                  V4       R# )z)Specified bounds are of the form (lb, ub)N)r2  ry  ry  rx  rz  r{  s   & r   test_4_2_bound_err#TestShgoFailures.test_4_2_bound_err  s    V$j$		6:r"   c           	         R^dRR/p\        \        P                  \        P                  \        P                  ^dVRR7      p\
        P                  P                  RVP                  4       R# )zmEnsures the algorithm terminates on infeasible problems
after maxev is exceeded. Use infty constraints optionrt  r   TrW  r   r   r   r   FN	r   test_infeasibler=   r   r4   rD   r   r  rA  r  s   &  r   test_5_1_1_infeasible_sobol,TestShgoFailures.test_5_1_1_infeasible_sobol  s[     C4! ?$$o&<&<.33sG#*, 	

s{{3r"   c           	         R^dRRRR/p\        \        P                  \        P                  \        P                  ^dVRR7      p\
        P                  P                  RVP                  4       R# )	ztEnsures the algorithm terminates on infeasible problems
after maxev is exceeded. Do not use infty constraints optionrt  r   Tr   FrW  r  Nr  r  s   &  r   test_5_1_2_infeasible_sobol,TestShgoFailures.test_5_1_2_infeasible_sobol"  s`     C4&/ ?$$o&<&<.33sG#*, 	

s{{3r"   c           	         RRRR/p\        \        P                  \        P                  \        P                  ^dVRR7      p\
        P                  P                  RVP                  4       R# )zPEnsures the algorithm terminates on infeasible problems
after maxev is exceeded.rt  i  r   Fr  r  Nr  r  s   &  r   test_5_2_infeasible_simplicial/TestShgoFailures.test_5_2_infeasible_simplicial/  s[     D5" ?$$o&<&<.33sG#/1 	

s{{3r"   c           
         R\         P                  R,           RRRRR^RR	/p\         P                  \         P                  3pR
\         P                  RRRRRVRR/p\        \        \        .VO5/ VB  R# )z<Test Global mode limiting local evaluations with f* too highr  r~   r  rG  r  Tr  r   Fr   r   Nr   r   r   rW  )r   r   r=   r   r4   r   UserWarningr   )r   r   r   kwargss   &   r   test_6_1_lower_known_f_min+TestShgoFailures.test_6_1_lower_known_f_min;  s}     W))C/T!4!( 		7>>*t4W#W	 	k41$1&1r"   c                   aa ^ RI HoHp . ROpVV3R lo^ Sn        V! SV4      p\	        VP
                  VP                  SP                  4       R# )r   )r   r   c                 F   < S;P                   ^,          un         S! V 4      # rY  )r  )r<   r.   r   s   &r   r.   "TestShgoFailures.test.<locals>.funQ  s    HHMH8Or"   Nr   rk   r  r  r  r  )scipy.optimizer   r   r  r   r<   r.   )r   r   r   resultr.   r   s   &   @@r   r   TestShgoFailures.testM  s=    .9	 c6"fhh

CHH-r"   r:   N)r#   r$   r%   r&   re  rk  rq  ru  r|  r  r  r  r  r  r   r'   r(   r)   s   @r   ra  ra    sA     -3

.4;
;

44
42$. .r"   ra  c                   ,   a  ] tR tRt o R tR tRtV tR# )TestShgoReturnsi\  c                   a . ROpV3R lo^ Sn         \        SV4      p\        P                  P	                  SP                   VP                   4       R# )r   c                 L   < S;P                   ^,          un         \        V 4      # rY  r  r   r<   r.   s   &r   r.   3TestShgoReturns.test_1_nfev_simplicial.<locals>.fun`      HHMH8Or"   Nr  r  r   rD   r   r  r   r   r  r.   s   &  @r   test_1_nfev_simplicial&TestShgoReturns.test_1_nfev_simplicial]  s>    9	 c6"


&++6r"   c                   a . ROpV3R lo^ Sn         \        SVRR7      p\        P                  P	                  SP                   VP                   4       R# )r   c                 L   < S;P                   ^,          un         \        V 4      # rY  r  r  s   &r   r.   .TestShgoReturns.test_1_nfev_sobol.<locals>.funl  r  r"   rW  r  Nr  r  r  s   &  @r   test_1_nfev_sobol!TestShgoReturns.test_1_nfev_soboli  s@    9	 c67;


&++6r"   r:   N)r#   r$   r%   r&   r  r  r'   r(   r)   s   @r   r  r  \  s     
7
7 
7r"   r  c                     R  p \        V R.^.4      p\        V\        P                  ! RR.4      4      p\	        \
        RR.VRR7      p\        P                  ! \        P                  ! VP                  ^,          4      R8  4      '       g   Q h\        P                  ! \        P                  ! VP                  ^,          4      R8*  4      '       g   Q hVP                  '       g   Q hR# )c                 j    \         P                  ! V 4      p \         P                  ! V ^,          4      .# rj   rD   asarrayrE   rF   s   &r   quad$test_vector_constraint.<locals>.quadx  $    JJqMqAvr"   g@r   rW  r  r   NrW  )
r   r   rD   r  r   r   allrE   r<   rA  )r  nlcoldcr   s       r   test_vector_constraintr  v  s      dSEA3
/C bhhSz&:;D
uw(dG
TC66"&&#%%!$+,,,,66"&&#%%A&#-....;;;;r"   zignore:delta_gradc                     R  p \        V R.^.4      pRR/p\        \        RR.VRVR7      p\        P                  ! \        P
                  ! VP                  ^,          4      R8  4      '       g   Q h\        P                  ! \        P
                  ! VP                  ^,          4      R8*  4      '       g   Q hVP                  '       g   Q hR# )	c                 j    \         P                  ! V 4      p \         P                  ! V ^,          4      .# rj   r  rF   s   &r   r  test_trust_constr.<locals>.quad  r  r"   g@r|  r{  rW  )r   r   r   r   NrW  )r   r   r   rD   r  rE   r<   rA  )r  r  r   r   s       r   test_trust_constrr    s      dSEA3
/C .1 	')C 66"&&#%%!$+,,,,66"&&#%%A&#-....;;;;r"   c                     R.^,          p R p\        VRR4      p\        \        WR7      p\        \        P
                  ! VP                  4      R4       R pRRRV/p\        \        WR7      p\        \        P
                  ! VP                  4      R4       R.^,          p R	 pRRRV/p\        R
 V VRR7      p\        \        P
                  ! VP                  4      R4       R# )?c                 0    V ^ ,          V ^,          ,           # r9   r:   rF   s   &r   faulty)test_equality_constraints.<locals>.faulty  s    tad{r"   333333@r=  c                 >    V ^ ,          V ^,          ,           R,
          # )r   r  r:   rF   s   &r   r  r    s    tad{S  r"   r,   r7  r.   r   c                 v    V ^ ,          V ^,          ,           V ^,          ,           V ^,          ,           ^,
          # r9   r:   rF   s   &r   r  r    s+    tad{QqT!AaD(1,,r"   c                 0    \         P                  ! V 4      ) # r   )rD   prodrF   s   &r   r;  +test_equality_constraints.<locals>.<lambda>  s    BGGAJ,r"   rW  )r   r   r   N)r  r   r,  )r   r   r   r   rD   rE   r<   )r   r  r  r   r   s        r   test_equality_constraintsr    s    \AF fc3
/C
uV
5CBFF355M3'! 4/K
uV
=CBFF355M3'Z!^F- 4/K
	C BFF355M3'r"   c            	          R  p RV RR/pRRRR^RR	R
R//p\        \        R.^,          WR7      pVP                  R,          P                  4       R8X  g   Q hVP                  R,          R
,          R8X  g   Q hR# )c                 J    \         P                  ! V ^,          4      ^ ,
          # rj   rC   rF   s   &r   r4   test_gh16971.<locals>.cons  s    vvad|ar"   r.   r,   r-   r|  r  r   rhobegtolrc   catolg?)r   r   cobylaNrW  )r   r   r   lower)r4   cr   r   s       r   test_gh16971r    s      
ff%A(Hagt<
 	y{	A h'--/8;;;i(1T999r"   )r5  r$  r?  r  )r   <   0_r<)
r  gs8g^V&+6g+?-2g+!/gN|1(gc=C#g^\gNg自ݿ)r   g      @)rk   2   )r   r  g'In/@gS[:XL?)irX  )gܤ@g$H8?g	޿g0ev@gn8)gk_@/?g0g+?)i i   g g      r  )r   r~   )r5  r}   )	r:   r[  rH  NNNNrW  r}   )Ir   r]  r  numpyrD   r  multiprocessingr   numpy.testingr   r   r   r   ri  r   r  r   r	   r
   r   r   r   r   r   r   scipy.optimize._constraintsr   scipy.optimize._shgor   .scipy.optimize.tests.test_minimize_constrainedr   r   r5   r7   r   r   r   rJ   r  r   r   rU   r   rf   r   rz   r   r   r   r1   r  boundsLJr&  r   onesr3  r   rp  r   r  r  rL  r   r   r  rN  ra  r  r  filterwarningsr  r  r  r:   r"   r   <module>r     s=    
      2  1Y Y Y = % J+ + $  gw/"#Q)
ff-"#Q)
lL9"#Q)$  gY",#/ #%((ZL-8M-7L-8M-8M-7L-8M-8M-8M-8M	,; 	#< %'HH .H %I!. hZ",$0>"$((ZL>":$&HHl^$<	#$ #J gw/",j!9#&$ D i]Q."L#.$  k;7$7#8"&!57
% < TFQJ	*+	X$(6!%	
$  
XL1,"% "
S 0
(  Y	$:+-$),c
4

- 0 'w.@4826) ,  D3) 3)tj1 j1Z`& `&Hq. q.j7 74 /0 1,(B:r"   