+
    /i                     t    ^ RI t ^ RIt^ RIHtHt ^ RIHtHtH	t	H
t
HtHt  ! R R4      tR t ! R R4      tR# )	    N)assert_allcloseassert_array_almost_equal)fmin_cobylaminimizeBoundsNonlinearConstraintLinearConstraintOptimizeResultc                   V   a  ] tR t^t o R tR tR tR tR tR t	R t
R tR	 tR
tV tR# )
TestCobylac                    \         P                  ! R4      R	.V n        \        P                  ! R4      R.V n        R^ R^RRR^d/V n        R# )
   disprhobegtolgư>maxiterNgUUUUUU?g888@g7l'V?)npsqrtx0mathsolutionoptsselfs   &^/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/optimize/tests/test_cobyla.pysetup_methodTestCobyla.setup_method   sI     77?+\:?3U;Q!UD%	    c                ^    V^ ,          ^,          \        V^,          4      ^,          ,           # r   )absr   xs   &&r   funTestCobyla.fun   s!    tQwQqTA%%r   c                Z    V^ ,          ^,          V^,          ^,          ,           ^,
          # r     r"   s   &&r   con1TestCobyla.con1   s"    tQw1q 2%%r   c                &    V P                  V4      ) # N)r(   r"   s   &&r   con2TestCobyla.con2   s    		!}r   c           
         \        V P                  V P                  V P                  V P                  .^R^d^R7      p\        WP                  RR7       R# )   h㈵>)r   rhoendmaxfunr   -C6?atolN)r   r$   r   r(   r,   r   r   r"   s   & r   test_simpleTestCobyla.test_simple   s>    $''DIItyy+A!#Ca9==t4r   c           	     D    ! R  R4      p ! R R4      pV! 4       pV! 4       p\        V P                  ^ \        P                  4      RRRV P                  /3p\        V P                  V P                  RVW0P                  R7      p\        V P                  V P                  RVW@P                  R7      p\        VP                  V P                  R	R
7       VP                  '       g   Q VP                  4       hVP                  R8  g   Q V4       hVP                  ^F8  g   Q V4       hVP                  V P                  V P                  4      R,           8  g   Q V4       h\!        VP                  VP"                  ^RR7       VP                  '       g   Q VP                  4       hVP                  VP                  8X  g   Q hVP                  VP                  8X  g   Q hVP                  VP                  8X  g   Q hVP$                  VP$                  8X  g   Q R4       hR# )c                   ,   a  ] tR t^%t o R tR tRtV tR# )1TestCobyla.test_minimize_simple.<locals>.Callbackc                "    ^ V n         RV n        R# r   Nn_callslast_xr   s   &r   __init__:TestCobyla.test_minimize_simple.<locals>.Callback.__init__&   s     "r   c                D    V ;P                   ^,          un         Wn        R# r/   Nr=   r"   s   &&r   __call__:TestCobyla.test_minimize_simple.<locals>.Callback.__call__*   s    !r   )r?   r>   N__name__
__module____qualname____firstlineno__r@   rD   __static_attributes____classdictcell____classdict__s   @r   Callbackr:   %   s     #   r   rO   c                   ,   a  ] tR t^.t o R tR tRtV tR# ):TestCobyla.test_minimize_simple.<locals>.CallbackNewSyntaxc                    ^ V n         R# r<   r>   r   s   &r   r@   CTestCobyla.test_minimize_simple.<locals>.CallbackNewSyntax.__init__/   s	     r   c                h    \        V\        4      '       g   Q hV ;P                  ^,          un        R# rC   )
isinstancer
   r>   )r   intermediate_results   &&r   rD   CTestCobyla.test_minimize_simple.<locals>.CallbackNewSyntax.__call__2   s$    !"5~FFFF!r   rS   NrF   rM   s   @r   CallbackNewSyntaxrQ   .   s     !" "r   rY   typeineqr$   cobyla)methodconstraintscallbackoptionsr3   r4   r0   MbP?zGLast design vector sent to the callback is not equal to returned value.)decimalerr_msgzGCallback is not called the same amount of times for old and new syntax.N)r   r(   r   infr,   r   r$   r   r   r   r#   r   successmessagemaxcvnfevr   r?   r>   )r   rO   rY   r_   callback_new_syntaxconssolsol_news   &       r   test_minimize_simpleTestCobyla.test_minimize_simple$   s   	  	 	" 	" :/1 $DIIq"&&9		24txxt ())=488TWWX4 3YYHt}}48{{{'CKK'{yy4$$xx"}!c!}ww$--0477<<7!EEOO$		
 //ww'++%%%yyGMM)))xx7<<'''#6#>#>> 	VU	V>r   c                   R RRR /R RRR /3p\        R ^ .RVRR/R	7      pVP                  R
8  g   Q hVP                  '       g   Q h\        R ^ .RVRR/R	7      pVP                  R
8  g   Q hVP                  '       d   Q hR# )rZ   r[   r$   c                     ^V ,
          # )   r'   r#   s   &r   <lambda>?TestCobyla.test_minimize_constraint_violation.<locals>.<lambda>V       !a%r   c                     V ^,
          # )   r'   rr   s   &r   rs   rt   W   ru   r   c                     V # r+   r'   rr   s   &r   rs   rt   X       r   r\   catolg333333?r]   r^   r`   g?c                     V # r+   r'   rr   s   &r   rs   rt   \   ry   r   g?N)r   rg   re   )r   rj   rk   s   &  r   "test_minimize_constraint_violation-TestCobyla.test_minimize_constraint_violationS   s     88:{QCd '~/yy3{{{{{QCd '~/yy3;;;;r   c                    ^p\        R R.RRV/R7      pVP                  ^8X  g   Q hVP                  '       g   Q hVP                  V8:  g   Q hR# )   c                     V ^,          #    r'   rr   s   &r   rs   *TestCobyla.test_f_target.<locals>.<lambda>c   s    Ar   i  r\   f_target)r]   r`   N)r   statusre   r$   )r   r   rk   s   &  r   test_f_targetTestCobyla.test_f_targeta   sQ    ~uX *H57zzQ{{{{ww("""r   c                B   \        R R .R R 4      p\        V P                  V P                  RVV P                  R7      p^\
        P                  ! ^4      ,
          ^,          \
        P                  ! ^4      ^,
          ^,          .p\        VP                  VRR7       VP                  '       g   Q VP                  4       hVP                  R8  g   Q V4       hVP                  ^d8:  g   Q V4       hVP                  V P                  V4      R,           8  g   Q V4       hR# )g      ?r\   r{   r3   r4   g:0yE>ra   N)r	   r   r$   r   r   r   r   r   r#   re   rf   rg   rh   )r   r^   rk   r   s   &   r    test_minimize_linear_constraints+TestCobyla.test_minimize_linear_constraintsi   s    &Sz3<HHGG#II
 ^q(2771:>Q*>?xd3{{{'CKK'{yy4$$xx3##ww(+d227C72r   )r   r   r   N)rG   rH   rI   rJ   r   r$   r(   r,   r6   rm   r}   r   r   rK   rL   rM   s   @r   r   r      s9     %&&5-V^#8 8r   r   c                  2  a
 R  o
V
3R lp R pR p\         P                  ! ^^ .4      pS
W.pRR.pRp\        S
W4RR7      p\        WuR	R
7       \        S
W0RR7      p\        S
! V4      ^R	R
7       V Uu. uF	  pRRRV/NK  	  p	p\	        S
W9RR7      p\        VP
                  VR	R
7       VP                  '       g   Q VP                  4       h\        VP                  VR	R
7       RRRV /p	\	        S
W9RR7      p\        VP                  ^R	R
7       R# u upi )c                 h    V ^ ,          ^,
          ^,          V ^,          R,
          ^,          ,           # )r   g      @r'   rr   s   &r   r$   $test_vector_constraints.<locals>.fun}   s%    !q1}!s
Q..r   c                 "   < S! V 4      ^,
          # )r/   r'   )r#   r$   s   &r   fmin%test_vector_constraints.<locals>.fmin   s    1vzr   c           	      >   \         P                  ! . RO. RO. RO.4      p\         P                  ! \        \        V4      4       Uu. uFG  pW^ 3,          V ^ ,          ,          W^3,          V ^,          ,          ,           W^3,          ,           NKI  	  up4      # u upi )r/   )r/   r   )r      )r   r   r   )r   arrayrangelen)r#   ais   &  r   cons1&test_vector_constraints.<locals>.cons1   s    HHj+z:;xx*/A-9*7Q a41Q4!qD'AaD.8a4! !*79 : 	: 9s   ABc                     V # r+   r'   rr   s   &r   cons2&test_vector_constraints.<locals>.cons2   s    r   gffffff?g333333?g?r0   )r1   r3   r4   rZ   r[   r$   )r^   r   N)	r   r   r   r   r   r#   re   rf   r$   )r   r   r   r   	cons_listxsolfsolrk   rj   r^   r$   s             @r   test_vector_constraintsr   z   s   /:
 
1a&	Be#I:DD c2
6CCD)
c2D
1CCHad+ >GGYTFFE40YKG
3
>CCEE4d+;;;##;CGGT-65$/K
3
>CCGGQT* Hs   4Dc                   ,   a  ] tR t^t o R tR tRtV tR# )
TestBoundsc                    R  p. ROp. ROp\        W#4       UUu. uF  w  rEWE3NK
  	  ppp\        V. RORVR7      p. R	OpVP                  '       g   Q h\        VP                  VRR7       R# u uppi )
c                 <    \         P                  ! V ^,          4      # r   r   sumrr   s   &r   f TestBounds.test_basic.<locals>.f       66!Q$<r   Nr\   r   r]   boundsra   r4   )r   Nr/   N      )r   r   NNr   )r/   r      rq   rw   )r   r   r/   r   r   )zipr   re   r   r#   )	r   r   lbubr   br   resrefs	   &        r   
test_basicTestBounds.test_basic   si    	  '+%([1[TQ1&[1 q_XfM&{{{{s. 2s   A.c                   R  p\        \        P                  ) \        P                  ) .\        P                  \        P                  .4      p\        V^^.RVR7      pVP                  '       g   Q h\        VP                  ^ RR7       \        ^\        P                  ) .\        P                  \        P                  .4      p\        V^^.RVR7      pVP                  '       g   Q h\        VP                  ^^ .RR7       R# )c                 <    \         P                  ! V ^,          4      # r   r   rr   s   &r   r   $TestBounds.test_unbounded.<locals>.f   r   r   r\   r   ra   r4   N)r   r   rd   r   re   r   r#   )r   r   r   r   s   &   r   test_unboundedTestBounds.test_unbounded   s    	  "&&266'*RVVRVV,<=qaVHVD{{{{qt,RVVGrvvrvv&67qaVHVD{{{{1vD1r   r'   N)rG   rH   rI   rJ   r   r   rK   rL   rM   s   @r   r   r      s     
/2 2r   r   )r   numpyr   numpy.testingr   r   scipy.optimizer   r   r   r   r	   r
   r   r   r   r'   r   r   <module>r      s5      D k8 k8\'+T2 2r   