+
    ,i͜                        ^ 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 ^ RIHt ^ RIHt  ! R R	4      tR
 t ! R R]4      t]! RDRD.^ ^ .R7      t]! RERE.^ ^ .R7      t]! RFRF.^ ^ .R7      t  ! R R]4      t!]!! RG.R.RH]PD                  ! R.R.R.R.R.R.R.R.R.R..
4      ]PD                  ! . RIO4      R7      t#]!! RJ.R.RH.]PD                  ! R..4      ]PD                  ! RH.4      R7      t$ ! R R]4      t%]%! RKRL.RMRN.RR7      t& ! R  R!]4      t']'! RO.^,          . RPOR"R7      t( ! R# R$]4      t)])! RQRQ.RR.R%R&.R'7      t* ! R( R)]4      t+^t,]-! ].! RS.^,          R*.^,          4      4      t/]+! ]/RT.RR'7      t0 ! R+ R,]4      t1]1! RU.^,          R-]Pd                  ! ^4      R,
          R'7      t3 ! R. R/]4      t4]4! RORO.^2.R0R0.R'7      t5 ! R1 R2]4      t6]6! RKRV.RRR'7      t7]
Pp                  Ps                  R34      RWR4 l4       t: ! R5 R64      t; ! R7 R84      t< ! R9 R:4      t= ! R; R<4      t> ! R= R>4      t?R? t@]
Pp                  P                  R@4      RA 4       tBRB tCRC tDR# )X    N)Pool)assert_allcloseIS_PYPY)raiseswarns)shgoBoundsminimize_scalarminimizerosen	rosen_der
rosen_hessNonlinearConstraint)new_constraint_to_old)SHGOc                   *   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   &&&&&&A/usr/lib/python3/dist-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_constraintsr3      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   r1   StructTest1.g.   s    "S())r    r8   N
r!   r"   r#   r$   r;   r1   r3   r2   r%   r&   r'   s   @r   r5   r5   *   s     %* ADr    r5   )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      ,          # )   )rB   sinr9   s   &&r   r;   StructTest2.fA   s    B"&&)##r    c                @    ^:\         P                  ! V ^ R7      ,
          # ):   r?   rA   rD   s   &r   r1   StructTest2.gD   s    BFF11%%%r    r8   Nr!   r"   r#   r$   __doc__r;   r1   r3   r2   r%   r&   r'   s   @r   rH   rH   <   s      $& ADr    rH   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^it 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?r8   r9   s   &&r   r;   StructTest3.f{   s"    qtk!QqTaK//r    c                >    V ^ ,          V ^,          ,          R,
          # r   g      9@r8   rD   s   &r   g1StructTest3.g1~   s    tad{T!!r    c                Z    V ^ ,          ^,          V ^,          ^,          ,           R,
          # rW   r8   rD   s   &r   g2StructTest3.g2   s"    tqy1Q419$t++r    c                    V ^ ,          V ^,          ,          R,
          V ^ ,          ^,          V ^,          ^,          ,           R,
          3# rW   r8   rD   s   &r   r1   StructTest3.g   s8    tad{T!1Q419qtqy#84#???r    r8   N)r!   r"   r#   r$   rQ   r;   rX   r[   r1   r   rB   inf_StructTest3__nlcr2   r%   r&   r'   s   @r   rS   rS   i   s:     "0",@  1bff-E8Dr    rS         ?      @)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^,          ,          ,
          # r7   r8   r9   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 ^,          ,          ,           ^,
          ) #    r8   rD   s   &r   rX   StructTest4.g1   s^    QqTQYQqTQY.15AaDAIEqt8!" # 	#r    c                    ^V ^ ,          ,          ^V ^,          ,          ,           ^
V ^,          ^,          ,          ,           V ^,          ,           V ^,          ,
          R,
          ) # )   g     q@r8   rD   s   &r   r[   StructTest4.g2   sH    QqTA!H$rAaDAI~5!<qtCeKLLr    c                    ^V ^ ,          ,          V ^,          ^,          ,           ^V ^,          ^,          ,          ,           ^V ^,          ,          ,
          ^,
          ) # )   r8   rD   s   &r   g3StructTest4.g3   sC    adQqTQY&QqTQY6QqTACGHHr    c                .   ^V ^ ,          ^,          ,          V ^,          ^,          ,           ^V ^ ,          ,          V ^,          ,          ,
          ^V ^,          ^,          ,          ,           ^V ^,          ,          ,           ^V ^,          ,          ,
          ) # )   r8   rD   s   &r   g4StructTest4.g4   sn    QqTQY1*Q1X!_<q1Q419}Lqt8 1Q4i( ) 	)r    r8   Nr!   r"   r#   r$   rQ   r;   rX   r[   rp   rt   r1   r3   r2   r%   r&   r'   s   @r   rd   rd      s?     #MI) 
RRAADr    rd   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@       @rB   rK   sqrtabsr9   s   &&r   r;   StructTest5.f   s~    dTkN266"''#ad3h!A$+.F*G"HIId266"''#adadTk&:";<==>	
r    Nr8   rF   r'   s   @r   rx   rx      s     
 	AADr    rx   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   rP   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   ra   r8   r9   s   &&r   r;   StructTestS.f   sS    1!QqTCZA$55Q4#:!#$'(tcza&78 	9r    Nr8   rF   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         @r8   r9   s   &&r   r;   StructTestTable.f
  s    Q43;1Q43;r    Nr8   rF   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^,          ^,          ,           # r7   r8   )r   r:   r   s   &&*r   r;   StructTestInfeasible.f  r=   r    c                >    V ^ ,          V ^,          ,           ^,
          # r7   r8   rD   s   &r   rX   StructTestInfeasible.g1!  s    tad{Qr    c                @    V ^ ,          V ^,          ,           ^,
          ) # r7   r8   rD   s   &r   r[   StructTestInfeasible.g2$  s    1!q!!r    c                @    V ^ ,          ) V ^,          ,           ^,
          # r7   r8   rD   s   &r   rp   StructTestInfeasible.g3'  s    !uqt|ar    c                B    V ^ ,          ) V ^,          ,           ^,
          ) # r7   r8   rD   s   &r   rt   StructTestInfeasible.g4*  s    A$1!""r    r8   Nrv   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   r2   r   logginginfor   rB   testingr   r:   r   r,   r   xlr   funl)testr   	test_atolr   r   r   r   r   r   r   ress   &&&&&&&&&& r   run_testr   7  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# )TestShgoSobolTestFunctionsiZ  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_sobol`       	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_sobole  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_sobolj  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_sobolp  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_sobolu  r   r    c                $    \        \        4       R# )%NLP: Hock and Schittkowski problem 18Nr   test3_1r   s   &r   test_f3_sobol(TestShgoSobolTestFunctions.test_f3_sobolz  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    r8   N)r!   r"   r#   r$   rQ   r   r   r   r   r   r   pytestmarkslowr   r   r   r%   r&   r'   s   @r   r   r   Z  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
gh10429ra   r*   eqr,   c                 >   < \         P                  ! V 4      S,
          # r   )rB   mean)r:   avgs   &r   <lambda>FTestShgoSimplicialTestFunctions.test_f0_min_variance.<locals>.<lambda>  s    rwwqzC/?r    r   r   V瞯<r   Nr   r{   )r   rB   varsuccessr   r,   r:   )r   r2   r   r8  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   ra   r8   rD   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    r8   N)r!   r"   r#   r$   rQ   r  r
  r  r  r  r  r   r   r   r  r&  r)  r-  	fail_slowr2  skipr@  rG  r%   r&   r'   s   @r   r  r    s     =
=
=
/=
= [[= =/// [[2/ / [[l#
$ $
$ [[l#1 $1r    r  c                   z  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]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                  P5                  ];'       d    ]P:                  R8H  RR7      R 4       tR t]P                  PA                  RR7      R 4       t!R t"R t#R t$R t%R  t&R! t']P                  PQ                  ^
4      R" 4       t)R# t*R$ t+]P                  PY                  R%. R+O4      R& 4       t-R' t.R( t/R)t0V t1R*# ),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sobolrN  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)NrU  )r   r   r   r   h㈵>r   r   )r   r   r;   r   r2   rB   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   rD   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   ra  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_  r`  rD   s   &r   ra  <TestShgoArguments.test_3_2_disp_sobol.<locals>.callback_func)  rc  r    rU  r   Trd  r  re  Nrf  rg  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   r8   )r:   yzs   &&&r   r9  5TestShgoArguments.test_args_gh14589.<locals>.<lambda>6  s
    	r    )funcr   r   c                 "    ^V ,          ^,           # rh   r8   rD   s   &r   r9  rs  8  s    !a%!)r    )rt  r   N)r   r0  )r{   ri   )r   r   r,   r:   )r   r   rF  s   &  r   test_args_gh14589#TestShgoArguments.test_args_gh145893  sJ     16( +VH=)suu%r    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_tolrE  r  TNrY  r  r   r   r   r   r   r   r   r   s   & r   test_4_1_known_f_min&TestShgoArguments.test_4_1_known_f_min<  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 evaluationsry  rz  rE  r  T
local_iterNrY  r  r{  r|  r   s   & r   test_4_2_known_f_min&TestShgoArguments.test_4_2_known_f_minG  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 funcsry  rz  rE  r  Tr  r   FNrU  )r   r   r   r   r   rY  r   )r   r   r   r;   r   r2   rB   r   r   r:   r   r   r   r   s   &  r   test_4_4_known_f_min&TestShgoArguments.test_4_4_known_f_minT  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   rY  r   N
r   r   r;   r   r2   rB   r   r   r:   r   rZ  s   & r   test_5_1_simplicial_argless-TestShgoArguments.test_5_1_simplicial_arglessc  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 1rU  r   r   rY  r   Nr  rZ  s   & r   test_5_2_sobol_argless(TestShgoArguments.test_5_2_sobol_arglessh  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   rY  r   r   Nr   r   r;   r   r2   rB   r   r   r:   r   r,   r   r  s   &  r   test_6_1_simplicial_max_iter.TestShgoArguments.test_6_1_simplicial_max_itern  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  rY  r   r   Nr  r  s   &  r   test_6_2_simplicial_min_iter.TestShgoArguments.test_6_2_simplicial_min_iterv  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 constraintsmethodr   MbP?rU  r   r   r   r   N)COBYLACOBYQASLSQP)r   r2   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ftolrY  r   T)r   r   r   Nr   r   r;   r   r2   )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                  # rh   )rB   arrayTrD   s   &r   jac1TestShgoArguments.test_7_3_minkwargs.<locals>.jac  s,    xxQqT1qt8 45777r    c                 :    \         P                  ! ^^ .^ ^..4      # rh   )rB   r  rD   s   &r   hess2TestShgoArguments.test_7_3_minkwargs.<locals>.hess  s    xx!Q!Q 011r    r  r  r  z	Solver = r  rU  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sleeprD   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 == 0ry  r   r   TNrU  r  )r   r   r;   r   rB   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<  ry  r   NrU  r  )r   r   r;   r   rB   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                     ^ # r7   r8   rD   s   &r   r;   /TestShgoArguments.test_13_high_sobol.<locals>.f      r    NrU  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  TrU  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)rB   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   )rB   squarerC   rD   s   &r   r;   1TestShgoArguments.test_18_bounds_class.<locals>.f  s    99Q<##%%r    N)g      r   g      )      r   rb   )r  r   r   )r/   zipr	   r   nfevmessager?  rB   r  r   r   r:   )	r   r;   lbub
bounds_old
bounds_newres_old_boundsres_new_boundsx_opts	   &        r   test_18_bounds_class&TestShgoArguments.test_18_bounds_class  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   mapr1  )r   ps   & r   test_19_parallelization)TestShgoArguments.test_19_parallelization  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      ,          ,
          # rz   r}   rD   s   &r   	eggholder=TestShgoArguments.test_20_constrained_args.<locals>.eggholder  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@r8   rD   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?r8   )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=
?)rB   r~   rD   s   &r   r[   6TestShgoArguments.test_20_constrained_args.<locals>.g2*  s    1Q4$qt)#d1Q4i/$qt);b@1qL4!a</$qtQw,>adAgM r    c                 v    V ^ ,          V ^,          ,           V ^,          ,           V ^,          ,           ^,
          # r7   r8   rD   s   &r   h16TestShgoArguments.test_20_constrained_args.<locals>.h12  s+    Q4!A$;1%!,q00r    r*   r+   r,   r   r5  r  )r   r   r   rU  )r   r   r   r   Nr   r   r7   )r   )r   r  r;   r   r  r[   r  r2   s   &       r   test_20_constrained_args*TestShgoArguments.test_20_constrained_args  s~    		J !			1 VTB+ub)+ 	Q#QD9Q#QD$	&r    c                .   R p\        VR^.^^..^d^RRRRR/R7       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# rh   )rB   rC   powerrD   s   &r   rt  2TestShgoArguments.test_21_1_jac_true.<locals>.funcB  s$    66"((1a.)1q500r    rU  r  r  r  T)r   r   r   r   r   c                 N    \         P                  ! V ^,          4      ^V ,          3# rh   rA   rD   s   &r   rt  r!  N  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   rt  r   r   rF  s   &    r   test_21_1_jac_true$TestShgoArguments.test_21_1_jac_true>  s   	1 	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 ^ ,          ,          ,           ^,           # )r0  r8   rD   s   &r   	objectiveATestShgoArguments.test_21_2_derivative_options.<locals>.objectivei  s*    qt8ad?Q1X-11r    c                 0    ^V ^ ,          ,          ^,           # r!  r8   rD   s   &r   gradient@TestShgoArguments.test_21_2_derivative_options.<locals>.gradientl  s    qt8a<r    c                     ^# r!  r8   rD   s   &r   r  <TestShgoArguments.test_21_2_derivative_options.<locals>.hesso  r  r    c                     ^V,          # r!  r8   )r:   r	  s   &&r   hessp=TestShgoArguments.test_21_2_derivative_options.<locals>.hesspr  s    q5Lr    r  r  r2  r  trust-constrr   r   r#  r   N)id   )r   r   r?  rB   r   r   r,   r:   )r   r'  r*  r-  r  r2  derivative_funcsr   r   r   r   rF  s   &&          r   test_21_2_derivative_options.TestShgoArguments.test_21_2_derivative_optionsc  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  r5  r<  r   N)r   g?r;  r   gffffff?r<  r<  )r   r   r   r   r   rB   zerosr?  r   r,   r:   )r   r   r   r   r   rF  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,          # r7   r8   )r:   r   s   &&r   r,   6TestShgoArguments.test_21_arg_tuple_sobol.<locals>.fun  s    Q419r    r*   r+   r,   c                 "    V ^ ,          ^,
          # r7   r8   rD   s   &r   r9  ;TestShgoArguments.test_21_arg_tuple_sobol.<locals>.<lambda>  s    1r    rU  )r   r   r   )r   r   r   Nr   
   r{   )r   r   rB   r=  r?  r   r,   r:   )r   r,   r   r   r   rF  s   &     r   test_21_arg_tuple_sobol)TestShgoArguments.test_21_arg_tuple_sobol  s    	 /AB3T{#*,sBHHQKT#.0{{{{)suu%r    r8   N)r  r  r2  )2r!   r"   r#   r$   rO  rR  rV  r[  rh  rm  rv  r   r   r   r}  r  r  r  r  r  r  r  r  r  r  r  xfailr   sysplatformr  r  rJ  r  r  r  r  r  r  r  rI  r
  r  r%  parametrizer8  r>  rH  r%   r&   r'   s   @r   rL  rL    s    I/DMAA& [[/ / [[
/ 
/TT
TMM
.A.(/E [[w::3<<7#:G  I
I
- [[?@	. A	.	'1
*E8G( [[2, ,$&L#2J [[\+CD1 E1>2& &r    rL  c                      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]P                  P                  R 4       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maxiterNrU  r  F)	r   r   r;   r   rB   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   TrU  r   r   r   FN)	r   
test_tabler;   r   rB   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  r]  FN)r   r^  r;   r   rB   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"  r0  r0     rW  rX  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)r0  rg  rg  rf  rh  ri  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 optionrb  r   TrU  r   r   r   r   FN	r   test_infeasibler;   r   r2   rB   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 optionrb  r   Tr   FrU  rp  Nrq  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.rb  i  r   Fr  rp  Nrq  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 highry  r|   rz  rE  r  Tr  r   Fr   r   Nr   r   r   rU  )r   r   r;   r   r2   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      # rG  )r  )r:   r,   r   s   &r   r,   "TestShgoFailures.test.<locals>.fun  s    HHMH8Or    Nr   ri   r  r  r  r  )scipy.optimizer   r   r  r   r:   r,   )r   r   r   resultr,   r   s   &   @@r   r   TestShgoFailures.test  s=    .9	 c6"fhh

CHH-r    r8   N)r!   r"   r#   r$   rS  rY  r_  rc  rj  rm  rs  rv  ry  r   r   thread_unsafer~  r   r%   r&   r'   s   @r   rO  rO    sZ     -3

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

44
4 [[2 2$. .r    rO  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      # rG  r  r   r:   r,   s   &r   r,   3TestShgoReturns.test_1_nfev_simplicial.<locals>.fun       HHMH8Or    Nr  r  r   rB   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      # rG  r  r  s   &r   r,   .TestShgoReturns.test_1_nfev_sobol.<locals>.fun,  r  r    rU  r  Nr  r  r  s   &  @r   test_1_nfev_sobol!TestShgoReturns.test_1_nfev_sobol)  s@    9	 c67;


&++6r    r8   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      .# rh   rB   asarrayrC   rD   s   &r   quad$test_vector_constraint.<locals>.quad8  $    JJqMqAvr    g@r   rU  r  r   NrE  )
r   r   rB   r  r   r   allrC   r:   r?  )r  nlcoldcr   s       r   test_vector_constraintr  6  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      .# rh   r  rD   s   &r   r  test_trust_constr.<locals>.quadG  r  r    g@r  r4  rU  )r   r   r   r   NrE  )r   r   r   rB   r  rC   r:   r?  )r  r  r   r   s       r   test_trust_constrr  E  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 ^,          ,           # r7   r8   rD   s   &r   faulty)test_equality_constraints.<locals>.faulty`  s    tad{r    333333@r;  c                 >    V ^ ,          V ^,          ,           R,
          # )r   r  r8   rD   s   &r   r  r  g  s    tad{S  r    r*   r5  r,   r   c                 v    V ^ ,          V ^,          ,           V ^,          ,           V ^,          ,           ^,
          # r7   r8   rD   s   &r   r  r  p  s+    tad{QqT!AaD(1,,r    c                 0    \         P                  ! V 4      ) # r   )rB   prodrD   s   &r   r9  +test_equality_constraints.<locals>.<lambda>v  s    BGGAJ,r    rU  )r   r   r   N)r  r   r  )r   r   r   r   rB   rC   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      ^ ,
          # rh   rA   rD   s   &r   r2   test_gh16971.<locals>.cons~  s    vvad|ar    r,   r*   r+   r  r  r   rhobegtolra   catolg?)r   r   cobylaNrE  )r   r   r   lower)r2   cr   r   s       r   test_gh16971r  }  s      
ff%A(Hagt<
 	y{	A h'--/8;;;i(1T999r    )r$  r"  r=  r  )r   <   0_r<)
r  gs8g^V&+6g+?-2g+!/gN|1(gc=C#g^\gNg自ݿ)r   g      @)ri   2   )r   r  g'In/@gS[:XL?)irF  )gܤ@g$H8?g	޿g0ev@gn8)gk_@/?g0g+?)i i   g g      r  )r   r|   )r$  r{   )	r8   rY  r6  NNNNrU  r{   )Er   rK  numpyrB   r  multiprocessingr   numpy.testingr   r   r   r   rW  r   r  r   r	   r
   r   r   r   r   r   scipy.optimize._constraintsr   scipy.optimize._shgor   r   r3   r5   r   r   r   rH   r  r   r   rS   r   rd   r   rx   r   r   r   r/   r  boundsLJr$  r   onesr1  r   r^  r   rr  r   rJ  r   r   r  rL  rO  r  r  filterwarningsr  r  r  r8   r    r   <module>r     s7    
     2  1H H H = %+ + $  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a& a&Jr. r.l7 74 /0 1,(B:r    