o
    tBhh                     @   sx  d dl Z d dlZd dlZd dlmZmZ d dlmZ d dlm	Z	 G dd dZ
dd ZG d	d
 d
e
Zeddgd d gdZeddgd d gdZeddgd d gdZG dd de
Zedgdgdedgdgdgdgdgdgdgdgdgdgg
eg ddZedgdgdgedggedgdZG d d! d!e
Zed"d#gd$d%gd&d'ZG d(d) d)e
Zed*gd+ g d,d-d'ZG d.d/ d/e
Zed0d0gd1gd2d3gd4ZG d5d6 d6e
Zd7Zeed8gd7 d9gd7 Zeed:gg d;d4ZG d<d= d=e
Z e d*d*gd>gd?d?gd4Z!G d@dA dAe
Z"e"d"dBgddd4Z#			FdQdGdHZ$G dIdJ dJZ%G dKdL dLZ&G dMdN dNZ'G dOdP dPZ(dS )R    N)raiseswarns)shgo)SHGOc                   @   s   e Zd Z		dddZdS )StructTestFunctionNc                 C   s"   || _ || _|| _|| _|| _d S )Nbounds
expected_xexpected_funexpected_xlexpected_funl)selfr   r	   r
   r   r    r   v/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/scipy/optimize/tests/test__shgo.py__init__
   s
   
zStructTestFunction.__init__)NNN)__name__
__module____qualname__r   r   r   r   r   r   	   s    r   c                 C   s\   g }| d ur*t | turt | tur| f} n	 | D ]
} |d| d qt|}|S d }|S )Nineq)typefun)r   tuplelistappend)gconsr   r   r   wrap_constraints   s   
r   c                   @   s$   e Zd Zdd Zdd ZeeZdS )StructTest1c                 C      |d d |d d  S Nr         r   r   xr   r   r   f$      zStructTest1.fc                 C   s   t j| ddd  S )Nr   axisg      @numpysumr#   r   r   r   r   '      zStructTest1.gNr   r   r   r$   r   r   r   r   r   r   r   r   #   s    r   )   )r   r	   )r   r!   )NNc                   @   s(   e Zd ZdZdd Zdd ZeeZdS )StructTest2zN
    Scalar function with several minima to test all minimizer retrievals
    c                 C   s   |d t | S )N   )r)   sinr"   r   r   r   r$   :      zStructTest2.fc                 C   s   dt j| dd S )N:   r   r&   r(   r+   r   r   r   r   =   r3   zStructTest2.gNr   r   r   __doc__r$   r   r   r   r   r   r   r   r0   5   s
    r0   )r   <   g⡽4$?0_r<g GK@g
]<@gI{_H@gi<&,@g>E@gqŤCQ4@g8$B@go.n:@g^5	>@)
r8   gs8g^V&+6g+?-2g+!/gN|1(gc=C#g^\gNg自ݿr   )r   g      @c                   @   s8   e Zd ZdZdd Zdd Zdd ZeefZeeZ	dS )	StructTest3a  
    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                 C   s   d|d d  |d d  S )Ng{Gz?r   r    r!   r   r"   r   r   r   r$   r      zStructTest3.fc                 C   s   | d | d  d S )Nr   r!         9@r   r+   r   r   r   g1u   r,   zStructTest3.g1c                 C   s   | d d | d d  d S )Nr   r    r!   r;   r   r+   r   r   r   g2x   r:   zStructTest3.g2N)
r   r   r   r6   r$   r<   r=   r   r   r   r   r   r   r   r9   a   s    r9   )r    2   )r   r>   g'In/@gS[:XL?g      @)r   r	   r
   c                   @   L   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d ZeeeefZ	e
e	ZdS )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                 C   s   |d d d d|d d d   |d d  d|d d	 d   d|d d
   d|d d   |d
 d  d|d  |d
   d|d   d|d
   S )Nr   
   r       r!               r/         r   r"   r   r   r   r$      s&   .

zStructTest4.fc                 C   sJ   d| d d  d| d d   | d  d| d d   d| d   d  S )Nr    r   rE   r!   rD   rB      r   r+   r   r   r   r<      s
   6
zStructTest4.g1c                 C   s>   d| d  d| d   d| d d   | d  | d  d  S )	NrG   r   rE   r!   rA   r    rD   g     q@r   r+   r   r   r   r=      s   >zStructTest4.g2c                 C   s:   d| d  | d d  d| d d   d| d   d  S )	N   r   r!   r    r/   rB   rH      r   r+   r   r   r   g3   s   :zStructTest4.g3c                 C   sZ   d| d d  | d d  d| d  | d   d| d d   d| d   d| d    S )	NrD   r   r    r!   rE   rB   rF   r/   r   r+   r   r   r   g4   s
   >

zStructTest4.g4Nr   r   r   r6   r$   r<   r=   rL   rM   r   r   r   r   r   r   r   r@      s    r@   )irA   rG   )gܤ@g$H8?g	޿g0ev@gn8)gk_@/?g0g+?gP{[
E@c                   @       e Zd Zdd ZdZeeZdS )StructTest5c              
   C   sb   |d d  t t t|d d |d d   |d t t t|d |d d    S )Nr!   g     G@r          @)r)   r2   sqrtabsr"   r   r   r   r$      s
   &*zStructTest5.fNr-   r   r   r   r   rP          rP   )i i   g g      @gyCy@)r   r
   r	   c                   @   s$   e Zd ZdZdd ZdZeeZdS )StructTestLJzV
    LennardJones objective function. Used to test symmetry constraints settings.
    c                 G   s   |d | _ t| j d }d}t|d D ]T}t|d |D ]J}d| }d| }|| ||  }	||d  ||d   }
||d  ||d   }|	|	 |
|
  ||  }|| | }|dkrg|d| d | 7 }qq|S )Nr   rE           r!   r    g      ?rQ   )Nintrange)r   r#   argsksijabxdydzdedudr   r   r   r$      s"   
zStructTestLJ.fNr5   r   r   r   r   rU      s
    rU   r/   g      g      @g      )/Ur]rf   g) rf   rf   g=S c                   @   rO   )StructTestTablec                 C   s    |d dkr|d dkrdS dS )Nr         @r!   r>   d   r   r"   r   r   r   r$      s   zStructTestTable.fNr-   r   r   r   r   rg      rT   rg   r>   rh   c                   @   r?   )StructTestInfeasiblez0
    Test function with no feasible domain.
    c                 G   r   r   r   )r   r#   rZ   r   r   r   r$      r%   zStructTestInfeasible.fc                 C   s   | d | d  d S Nr   r!   r   r+   r   r   r   r<     r,   zStructTestInfeasible.g1c                 C   s   | d | d  d  S rk   r   r+   r   r   r   r=        zStructTestInfeasible.g2c                 C   s   | d  | d  d S rk   r   r+   r   r   r   rL     rl   zStructTestInfeasible.g3c                 C   s   | d  | d  d  S rk   r   r+   r   r   r   rM   
  r%   zStructTestInfeasible.g4NrN   r   r   r   r   rj      s    rj   )r.   r!   r   h㈵>   sobolc	           
      C   s   t | j| j|| j||||||d
}	t|	 | jd ur'tjj	|	j
| j||d | jd ur7tjj	|	j| j|d | jd urGtjj	|	j| j|d | jd urWtjj	|	j| j|d d S )N)rZ   constraintsniterscallbackminimizer_kwargsoptionssampling_methodrtolatolry   )r   r$   r   r   logginginfor	   r)   testingassert_allcloser#   r
   r   r   xlr   funl)
testrZ   	test_atolrq   rr   rs   rt   ru   rv   resr   r   r   run_test  s6   







r   c                   @   s`   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	e
jjdd Zdd Zdd ZdS )TestShgoSobolTestFunctionsz8
    Global optimization tests with Sobol sampling:
    c                 C      t t dS )VMultivariate test function 1:
        x[0]**2 + x[1]**2 with bounds=[(-1, 6), (-1, 6)]Nr   test1_1r   r   r   r   test_f1_1_sobol?     z*TestShgoSobolTestFunctions.test_f1_1_sobolc                 C   r   )zUMultivariate test function 1:
         x[0]**2 + x[1]**2 with bounds=[(0, 1), (0, 1)]Nr   test1_2r   r   r   r   test_f1_2_sobolD  r   z*TestShgoSobolTestFunctions.test_f1_2_sobolc                 C   r   )z_Multivariate test function 1:
        x[0]**2 + x[1]**2 with bounds=[(None, None),(None, None)]Nr   test1_3r   r   r   r   test_f1_3_sobolI  r   z*TestShgoSobolTestFunctions.test_f1_3_sobolc                 C   r   )RUnivariate test function on
        f(x) = (x - 30) * sin(x) with bounds=[(0, 60)]Nr   test2_1r   r   r   r   test_f2_1_sobolN  r   z*TestShgoSobolTestFunctions.test_f2_1_sobolc                 C   r   )NUnivariate test function on
        f(x) = (x - 30) * sin(x) bounds=[(0, 4.5)]Nr   test2_2r   r   r   r   test_f2_2_sobolS  r   z*TestShgoSobolTestFunctions.test_f2_2_sobolc                 C   r   )%NLP: Hock and Schittkowski problem 18Nr   test3_1r   r   r   r   test_f3_sobolX  s   z(TestShgoSobolTestFunctions.test_f3_sobolc                 C      ddi}t td|d dS )?NLP: (High-dimensional) Hock and Schittkowski 11 problem (HS11)infty_constraintsFi   rq   ru   Nr   test4_1r   ru   r   r   r   test_f4_sobol\  s   z(TestShgoSobolTestFunctions.test_f4_sobolc                 C   s   t tdd dS )NLP: Eggholder, multimodal@   )rq   Nr   test5_1r   r   r   r   test_f5_1_sobold  s   z*TestShgoSobolTestFunctions.test_f5_1_sobolc                 C      t tddd dS )r   rn   rB   )rq   rr   Nr   r   r   r   r   test_f5_2_sobolh     z*TestShgoSobolTestFunctions.test_f5_2_sobolN)r   r   r   r6   r   r   r   r   r   r   pytestmarkslowr   r   r   r   r   r   r   r   9  s    
r   c                   @   sX   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	e
jjdd Zdd ZdS )TestShgoSimplicialTestFunctionsz=
    Global optimization tests with Simplicial sampling:
    c                 C   r   )r   r!   
simplicialrq   rv   Nr   r   r   r   r   test_f1_1_simplicialw  r   z4TestShgoSimplicialTestFunctions.test_f1_1_simplicialc                 C   r   )zTMultivariate test function 1:
        x[0]**2 + x[1]**2 with bounds=[(0, 1), (0, 1)]r!   r   r   Nr   r   r   r   r   test_f1_2_simplicial|  r   z4TestShgoSimplicialTestFunctions.test_f1_2_simplicialc                 C   r   )z_Multivariate test function 1: x[0]**2 + x[1]**2
        with bounds=[(None, None),(None, None)]r!   r   r   Nr   r   r   r   r   test_f1_3_simplicial  r   z4TestShgoSimplicialTestFunctions.test_f1_3_simplicialc                 C   s   ddi}t td|dd dS )r   minimize_every_iterFrG   r   )rr   ru   rv   Nr   r   r   r   r   test_f2_1_simplicial  s   
z4TestShgoSimplicialTestFunctions.test_f2_1_simplicialc                 C   r   )r   r!   r   r   Nr   r   r   r   r   test_f2_2_simplicial  r   z4TestShgoSimplicialTestFunctions.test_f2_2_simplicialc                 C   r   )r   r!   r   r   Nr   r   r   r   r   test_f3_simplicial  s   z2TestShgoSimplicialTestFunctions.test_f3_simplicialc                 C   r   )r   r!   r   r   Nr   r   r   r   r   test_f4_simplicial  r   z2TestShgoSimplicialTestFunctions.test_f4_simplicialc                 C   s&   ddd}d}t t|d|ddd dS )z&LJ: Symmetry-constrained test functionT)symmetrydisp)r/   NrD   r   )rZ   rq   ru   rr   rv   )r   testLJ)r   ru   rZ   r   r   r   test_lj_symmetry  s   
z0TestShgoSimplicialTestFunctions.test_lj_symmetryN)r   r   r   r6   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  s    
r   c                   @   s   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Ze	j
jdd Ze	j
jdd Ze	j
jdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Zd/d0 Zd1d2 Zd3d4 Zd5S )6TestShgoArgumentsc                 C      t tdddd dS )z>Iterative simplicial sampling on TestFunction 1 (multivariate)Nr    r   rq   rr   rv   r   r   r   r   r   test_1_1_simpl_iter     z%TestShgoArguments.test_1_1_simpl_iterc                 C   s   ddi}t tdd|dd dS )z3Iterative simplicial on TestFunction 2 (univariate)r   FNrG   r   rq   rr   ru   rv   r   r   r   r   r   test_1_2_simpl_iter     

z%TestShgoArguments.test_1_2_simpl_iterc                 C   r   )z9Iterative Sobol sampling on TestFunction 1 (multivariate)Nr!   ro   r   r   r   r   r   r   test_2_1_sobol_iter  r   z%TestShgoArguments.test_2_1_sobol_iterc                 C   sL   t tjtjtjdddd}tjj|jtj	ddd tjj|j
tjdd dS )z7Iterative Sobol sampling on TestFunction 2 (univariate)Nr!   ro   )rp   rq   rr   rv   rm   rw   rz   )r   r   r$   r   r   r)   r}   r~   r#   r	   r   r
   r   r   r   r   r   test_2_2_sobol_iter  s   z%TestShgoArguments.test_2_2_sobol_iterc              	   C   sR   dd }t tfD ]}t|j|jdd|ddid t|j|jdd|ddid qd	S )
zCIterative sampling on TestFunction 1 and 2  (multi- and univariate)c                 S      t d d S Nz Local minimization callback testprintr+   r   r   r   callback_func     zATestShgoArguments.test_3_1_disp_simplicial.<locals>.callback_funcr!   r   r   Trr   rv   rs   ru   rq   rv   rs   ru   Nr   r   r   r$   r   r   r   r   r   r   r   test_3_1_disp_simplicial  s   z*TestShgoArguments.test_3_1_disp_simplicialc              	   C   sR   dd }t tfD ]}t|j|jdd|ddid t|j|jdd|ddid	 qd
S )zBIterative sampling on TestFunction 1 and 2 (multi- and univariate)c                 S   r   r   r   r+   r   r   r   r     r   z<TestShgoArguments.test_3_2_disp_sobol.<locals>.callback_funcr!   ro   r   Tr   r   r   Nr   r   r   r   r   test_3_2_disp_sobol  s   z%TestShgoArguments.test_3_2_disp_sobolc                 C   s$   t jddd}tt dd|dd dS )z,Test known function minima stopping criteriaư>T)f_minf_tolr   Nrm   r   rq   r   ru   rv   r   r
   r   r   r   r   r   test_4_1_known_f_min  s   

z&TestShgoArguments.test_4_1_known_f_minc                 C   s&   t jdddd}tt dd|dd dS )	*Test Global mode limiting local evalutionsr   Tr!   )r   r   r   
local_iterNrm   r   r   r   r   r   r   r   test_4_2_known_f_min  s   

z&TestShgoArguments.test_4_2_known_f_minc                 C   s(   t jddddd}tt dd|dd	 d
S )r   r   Tr!   Fr   r   r   r   r   i   rm   ro   r   Nr   r   r   r   r   test_4_3_known_f_min  s   

z&TestShgoArguments.test_4_3_known_f_minc              	   C   sJ   t jddddd}tt jt jt jdd|dd}tjj|j	t j
d	d	d
 dS )z<Test Global mode limiting local evalutions for 1-D functionsr   Tr!   Fr   Nro   rp   rq   rr   ru   rv   rm   rw   )r   r
   r   r$   r   r   r)   r}   r~   r#   r	   r   ru   r   r   r   r   test_4_4_known_f_min  s   
z&TestShgoArguments.test_4_4_known_f_minc                 C   s0   t tjtjtjd}tjj|jtj	ddd dS )z;Test Default simplicial sampling settings on TestFunction 1rp   rm   rw   N
r   r   r$   r   r   r)   r}   r~   r#   r	   r   r   r   r   test_5_1_simplicial_argless  s   
z-TestShgoArguments.test_5_1_simplicial_arglessc                 C   s2   t tjtjtjdd}tjj|jtj	ddd dS )z6Test Default sobol sampling settings on TestFunction 1ro   )rp   rv   rm   rw   Nr   r   r   r   r   test_5_2_sobol_argless  s   
z(TestShgoArguments.test_5_2_sobol_arglessc                 C   R   ddi}t tjtjtj|dd}tjj|jtj	ddd tjj|j
tjdd dS )	:Test that maximum iteration option works on TestFunction 3max_iterr    r   rp   ru   rv   rm   rw   rz   Nr   r   r$   r   r   r)   r}   r~   r#   r	   r   r
   r   r   r   r   test_6_1_simplicial_max_iter     z.TestShgoArguments.test_6_1_simplicial_max_iterc                 C   r   )	r   min_iterr    r   r   rm   rw   rz   Nr   r   r   r   r   test_6_2_simplicial_min_iter$  r   z.TestShgoArguments.test_6_2_simplicial_min_iterc                 C   sB   dD ]}|t jd}td| td tt dd|dd qd	S )
z@Test the minimizer_kwargs arguments for solvers with constraints)COBYLASLSQP)methodrp   Solver = {}d====================================================================================================rn   MbP?ro   rq   r   rt   rv   N)r   r   r   formatr   )r   solverrt   r   r   r   test_7_1_minkwargs-  s   z$TestShgoArguments.test_7_1_minkwargsc                 C   s0   ddi}ddi}t tjtjtjd ||d dS )z'Test the minimizer_kwargs default initsftolrm   r   Tr   )rp   rt   ru   Nr   r   r$   r   r   )r   rt   ru   r   r   r   test_7_2_minkwargs:  s
   
z$TestShgoArguments.test_7_2_minkwargsc                 C   sV   dD ]&}dd }dd }|||d}t d| t d ttd	d
|dd qdS )z?Test minimizer_kwargs arguments for solvers without constraints)zNelder-MeadPowellCGBFGSz	Newton-CGzL-BFGS-BTNCdoglegz	trust-ncgztrust-exactztrust-krylovc                 S   s    t d| d  d| d  gjS )Nr    r   r!   )r)   arrayTr+   r   r   r   jacF  s    z1TestShgoArguments.test_7_3_minkwargs.<locals>.jacc                 S   s   t ddgddggS )Nr    r   )r)   r  r+   r   r   r   hessI  rl   z2TestShgoArguments.test_7_3_minkwargs.<locals>.hess)r   r  r  r   r   rn   r   ro   r   N)r{   r|   r   r   r   )r   r   r  r  rt   r   r   r   test_7_3_minkwargsA  s   
z$TestShgoArguments.test_7_3_minkwargsc                 C   s    ddd}t td d |dd d S )Nr!   T)minhgrdr   r   r   r   r   r   r   r   test_8_homology_group_diffT  s   

z,TestShgoArguments.test_8_homology_group_diffc                 C   s   t tjtjtjd d dS )'Test single function constraint passingr   r   Nr   r   r   r   r   test_9_cons_g[  s   zTestShgoArguments.test_9_cons_gc                 C   s$   ddi}t tjtjdd|dd dS )r  maxtimeV瞯<r!   Nro   r   )r   r   r$   r   r   r   r   r   test_10_finite_time_  s   
z%TestShgoArguments.test_10_finite_timec                 C   &   ddd}t tjtjdd|dd dS z*Test to cover the case where f_lowest == 0r  rV   )r  r   r!   Nro   r   r   r   r$   r   r   r   r   r   test_11_f_min_timee     
z$TestShgoArguments.test_11_f_min_timec                 C   r  r  r  r   r   r   r   test_12_sobol_inf_consl  r  z(TestShgoArguments.test_12_sobol_inf_consc                 C   r   )z6Test limited local iterations for a pseudo-global moder   rD   r   r   Nr   r   r   r   r   test_14_local_iters  s   z$TestShgoArguments.test_14_local_iterc                 C   s   ddi}t tdd|dd dS )z9Test minimize every iter options and cover function cacher   Tr!   rG   ro   r   Nr   r   r   r   r   test_15_min_every_iterx  r   z(TestShgoArguments.test_15_min_every_iterc                 C   s$   ddi}ddi}t td||d dS )z:Test disp=True with minimizers that do not support bounds r   Tr   znelder-meadr   )rv   ru   rt   Nr   )r   ru   rt   r   r   r   test_16_disp_bounds_minimizer~  s
   
z/TestShgoArguments.test_16_disp_bounds_minimizerc                 C   s   dd }t td|d dS )z=Test the functionality to add custom sampling methods to shgoc                 S   s   t jj| |fdS )N)size)r)   randomuniform)rq   dr   r   r   sample  r3   z9TestShgoArguments.test_17_custom_sampling.<locals>.sampler1   r   Nr   )r   r  r   r   r   test_17_custom_sampling  s   z)TestShgoArguments.test_17_custom_samplingN) r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r	  r  r  r  r  r  r  r  r  r  r   r   r   r   r     s<    	



		r   c                   @   s\   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd ZdS )TestShgoFailuresc                 C   sD   ddi}t tjtjdd|dd}tjd|j tjd|j dS )z'Test failure on insufficient iterationsmaxiterr    rD   Nro   r   F)	r   r   r$   r   r)   r}   assert_equalsuccessnfevr   r   r   r   test_1_maxiter  s   zTestShgoFailures.test_1_maxiterc                 C   s   t tttjtjdd dS )z$Rejection of unknown sampling method	not_Sobol)rv   N)assert_raises
ValueErrorr   r   r$   r   r   r   r   r   test_2_sampling  s   
z TestShgoFailures.test_2_samplingc                 C   sD   ddd}t tjtjd|dd}tjd|j tjd|j d	S )
zoCheck that the routine stops when no minimiser is found
           after maximum specified function evaluationsrA   T)maxfevr   rD   ro   rq   ru   rv   F   N)	r   
test_tabler$   r   r)   r}   r"  r#  r$  r   r   r   r   test_3_1_no_min_pool_sobol  s   z+TestShgoFailures.test_3_1_no_min_pool_sobolc                 C   s4   ddd}t tjtjd|dd}tjd|j dS )	zoCheck that the routine stops when no minimiser is found
           after maximum specified sampling evaluationsrA   Tmaxevr   rE   r   r+  FN)r   r-  r$   r   r)   r}   r"  r#  r   r   r   r   test_3_2_no_min_pool_simplicial  s   z0TestShgoFailures.test_3_2_no_min_pool_simplicialc                 C      ddg}t tttj| dS )zSpecified bounds ub > lb)r/   rE   rE   rB   Nr'  r(  r   r   r$   r   r   r   r   r   test_4_1_bound_err     z#TestShgoFailures.test_4_1_bound_errc                 C   r2  )z)Specified bounds are of the form (lb, ub))rE   rB   rB   r3  Nr4  r5  r   r   r   test_4_2_bound_err  r7  z#TestShgoFailures.test_4_2_bound_errc                 C   s8   ddd}t tjtjtjd|dd}tjd|j dS )zxEnsures the algorithm terminates on infeasible problems
           after maxev is exceeded. Use infty constraints optionr   Tr/  ro   rp   rq   ru   rv   FN	r   test_infeasibler$   r   r   r)   r}   r"  r#  r   r   r   r   test_5_1_1_infeasible_sobol     
z,TestShgoFailures.test_5_1_1_infeasible_sobolc                 C   s:   dddd}t tjtjtjd|dd}tjd|j dS )zEnsures the algorithm terminates on infeasible problems
           after maxev is exceeded. Do not use infty constraints optionr   TF)r0  r   r   ro   r9  Nr:  r   r   r   r   test_5_1_2_infeasible_sobol  s   
z,TestShgoFailures.test_5_1_2_infeasible_sobolc                 C   s8   ddd}t tjtjtjd|dd}tjd|j dS )z[Ensures the algorithm terminates on infeasible problems
           after maxev is exceeded.i  Fr/  ri   r   r9  Nr:  r   r   r   r   test_5_2_infeasible_simplicial  r=  z/TestShgoFailures.test_5_2_infeasible_simplicialc                 C   sP   t jd ddddd}t jt jf}t jdd|dd	}tttg|R i | dS )
z;Test Global mode limiting local evalutions with f* too highrQ   r   Tr!   Fr   Nro   r   )r   r
   r$   r   r   r   UserWarningr   )r   ru   rZ   kwargsr   r   r   test_6_1_lower_known_f_min  s   z+TestShgoFailures.test_6_1_lower_known_f_minN)r   r   r   r%  r)  r.  r1  r6  r8  r<  r>  r?  rB  r   r   r   r   r     s    		r   )r   rm   rn   NNNNro   ))r{   r)   r   r   r'  r   scipy.optimizer   scipy.optimize._shgor   r   r   r   r   r   r   r0   r  r   r   r9   r   r@   r   rP   r   rU   rW   r   zipboundsLJr   rg   r-  rj   r;  r   r   r   r   r   r   r   r   r   <module>   s    



"
"94 h