+
    nDjդ                        ^ RI t ^ RIt^ RIt^ RIt^ RIHt ^ RI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]PH                  ! R.R.R.R.R.R.R.R.R.R..
4      ]PH                  ! . RJO4      R7      t%]#! RK.R.RI.]PH                  ! R..4      ]PH                  ! 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-^t.]/! ]0! RT.^,          R+.^,          4      4      t1]-! ]1RU.RR(7      t2 ! R, R-]4      t3]3! RV.^,          R.]Ph                  ! ^4      R,
          R(7      t5 ! R/ R0]4      t6]6! RPRP.^2.R1R1.R(7      t7 ! R2 R3]4      t8]8! RLRW.RRR(7      t9]	Pt                  Pw                  R44      RXR5 l4       t< ! R6 R74      t= ! R8 R94      t> ! R: R;4      t? ! R< R=4      t@ ! R> R?4      tAR@ tB]	Pt                  P                  RA4      RB 4       tDRC tERD tFR# )Y    N)Pool)assert_allclose)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   &&&&&&Y/data/cameron/venvs/s3viz/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_constraintsr4      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   r2   StructTest1.g/   s    "S())r!   r9   N
r"   r#   r$   r%   r<   r2   r4   r3   r&   r'   r(   s   @r   r6   r6   +   s     %* ADr!   r6   )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      ,          # )   )rC   sinr:   s   &&r   r<   StructTest2.fB   s    B"&&)##r!   c                @    ^:\         P                  ! V ^ R7      ,
          # ):   r@   rB   rE   s   &r   r2   StructTest2.gE   s    BFF11%%%r!   r9   Nr"   r#   r$   r%   __doc__r<   r2   r4   r3   r&   r'   r(   s   @r   rI   rI   =   s      $& ADr!   rI   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^jt 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?r9   r:   s   &&r   r<   StructTest3.f|   s"    qtk!QqTaK//r!   c                >    V ^ ,          V ^,          ,          R,
          # r   g      9@r9   rE   s   &r   g1StructTest3.g1   s    tad{T!!r!   c                Z    V ^ ,          ^,          V ^,          ^,          ,           R,
          # rX   r9   rE   s   &r   g2StructTest3.g2   s"    tqy1Q419$t++r!   c                    V ^ ,          V ^,          ,          R,
          V ^ ,          ^,          V ^,          ^,          ,           R,
          3# rX   r9   rE   s   &r   r2   StructTest3.g   s8    tad{T!1Q419qtqy#84#???r!   r9   N)r"   r#   r$   r%   rR   r<   rY   r\   r2   r   rC   inf_StructTest3__nlcr3   r&   r'   r(   s   @r   rT   rT   j   s:     "0",@  1bff-E8Dr!   rT         ?      @)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^,          ,          ,
          # r8   r9   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 ^,          ,          ,           ^,
          ) #    r9   rE   s   &r   rY   StructTest4.g1   s^    QqTQYQqTQY.15AaDAIEqt8!" # 	#r!   c                    ^V ^ ,          ,          ^V ^,          ,          ,           ^
V ^,          ^,          ,          ,           V ^,          ,           V ^,          ,
          R,
          ) # )   g     q@r9   rE   s   &r   r\   StructTest4.g2   sH    QqTA!H$rAaDAI~5!<qtCeKLLr!   c                    ^V ^ ,          ,          V ^,          ^,          ,           ^V ^,          ^,          ,          ,           ^V ^,          ,          ,
          ^,
          ) # )   r9   rE   s   &r   g3StructTest4.g3   sC    adQqTQY&QqTQY6QqTACGHHr!   c                .   ^V ^ ,          ^,          ,          V ^,          ^,          ,           ^V ^ ,          ,          V ^,          ,          ,
          ^V ^,          ^,          ,          ,           ^V ^,          ,          ,           ^V ^,          ,          ,
          ) # )   r9   rE   s   &r   g4StructTest4.g4   sn    QqTQY1*Q1X!_<q1Q419}Lqt8 1Q4i( ) 	)r!   r9   Nr"   r#   r$   r%   rR   r<   rY   r\   rq   ru   r2   r4   r3   r&   r'   r(   s   @r   re   re      s?     #MI) 
RRAADr!   re   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@       @rC   rL   sqrtabsr:   s   &&r   r<   StructTest5.f   s~    dTkN266"''#ad3h!A$+.F*G"HIId266"''#adadTk&:";<==>	
r!   Nr9   rG   r(   s   @r   ry   ry      s     
 	AADr!   ry   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   rQ   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   rb   r9   r:   s   &&r   r<   StructTestS.f   sS    1!QqTCZA$55Q4#:!#$'(tcza&78 	9r!   Nr9   rG   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         @r9   r:   s   &&r   r<   StructTestTable.f  s    Q43;1Q43;r!   Nr9   rG   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^,          ^,          ,           # r8   r9   )r   r;   r   s   &&*r   r<   StructTestInfeasible.f  r>   r!   c                >    V ^ ,          V ^,          ,           ^,
          # r8   r9   rE   s   &r   rY   StructTestInfeasible.g1"  s    tad{Qr!   c                @    V ^ ,          V ^,          ,           ^,
          ) # r8   r9   rE   s   &r   r\   StructTestInfeasible.g2%  s    1!q!!r!   c                @    V ^ ,          ) V ^,          ,           ^,
          # r8   r9   rE   s   &r   rq   StructTestInfeasible.g3(  s    !uqt|ar!   c                B    V ^ ,          ) V ^,          ,           ^,
          ) # r8   r9   rE   s   &r   ru   StructTestInfeasible.g4+  s    A$1!""r!   r9   Nrw   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   r3   r   logginginfor   rC   testingr   r;   r   r-   r   xlr   funl)testr   	test_atolr   r   r   r   r   r   r   ress   &&&&&&&&&& r   run_testr   8  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_sobola       	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_sobolf  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_sobolk  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_sobolq  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_sobolv  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!   r9   N)r"   r#   r$   r%   rR   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
gh10429rb   r+   eqr-   c                 >   < \         P                  ! V 4      S,
          # r   )rC   mean)r;   avgs   &r   <lambda>FTestShgoSimplicialTestFunctions.test_f0_min_variance.<locals>.<lambda>  s    rwwqzC/?r!   r   r   V瞯<r   Nr   r|   )r   rC   varsuccessr   r-   r;   )r   r3   r   r9  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   rb   r9   rE   s   &r   r-   DTestShgoSimplicialTestFunctions.test_f0_min_variance_1D.<locals>.fun  s    C=AG,,r!   )r   ư>)r   Nr>  )r   r	   r@  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!   r9   N)r"   r#   r$   r%   rR   r  r  r  r  r  r  r   r   r  r  r'  r*  r.  	fail_slowr3  skiprA  rH  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R tR t]P                  P;                  RR7      R 4       tR tR t R t!R t"R t#R  t$]P                  PK                  ^
4      R! 4       t&R" t'R# t(]P                  PS                  R$. R*O4      R% 4       t*R& t+R' t,R(t-V t.R)# )+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sobolrO  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)NrV  )r   r   r   r   h㈵>r   r   )r   r   r<   r   r3   rC   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   rE   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   rb  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# r`  ra  rE   s   &r   rb  <TestShgoArguments.test_3_2_disp_sobol.<locals>.callback_func*  rd  r!   rV  r   Tre  r  rf  Nrg  rh  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   r9   )r;   yzs   &&&r   r:  5TestShgoArguments.test_args_gh14589.<locals>.<lambda>7  s
    	r!   )funcr   r   c                 "    ^V ,          ^,           # ri   r9   rE   s   &r   r:  rt  9  s    !a%!)r!   )ru  r   N)r   r1  )r|   rj   )r   r   r-   r;   )r   r   rG  s   &  r   test_args_gh14589#TestShgoArguments.test_args_gh145894  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   jacrF  r   g      $@ignorer{  r   r   r|  r   rV  )ru  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_tolrF  r  TNrZ  r  r   r   r   r   r   r   r   r   s   & r   test_4_1_known_f_min&TestShgoArguments.test_4_1_known_f_minw  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  rF  r  T
local_iterNrZ  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  rF  r  Tr  r   FNrV  )r   r   r   r   r   rZ  r   )r   r   r   r<   r   r3   rC   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   rZ  r   N
r   r   r<   r   r3   rC   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 1rV  r   r   rZ  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   rZ  r   r   Nr   r   r<   r   r3   rC   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  rZ  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?rV  r   r   r   r   N)COBYLACOBYQASLSQP)r   r3   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ftolrZ  r   T)r   r   r   Nr   r   r<   r   r3   )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                  # ri   )rC   arrayTrE   s   &r   r|  1TestShgoArguments.test_7_3_minkwargs.<locals>.jac  s,    xxQqT1qt8 45777r!   c                 :    \         P                  ! ^^ .^ ^..4      # ri   )rC   r  rE   s   &r   r~  2TestShgoArguments.test_7_3_minkwargs.<locals>.hess  s    xx!Q!Q 011r!   r{  r|  r~  z	Solver = r  rV  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!   c                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sleeprE   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  s7    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   TNrV  r  )r   r   r<   r   rC   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 this)reasonc           	         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   NrV  r  )r   r   r<   r   rC   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                     ^ # r8   r9   rE   s   &r   r<   /TestShgoArguments.test_13_high_sobol.<locals>.f      r!   NrV  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  TrV  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)rC   randomuniform)r   ds   &&r   sample9TestShgoArguments.test_17_custom_sampling.<locals>.sample-  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   )rC   squarerD   rE   s   &r   r<   1TestShgoArguments.test_18_bounds_class.<locals>.f4  s    99Q<##%%r!   N)g      r   g      )      r   rc   )r
  r   r   )r0   zipr   r   nfevmessager@  rC   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_class2  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   mapr2  )r   ps   & r   test_19_parallelization)TestShgoArguments.test_19_parallelizationF  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~   rE   s   &r   	eggholder=TestShgoArguments.test_20_constrained_args.<locals>.eggholderT  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@r9   rE   s   &r   r<   5TestShgoArguments.test_20_constrained_args.<locals>.fZ  s7    1Q4<%!A$,.ad:UQqT\IIr!   c                     VR ,          V ^ ,          ,          VR,          V ^,          ,          ,           RV ^,          ,          ,           RV ^,          ,          ,           ^,
          # )gffffff@gffffff@g333333&@g?r9   )r;   r   s   &&r   g1_modified?TestShgoArguments.test_20_constrained_args.<locals>.g1_modified_  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=
?)rC   r   rE   s   &r   r\   6TestShgoArguments.test_20_constrained_args.<locals>.g2c  s    1Q4$qt)#d1Q4i/$qt);b@1qL4!a</$qtQw,>adAgM r!   c                 v    V ^ ,          V ^,          ,           V ^,          ,           V ^,          ,           ^,
          # r8   r9   rE   s   &r   h16TestShgoArguments.test_20_constrained_args.<locals>.h1k  s+    Q4!A$;1%!,q00r!   r+   r,   r-   r   r6  r   )r   r   r   rV  )r   r   r   r   Nr   r   r8   )r   )r   r  r<   r   r"  r\   r(  r3   s   &       r   test_20_constrained_args*TestShgoArguments.test_20_constrained_argsQ  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# ri   )rC   rD   powerrE   s   &r   ru  2TestShgoArguments.test_21_1_jac_true.<locals>.func{  s$    66"((1a.)1q500r!   r{  r  r|  TrV  )r   r   r   r   r   r   c                 N    \         P                  ! V ^,          4      ^V ,          3# ri   rB   rE   s   &r   ru  r0    s    66!q&>1q5((r!   )r   r   r   )x0r   r|  r=  r   )r   r   r   r   N)r|   r|   r|   r|   r|   )r   r
   r@  r   r-   r;   )r   ru  min_kwdsopt_kwdsr   r   rG  s   &      r   test_21_1_jac_true$TestShgoArguments.test_21_1_jac_truew  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 ^ ,          ,          ,           ^,           # )r1  r9   rE   s   &r   	objectiveATestShgoArguments.test_21_2_derivative_options.<locals>.objective  s*    qt8ad?Q1X-11r!   c                 0    ^V ^ ,          ,          ^,           # r"  r9   rE   s   &r   gradient@TestShgoArguments.test_21_2_derivative_options.<locals>.gradient  s    qt8a<r!   c                     ^# r"  r9   rE   s   &r   r~  <TestShgoArguments.test_21_2_derivative_options.<locals>.hess  r  r!   c                     ^V,          # r"  r9   )r;   r  s   &&r   hessp=TestShgoArguments.test_21_2_derivative_options.<locals>.hessp  s    q5Lr!   r|  r~  rC  r{  rz  r   r   r2  r   N)id   )r   r
   r@  rC   r   r   r-   r;   )r   r8  r;  r>  r~  rC  derivative_funcsr   r   r   r   rG  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  rE  r=  r   N)r   g?rK  r   gffffff?rL  rL  )r   r   r   r   r
   rC   zerosr@  r   r-   r;   )r   r   r   r   r   rG  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,          # r8   r9   )r;   r   s   &&r   r-   6TestShgoArguments.test_21_arg_tuple_sobol.<locals>.fun  s    Q419r!   r+   r,   r-   c                 "    V ^ ,          ^,
          # r8   r9   rE   s   &r   r:  ;TestShgoArguments.test_21_arg_tuple_sobol.<locals>.<lambda>  s    1r!   rV  )r   r   r   )r   r   r   Nr   
   r|   )r   r
   rC   rM  r@  r   r-   r;   )r   r-   r   r   r   rG  s   &     r   test_21_arg_tuple_sobol)TestShgoArguments.test_21_arg_tuple_sobol  s    	 /AB3T{#*,sBHHQKT#.0{{{{)suu%r!   r9   N)r|  r~  rC  )/r"   r#   r$   r%   rP  rS  rW  r\  ri  rn  rw  r  r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rK  r  r  r  r  r  r  r  rJ  r  r+  r6  parametrizerH  rN  rX  r&   r'   r(   s   @r   rM  rM    s_    I/DMAA&89t [[/ / [[
/ 
/TT
TMM
.A.(/E
- [[?@	. A	.	'1
*E8G( [[2, ,$&L(2T [[\+CD1 E1>2& &r!   rM  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maxiterNrV  r  F)	r   r   r<   r   rC   r   r  r@  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   TrV  r   r   r   FN)	r   
test_tabler<   r   rC   r   r  r@  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  rj  FN)r   rk  r<   r   rC   r   r  r@  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#  r1  r1     rd  re  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)r1  rt  rt  rs  ru  rv  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 optionro  r   TrV  r   r   r   r   FN	r   test_infeasibler<   r   r3   rC   r   r  r@  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 optionro  r   Tr   FrV  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.ro  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  rF  r  Tr  r   Fr   r   Nr   r   r   rV  )r   r   r<   r   r3   r   UserWarningr   )r   r   r   kwargss   &   r   test_6_1_lower_known_f_min+TestShgoFailures.test_6_1_lower_known_f_min8  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      # rW  )r  )r;   r-   r   s   &r   r-   "TestShgoFailures.test.<locals>.funN  s    HHMH8Or!   Nr   rj   r  r  r  r  )scipy.optimizer   r   r  r   r;   r-   )r   r   r   resultr-   r   s   &   @@r   r   TestShgoFailures.testJ  s=    .9	 c6"fhh

CHH-r!   r9   N)r"   r#   r$   r%   r`  rf  rl  rp  rw  rz  r  r  r  r  r   r&   r'   r(   s   @r   r\  r\    sA     -3

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

44
42$. .r!   r\  c                   ,   a  ] tR tRt o R tR tRtV tR# )TestShgoReturnsiY  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      # rW  r  r   r;   r-   s   &r   r-   3TestShgoReturns.test_1_nfev_simplicial.<locals>.fun]      HHMH8Or!   Nr  r  r   rC   r   r  r   r   r  r-   s   &  @r   test_1_nfev_simplicial&TestShgoReturns.test_1_nfev_simplicialZ  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      # rW  r  r  s   &r   r-   .TestShgoReturns.test_1_nfev_sobol.<locals>.funi  r  r!   rV  r  Nr  r  r  s   &  @r   test_1_nfev_sobol!TestShgoReturns.test_1_nfev_sobolf  s@    9	 c67;


&++6r!   r9   N)r"   r#   r$   r%   r  r  r&   r'   r(   s   @r   r  r  Y  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      .# ri   rC   asarrayrD   rE   s   &r   quad$test_vector_constraint.<locals>.quadu  $    JJqMqAvr!   g@r   rV  r  r   NrU  )
r   r   rC   r  r   r   allrD   r;   r@  )r  nlcoldcr   s       r   test_vector_constraintr  s  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      .# ri   r  rE   s   &r   r  test_trust_constr.<locals>.quad  r  r!   g@r{  rz  rV  )r   r   r   r   NrU  )r   r   r   rC   r  rD   r;   r@  )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 ^,          ,           # r8   r9   rE   s   &r   faulty)test_equality_constraints.<locals>.faulty  s    tad{r!   333333@r<  c                 >    V ^ ,          V ^,          ,           R,
          # )r   r  r9   rE   s   &r   r  r    s    tad{S  r!   r+   r6  r-   r   c                 v    V ^ ,          V ^,          ,           V ^,          ,           V ^,          ,           ^,
          # r8   r9   rE   s   &r   r  r    s+    tad{QqT!AaD(1,,r!   c                 0    \         P                  ! V 4      ) # r   )rC   prodrE   s   &r   r:  +test_equality_constraints.<locals>.<lambda>  s    BGGAJ,r!   rV  )r   r   r   N)r  r   r*  )r   r   r   r   rC   rD   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      ^ ,
          # ri   rB   rE   s   &r   r3   test_gh16971.<locals>.cons  s    vvad|ar!   r-   r+   r,   r{  r  r   rhobegtolrb   catolg?)r   r   cobylaNrU  )r   r   r   lower)r3   cr   r   s       r   test_gh16971r    s      
ff%A(Hagt<
 	y{	A h'--/8;;;i(1T999r!   )r3  r#  r>  r  )r   <   0_r<)
r  gs8g^V&+6g+?-2g+!/gN|1(gc=C#g^\gNg自ݿ)r   g      @)rj   2   )r   r  g'In/@gS[:XL?)irV  )gܤ@g$H8?g	޿g0ev@gn8)gk_@/?g0g+?)i i   g g      r
  )r   r}   )r3  r|   )	r9   rZ  rF  NNNNrV  r|   )Gr   r  numpyrC   r  multiprocessingr   numpy.testingr   r   r   rd  r   r  r   r   r	   r
   r   r   r   r   r   scipy.optimize._constraintsr   scipy.optimize._shgor   .scipy.optimize.tests.test_minimize_constrainedr   r   r4   r6   r   r   r   rI   r  r   r   rT   r   re   r   ry   r   r   r   r0   r  boundsLJr%  r   onesr2  r   rk  r   r  r   rK  r   r   r  rM  r\  r  r  filterwarningsr  r  r  r9   r!   r   <module>r     s:         )  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^& ^&Dq. q.j7 74 /0 1,(B:r!   