
    bi                     2   d Z ddlZddlZddlZddlZddlZddlmZ	 ddl
mZ ddlZddlmc mZ ddlmZmZ ddlmZ ddlmZmZmZmZmZmZmZ ddlm Z   ejB                  dev d       G d	 d
e             Z" G d de      Z# ejB                  dev d       G d de             Z$ ejB                  dev d       G d de             Z% ejB                  dev d       G d de             Z&d Z' ejB                   e'       d       G d dejP                               Z) ejB                  dev d       G d de             Z* ejB                  d ev d!       G d" d#e             Z+did$Z,ejZ                  j]                  d%evd&'       G d( d)             Z/ ejB                  d*ev d+       G d, d-ejP                               Z0 ejB                  d.ev d/       G d0 d1ejP                               Z1 ejB                  d2ev d3       G d4 d5ejP                               Z2 ejB                  d6ev d7       G d8 d9e             Z3 ejB                  d:ev d;       G d< d=e             Z4 ejB                  d>ev d?       G d@ dAe             Z5 ejB                  dBev dC       G dD dEe             Z6 ejB                  dFev dG       G dH dIe             Z7 ejB                  dJev dK       G dL dMejP                               Z8ejZ                  j]                  dNevdO'       G dP dQ             Z9 G dR dSe      Z: ejB                  dev dT       G dU dVejP                               Z; G dW dXejP                        Z< ejB                  dYev dZ       G d[ d\ejP                               Z= ejB                  d]ev d^       G d_ d`e             Z>da Z? ejB                   e?       db       G dc dde             Z@ ejB                  deev df       G dg dhejP                               ZAy)ja4  
Copyright 2019, the CVXPY developers.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
    N)INSTALLED_MI_SOLVERSINSTALLED_SOLVERS)BaseTest)StandardTestECPsStandardTestLPsStandardTestMixedCPsStandardTestPCPsStandardTestQPsStandardTestSDPsStandardTestSOCPs)VersionECOSzECOS is not installed.c                   |    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dZddZddZddZy)TestECOSNc                    t        j                  d      | _        t        j                  d      | _        t        j                  d      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  dd	      | _        t        j                  d
d      | _        t        j                  d
d      | _	        t        j                  dd      | _
        y Nanamebc   x   yzr   r   ABr   r   CcpVariabler   r   r   r   r   r   r   r   r!   selfs    Y/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/tests/test_conic_solvers.pysetUpzTestECOS.setUp0       #&#&#&QS)QS)QS)V#.V#.V#.    c                    d}t        j                  t        j                  t        j                  | j                  d      dz         | j                  dk(  g      }t        d      D ]+  }|j                  t         j                  ||||||ddd
       - | j                  |j                  d       | j                  | j                  j                  ddg       y	)
z4Test that all the ECOS solver options work.
        -C6?         ?r   r      T)
solverfeastolabstolreltolfeastol_inaccabstol_inaccreltol_inacc	max_itersverbose
warm_startN)r#   ProblemMinimizenormr   rangesolver   assertAlmostEqualvalueassertItemsAlmostEqual)r&   EPSprobis       r'   test_ecos_optionszTestECOS.test_ecos_options=   s     zz"++bggdffa&83&>?$&&A+Oq 	DAJJbggs3s%(s!#Td  D	D 	tzz3/##DFFLL1a&9r*   c                 0    t        j                  d       y Nr   r0   r   	test_lp_0r%   s    r'   test_ecos_lp_0zTestECOS.test_ecos_lp_0M       !!0r*   c                 0    t        j                  d       y rG   r   	test_lp_1r%   s    r'   test_ecos_lp_1zTestECOS.test_ecos_lp_1P   rL   r*   c                 0    t        j                  d       y rG   r   	test_lp_2r%   s    r'   test_ecos_lp_2zTestECOS.test_ecos_lp_2S   rL   r*   c                 0    t        j                  d       y rG   r   	test_lp_3r%   s    r'   test_ecos_lp_3zTestECOS.test_ecos_lp_3V   rL   r*   c                 0    t        j                  d       y rG   r   	test_lp_4r%   s    r'   test_ecos_lp_4zTestECOS.test_ecos_lp_4Y   rL   r*   c                 0    t        j                  d       y rG   r   	test_lp_5r%   s    r'   test_ecos_lp_5zTestECOS.test_ecos_lp_5\   rL   r*   c                 0    t        j                  d       y rG   r   test_socp_0r%   s    r'   test_ecos_socp_0zTestECOS.test_ecos_socp_0_       %%V4r*   c                 0    t        j                  d       y rG   r   test_socp_1r%   s    r'   test_ecos_socp_1zTestECOS.test_ecos_socp_1b   re   r*   c                 0    t        j                  d       y rG   r   test_socp_2r%   s    r'   test_ecos_socp_2zTestECOS.test_ecos_socp_2e   re   r*   c                 \    t        j                  d       t        j                  d       y rG   r   test_socp_3ax0test_socp_3ax1r%   s    r'   test_ecos_socp_3zTestECOS.test_ecos_socp_3h       ((7((7r*   c                 0    t        j                  d       y rG   r   test_expcone_1r%   s    r'   test_ecos_expcone_1zTestECOS.test_ecos_expcone_1n       ''v6r*   c                 0    t        j                  d       y rG   r   test_exp_soc_1r%   s    r'   test_ecos_exp_soc_1zTestECOS.test_ecos_exp_soc_1q       ++6:r*   returnN)__name__
__module____qualname__r(   rE   rK   rP   rT   rX   r\   r`   rd   ri   rm   rr   rw   r|    r*   r'   r   r   -   sH    /: 11111155587;r*   r   c                   *    e Zd ZdZd$dZd%deddf fdZd%deddf f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$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  Z d$d!Z!d$d"Z"d$d#Z# xZ$S )&TestSCSz Unit tests for SCS. r   Nc                    t        j                  dd      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  dd	      | _        y )
Nr   r   r   r   r   r   r   r    r!   r#   r$   r   r   r   r   r!   r%   s    r'   r(   zTestSCS.setUpx   s\    QS)QS)V#.V#.V#.r*   placesc                 2    t         t        |   |||       y Nr   )superr   rA   r&   r   r   r   	__class__s       r'   rA   zTestSCS.assertItemsAlmostEqual   s    gt3Aq3Hr*   c                 2    t         t        |   |||       y r   )r   r   r?   r   s       r'   r?   zTestSCS.assertAlmostEqual   s    gt.q!F.Cr*   c           
         d}t         j                  j                  d       t         j                  j                  |      }t         j                  j                  ||      }t        j                  ||j                               }t        j                  |      }t        j                  t        j                  t        j                  ||            t        j                  |      dk(  d|k  |dk  ||z  t        j                  |      dz
  k\  g      }|j                  t        j                         |j                  t        j                   t        j"                  hv sJ y)z5Test that SCS retry doesn't trigger a crash.
        r/   i;  r-   r   ư>N)nprandomseedranddot	transposer#   r$   r:   r;   QuadFormsummaxr>   SCSstatusOPTIMALOPTIMAL_INACCURATE)r&   n_secmu
random_matr!   r   rC   s          r'   test_scs_retryzTestSCS.test_scs_retry   s     
		sYYe$YY^^E51
FF:z3356KKzz"++bkk!Q&7866!9>66r6RVVBZ$%6689
 	

266{{rzz2+@+@AAAAr*   c           
         d}t        j                  dd      }t        j                  t        j                  t        j                  |d      dz         |dk(  g      }t        d      D ](  }|j                  t         j                  d|d	d
d
d       * | j                  |j                  dd       | j                  |j                  ddgd       y)z3Test that all the SCS solver options work.
        r,   r   r   r   r-   r.   r   2   g333333?TF)r0   r7   epsalphar8   	normalizeuse_indirectr   N)r#   r$   r:   r;   r<   r=   r>   r   r?   r@   rA   )r&   rB   r   rC   rD   s        r'   test_scs_optionszTestSCS.test_scs_options   s     KK$zz"++bggamc&9:Q!VHEq 	IAJJbff3#t%  I	I 	tzz3q9##AGGaVA#>r*   c                 v   t        j                  t        j                  t        j                  | j                                    }| j                  dt
        j                  gk  g}t        j                  ||      }|j                  t         j                        }| j                  |d       | j                  | j                  j                  dt
        j                  g       t        j                  t        | j                              }t        j                  | j                        dk\  | j                  ddgk  g}t        j                  ||      }|j                  t         j                        }| j                  |d       | j                  | j                  j                  ddg       t        j                  t        j                  | j                        d         }| j                  dt
        j                  gk  g}t        j                  ||      }|j                  t         j                        }y )Nr-   rH   r   r   )r#   Maximizer   logr   mather:   r>   r   r?   rA   r@   r;   )r&   objconstrpresults        r'   test_log_problemzTestSCS.test_log_problem   s   kk"&&01&&QK'(JJsF#'vq)##DFFLL1dff+> kk#dff+&&&.A%tvv!Q'78JJsF#'vq)##DFFLL1a&9 kk"&&.+,&&QK'(JJsF#'r*   c                    t        j                  g dg dg      }| j                  |k(  g}t        j                  t        j                  t        j
                  | j                  d            |      }|j                  t         j                        }| j                  |t        j
                  |d      j                         | j                  | j                  j                  |j                         y)zTest sigma_max.
        r-   r   r            r   rH   N)r#   Constantr!   r:   r;   r<   r>   r   r?   r@   rA   )r&   constr   rC   r   s        r'   test_sigma_maxzTestSCS.test_sigma_max   s     Y	23&&E/"zz"++bggdffa&896B266*vrwwua'8'>'>?##DFFLL%++>r*   c                 \   t        j                  g dg dg dg      }t        j                  dd      }t        j                  t        j                  d      ||k(  g      }|j                  t         j                         | j                  |j                  t         j                         y	)
zTest sdp var.
        r   r   )      	   )r   r   T)PSDr   rH   N)
r#   r   r$   r:   r;   r>   r   assertEqualr   
INFEASIBLE)r&   r   XrC   s       r'   test_sdp_varzTestSCS.test_sdp_var   sq     Y	9=>KKD)zz"++a.1:,7

"&&
!bmm4r*   c           	      ,   t         j                  j                  d       t        j                  t         j                  j	                  dd      dt         j                  j	                  dd      z  z         }t        j                  |      j                         }t        j                  dd      }t        j                  dd      }t        j                  t        j                  dt        j                  |      z  dt        j                  |      z  z               }t        j                  ||j                         j                   g| |gg      dz	  |dz	  |dz	  g}t        j                   ||      }|j#                  d	      }| j%                  |d   j&                  j(                  d
       | j%                  |d   j&                  j(                  d       | j%                  |d   j&                  j(                  d       | j+                  ||       y)zTest complex matrices.
        r   r   y              ?r   T)complex      ?r   rH   )r   r   r-   N)r   r   r   arrayr   lasvdvalsr   r#   r$   r;   realtracebmatconjTr:   r>   r   
dual_valueshaper?   )	r&   Kn1r   Y	objectiveconstraintsproblemsol_scss	            r'   test_complex_matriceszTestSCS.test_complex_matrices   s    			qHHRYY^^Aq)B11E,EEFZZ]  KK-KK-KKGGC"((1+%bhhqk(99:
	 GGa!&&(**%Aw/0A5FF

 **Y4--u--Q2288&AQ2288&AQ2288&Aw+r*   c                    dD ]  }t        |       t        j                  |      }t        j                  t        j                  t        j
                  |                  }t        j                  |t        j                  |      dk(  g      }|j                  t        j                         | j                  |j                  |d|z  gz          y)z"Test a problem with entr.
        r   
      r-   rH   r.   N)printr#   r$   r   r   entrr:   r>   r   rA   r@   r&   nr   r   r   s        r'   	test_entrzTestSCS.test_entr   s      	;A!HAA++bffRWWQZ01C

3a 01AGG266G"''BqD6:	;r*   c                    dD ]  }t        |       t        j                  |      }t        j                  t        j                  t        j
                  |                  }t        j                  |t        j                  |      dk(  g      }|j                  t        j                         | j                  |j                  |d|z  gz          y)z!Test a problem with exp.
        r   r-   rH   r.   N)r   r#   r$   r;   r   expr:   r>   r   rA   r@   r   s        r'   test_expzTestSCS.test_exp         	;A!HAA++bffRVVAY/0C

3a 01AGG266G"''BqD6:	;r*   c                    dD ]  }t        |       t        j                  |      }t        j                  t        j                  t        j
                  |                  }t        j                  |t        j                  |      dk(  g      }|j                  t        j                         | j                  |j                  |d|z  gz          y)!Test a problem with log.
        r   r-   rH   r.   N)r   r#   r$   r   r   r   r:   r>   r   rA   r@   r   s        r'   test_logzTestSCS.test_log  r   r*   c                    d}t        j                  |      }t        j                  t        j                  t        j                  |                  }t        j
                  |t        j                  |      dk(  g      }|j                  t         j                         |j                  }| j                  ||d|z  gz         |j                  t         j                         |j                  }| j                  ||       y)r   r   r-   rH   r.   N)
r#   r$   r   r   r   r:   r>   r   r@   rA   )r&   r   r   r   r   first_valuesecond_values          r'   test_solve_problem_twicez TestSCS.test_solve_problem_twice  s     KKNkk"&&+,JJsRVVAY!^,-	rvvgg##KBqD6:	rvvww##K>r*   c                    t        j                  d      }t        j                  t        j                  t        j                  |                  }t        j
                  |t        j                  |      dk(  g      }|j                  t         j                        }|j                  j                  }|j                  t         j                  d      }|j                  j                  }| j                  ||d       t        ||kD         y	zTest warm starting.
        r   r-   rH   Tr0   r9   r   r   N)r#   r$   r;   r   r   r:   r>   r   solver_stats
solve_timer?   r   r&   r   r   rC   r   timeresult2time2s           r'   test_warm_startzTestSCS.test_warm_start   s     KKOkk"&&+,zz#q	Q/0266*  ++**BFFt*<!!,,wq9dUlr*   c                    	 ddl }| t        j                  d      }t        j
                  t        j                  t        j                  |                  }t        j                  |t        j                  |      dk(  g      }|j                  t        j                        }|j                  t        j                  d      }| j                  ||d	
       y# t        $ r | j                  d       Y w xY w)z'Test warm starting in diffcvx.
        r   Nzdiffcp not installed.r   r-   rH   Tr   r   r   )diffcpModuleNotFoundErrorskipTestr#   r$   r;   r   r   r:   r>   DIFFCPr?   )r&   r   r   r   rC   r   r   s          r'   test_warm_start_diffcpzTestSCS.test_warm_start_diffcp-  s    	3 KKOkk"&&+,zz#q	Q/0299-**BII$*?wq9 # 	3MM12	3s   C C87C8c                    t        j                  d      }t        j                  t        j                  |d   d            }|dz	  t        j                  |      t        j                  d      k(  g}t        j                  ||      }|j                  t         j                        }|j                  }t        |d   j                         t        d|       t        d|       t        d	t
        j                  j                  ||j                  z         d          t
        j                  j                  ||j                  z         d   }| j!                  t        j"                  |dk\        d
       y)zTest PSD constraint.
        r   r   r-   r   r   r   rH   r@   seigsTN)r#   r$   r   minimumdiagr   onesr:   r>   r   r@   r   residuallinalgeigr   r   all)r&   r  r   r   rC   rr  s          r'   test_psd_constraintzTestSCS.test_psd_constraint<  s    KKkk"**QtWb12arwwqz12zz#u%JJbffJ%GGeAh gqc1fbiimmAG,Q/0yy}}QW%a(	*D1r*   c                    ddl }t        |j                        t        d      k\  rt        j                  d      }t        j
                  |      }|dk\  g}t        j                  t        j                  |      |      }|j                  t        j                        }| j                  |d   d   j                         dt        j                  d      z         |j                  t        j                        }t        j                  t        j                  |      |      }dd	i}|j                  t        j                  |
      }d|d   vsJ  |j                  ddt        j                  i|}	t        j                  ||	      sJ t        j                   |d      }t        j                  t        j                  |      |      }|j                  t        j                        }d|d   vsJ yy)z>Test SCS canonicalization with a quadratic objective.
        r   N3.0.0r   r-   rH   Puse_quad_objFr0   solver_optsr0   r   )scsr   __version__r#   r$   sum_squaresr:   r;   get_problem_datar   rA   toarrayr   eyer>   iscloser<   )
r&   r  r   exprr   rC   data	solution1r  	solution2s
             r'   test_quad_objzTestSCS.test_quad_objL  s    	3??#ww'77AA>>!$D1fXF::bkk$/8D(((7D''Q(<(<(>"&&)L

"&&
1I ::bkk$/8D)51K((K(PDd1g%%%"

@"&&@K@I::i333 771a=D::bkk$/8D(((7Dd1g%%%/ 8r*   c                    ddl }t        |j                        t        d      k\  rt        j                         }t        j
                  t        j                  |dz  |dz  z         |dk\  g      }|j                  t        j                  d       | j                  |j                  d       | j                  |j                  d       |j                  t        j                  d	di
      }d|d   v sJ |d   d   j                  sJ yy)z0Test a mixed quadratic/power objective.
        r   Nr  g?r   r-   Tr0   r  r  r  r  dims)r  r   r  r#   r$   r:   r;   r>   r   r?   r@   r  soc)r&   r  r   rC   r  s        r'   test_quad_obj_with_powerz TestSCS.test_quad_obj_with_powerj  s     	3??#ww'77A::bkk!S&1a4-816(CDJJbff4J8""4::q1""177A. ((^UYDZ([D$q'>!>76?&&&& 8r*   c                 0    t        j                  d       y Nr   rH   rV   r%   s    r'   test_scs_lp_3zTestSCS.test_scs_lp_3}      !!/r*   c                 0    t        j                  d       y r$  rZ   r%   s    r'   test_scs_lp_4zTestSCS.test_scs_lp_4  r&  r*   c                 2    t        j                  dd       y Nr   r   r0   r   r^   r%   s    r'   test_scs_lp_5zTestSCS.test_scs_lp_5  s    !!D9r*   c                 2    t        j                  dd       y r*  rg   r%   s    r'   test_scs_socp_1zTestSCS.test_scs_socp_1  s    %%U=r*   c                 \    t        j                  d       t        j                  d       y r$  ro   r%   s    r'   test_scs_socp_3zTestSCS.test_scs_socp_3      ((6((6r*   c                 0    t        j                  d       y r$  r   test_sdp_1minr%   s    r'   test_scs_sdp_1minzTestSCS.test_scs_sdp_1min  s    &&e4r*   c                 2    t        j                  dd       y Nr   gh㈵>r+  r   
test_sdp_2r%   s    r'   test_scs_sdp_2zTestSCS.test_scs_sdp_2  s    ##5d;r*   c                 2    t        j                  dd       y r7  ru   r%   s    r'   test_scs_expcone_1zTestSCS.test_scs_expcone_1  s    ''u$?r*   c                 2    t        j                  dd       y r7  rz   r%   s    r'   test_scs_exp_soc_1zTestSCS.test_scs_exp_soc_1  s    ++5dCr*   c                 0    t        j                  d       y r$  r   test_sdp_pcp_1r%   s    r'   test_scs_sdp_pcp_1zTestSCS.test_scs_sdp_pcp_1  s    ++59r*   c                 0    t        j                  d       y r$  r	   
test_pcp_1r%   s    r'   test_scs_pcp_1zTestSCS.test_scs_pcp_1      ##51r*   c                 0    t        j                  d       y r$  r	   
test_pcp_2r%   s    r'   test_scs_pcp_2zTestSCS.test_scs_pcp_2  rG  r*   c                 2    t        j                  dd       y )Nr   g-q=r+  r	   
test_pcp_3r%   s    r'   test_scs_pcp_3zTestSCS.test_scs_pcp_3  s    ##5e<r*   r~   )r   )%r   r   r   __doc__r(   intrA   r?   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r"  r%  r(  r,  r.  r0  r5  r:  r<  r>  rB  rF  rK  rO  __classcell__)r   s   @r'   r   r   u   s    /I3 It IDc D$ DB$? (.?5,8	;	;	;?:2 &<'&00:>75<@D:22=r*   r   CLARABELzCLARABEL is not installed.c                       e Zd 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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y)TestClarabel Unit tests for Clarabel. Nc                    t        j                  dd      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  d	d
      | _        y Nr   r   r   r   r   r   r   r   r    r!   r   r%   s    r'   r(   zTestClarabel.setUp  \    QS)QS)V#.V#.V#.r*   c                 8   t        j                  d      }t        j                  d      f}t        j                  d      }t        j                  dd      }t        j                  d      }d }t        j                  t        j                  |d   t        j
                  |d         z  t        j                  |t        j                  ddg            z   |j                  |z  z         |d   |d   z  |d   |d   z  z   |d   k(  |d   |d   z  |d   |d   z  z   |d   k  g      } |||||       |j                  t         j                  d	
      }|j                  t         j                  d
      }	| j                  ||	        |||||       |j                  t         j                  d
      }|j                  t         j                  d	
      }	| j                  ||	       |j                  t         j                  d	
      }| j                  ||	       y)Test warm start.
        r   Tnonnegr   c                 (   t         j                  j                         | d   _        t         j                  j	                  d      |_        t         j                  j                  d      |_        t         j                  j	                  d      |_        y Nr   r   r   r   r   r   r@   randnr  r   r   qs       r'   update_parameterszFTestClarabel.test_clarabel_parameter_update.<locals>.update_parameters  T    )AaDJiiooa(AGiinnQ'AGiiooa(AGr*   r   r-   r   Fr   Nr#   r$   	Parameterr:   r;   square	quad_formr   r  r   r>   rS  r?   
r&   r   r  r   r   rc  rd  rC   result1r   s
             r'   test_clarabel_parameter_updatez+TestClarabel.test_clarabel_parameter_update      KKNLL%&LLOLL4(LLO	) zzAaD1Q402<<277Aq6?3SSVWVYVY\]V]]^1!qtad{*ad21!qtad{*ad24 	!Q1%**BKKE*B**BKKD*Aw0!Q1%**BKKD*A**BKKE*Bw0 **BKKE*Bw0r*   c                 L    t        j                  t        j                         y NrH   )r   rJ   r#   rS  r%   s    r'   test_clarabel_lp_0zTestClarabel.test_clarabel_lp_0  s    !!5r*   c                 0    t        j                  d       y )NClarabelrH   rI   r%   s    r'   test_clarabel_nonstandard_namez+TestClarabel.test_clarabel_nonstandard_name  s    !!4r*   c                 0    t        j                  d       y NrS  rH   rN   r%   s    r'   test_clarabel_lp_1zTestClarabel.test_clarabel_lp_1      !!4r*   c                 0    t        j                  d       y ru  rR   r%   s    r'   test_clarabel_lp_2zTestClarabel.test_clarabel_lp_2  rw  r*   c                 0    t        j                  d       y ru  rV   r%   s    r'   test_clarabel_lp_3zTestClarabel.test_clarabel_lp_3  rw  r*   c                 0    t        j                  d       y ru  rZ   r%   s    r'   test_clarabel_lp_4zTestClarabel.test_clarabel_lp_4  rw  r*   c                 0    t        j                  d       y ru  r^   r%   s    r'   test_clarabel_lp_5zTestClarabel.test_clarabel_lp_5  rw  r*   c                 0    t        j                  d       y ru  r
   	test_qp_0r%   s    r'   test_clarabel_qp_0zTestClarabel.test_clarabel_qp_0  rw  r*   c                 2    t        j                  dd       y )NrS  Fr  r  r%   s    r'   test_clarabel_qp_0_linear_objz*TestClarabel.test_clarabel_qp_0_linear_obj  s    !!%Hr*   c                 0    t        j                  d       y ru  rb   r%   s    r'   test_clarabel_socp_0z!TestClarabel.test_clarabel_socp_0      %%Z8r*   c                 0    t        j                  d       y ru  rg   r%   s    r'   test_clarabel_socp_1z!TestClarabel.test_clarabel_socp_1  r  r*   c                 0    t        j                  d       y ru  rk   r%   s    r'   test_clarabel_socp_2z!TestClarabel.test_clarabel_socp_2  r  r*   c                 \    t        j                  d       t        j                  d       y ru  ro   r%   s    r'   test_clarabel_socp_3z!TestClarabel.test_clarabel_socp_3  s    ((
;((
;r*   c                 0    t        j                  d       y ru  ru   r%   s    r'   test_clarabel_expcone_1z$TestClarabel.test_clarabel_expcone_1  s    ''z:r*   c                 0    t        j                  d       y ru  rz   r%   s    r'   test_clarabel_exp_soc_1z$TestClarabel.test_clarabel_exp_soc_1  s    ++:>r*   c                 0    t        j                  d       y ru  rb   r%   s    r'   test_clarabel_pcp_0z TestClarabel.test_clarabel_pcp_0
  r  r*   c                 0    t        j                  d       y ru  rg   r%   s    r'   test_clarabel_pcp_1z TestClarabel.test_clarabel_pcp_1  r  r*   c                 0    t        j                  d       y ru  rk   r%   s    r'   test_clarabel_pcp_2z TestClarabel.test_clarabel_pcp_2  r  r*   c                 0    t        j                  d       y ru  r3  r%   s    r'   test_clarabel_sdp_1minz#TestClarabel.test_clarabel_sdp_1min  s    &&j9r*   c                     d}t        j                         }|j                  d       |j                  |       |j	                  |       |j                  |       |j                  |       y )Nr   rS  )sthssdp_2r>   verify_objectivecheck_primal_feasibilitycheck_complementaritycheck_dual_domainsr&   r   sths      r'   test_clarabel_sdp_2z TestClarabel.test_clarabel_sdp_2  sX     jjl		*V$$$V,!!&)v&r*   r~   )r   r   r   rP  r(   rl  rp  rs  rv  ry  r{  r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r*   r'   rU  rU    sw     %/!1H65555555I999<;?999:
'r*   rU  
CUCLARABELc                       e Zd 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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y)TestCuClarabelrV  Nc                    t        j                  dd      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  d	d
      | _        y rX  r   r%   s    r'   r(   zTestCuClarabel.setUp&  rY  r*   c                 8   t        j                  d      }t        j                  d      f}t        j                  d      }t        j                  dd      }t        j                  d      }d }t        j                  t        j                  |d   t        j
                  |d         z  t        j                  |t        j                  ddg            z   |j                  |z  z         |d   |d   z  |d   |d   z  z   |d   k(  |d   |d   z  |d   |d   z  z   |d   k  g      } |||||       |j                  t         j                  d	
      }|j                  t         j                  d
      }	| j                  ||	        |||||       |j                  t         j                  d
      }|j                  t         j                  d	
      }	| j                  ||	       |j                  t         j                  d	
      }| j                  ||	       y)r[  r   Tr\  r   c                 (   t         j                  j                         | d   _        t         j                  j	                  d      |_        t         j                  j                  d      |_        t         j                  j	                  d      |_        y r_  r`  rb  s       r'   rd  zHTestCuClarabel.test_clarabel_parameter_update.<locals>.update_parameters8  re  r*   r   r-   r   Fr   Nrf  rj  s
             r'   rl  z-TestCuClarabel.test_clarabel_parameter_update/  rm  r*   c                 L    t        j                  t        j                         y ro  )r   rJ   r#   r  r%   s    r'   rp  z!TestCuClarabel.test_clarabel_lp_0S  s    !!7r*   c                 0    t        j                  d       y )N
CuClarabelrH   rI   r%   s    r'   rs  z-TestCuClarabel.test_clarabel_nonstandard_nameV  s    !!6r*   c                 0    t        j                  d       y Nr  rH   rN   r%   s    r'   rv  z!TestCuClarabel.test_clarabel_lp_1Z      !!6r*   c                 0    t        j                  d       y r  rR   r%   s    r'   ry  z!TestCuClarabel.test_clarabel_lp_2]  r  r*   c                 0    t        j                  d       y r  rV   r%   s    r'   r{  z!TestCuClarabel.test_clarabel_lp_3`  r  r*   c                 0    t        j                  d       y r  rZ   r%   s    r'   r}  z!TestCuClarabel.test_clarabel_lp_4c  r  r*   c                 0    t        j                  d       y r  r^   r%   s    r'   r  z!TestCuClarabel.test_clarabel_lp_5f  r  r*   c                 0    t        j                  d       y r  r  r%   s    r'   r  z!TestCuClarabel.test_clarabel_qp_0i  r  r*   c                 2    t        j                  dd       y )Nr  Fr  r  r%   s    r'   r  z,TestCuClarabel.test_clarabel_qp_0_linear_objl  s    !!EJr*   c                 0    t        j                  d       y r  rb   r%   s    r'   r  z#TestCuClarabel.test_clarabel_socp_0o      %%\:r*   c                 0    t        j                  d       y r  rg   r%   s    r'   r  z#TestCuClarabel.test_clarabel_socp_1r  r  r*   c                 0    t        j                  d       y r  rk   r%   s    r'   r  z#TestCuClarabel.test_clarabel_socp_2u  r  r*   c                 \    t        j                  d       t        j                  d       y r  ro   r%   s    r'   r  z#TestCuClarabel.test_clarabel_socp_3x  s    ((=((=r*   c                 0    t        j                  d       y r  ru   r%   s    r'   r  z&TestCuClarabel.test_clarabel_expcone_1~  s    ''|<r*   c                 0    t        j                  d       y r  rz   r%   s    r'   r  z&TestCuClarabel.test_clarabel_exp_soc_1  s    ++<@r*   c                 0    t        j                  d       y r  rb   r%   s    r'   r  z"TestCuClarabel.test_clarabel_pcp_0  r  r*   c                 0    t        j                  d       y r  rg   r%   s    r'   r  z"TestCuClarabel.test_clarabel_pcp_1  r  r*   c                 0    t        j                  d       y r  rk   r%   s    r'   r  z"TestCuClarabel.test_clarabel_pcp_2  r  r*   r~   )r   r   r   rP  r(   rl  rp  rs  rv  ry  r{  r}  r  r  r  r  r  r  r  r  r  r  r  r  r   r*   r'   r  r  "  sn     %/!1H87777777K;;;>=A;;;r*   r  MOREAUzMOREAU is not installed.c                       e Zd 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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y)
TestMoreauz Unit tests for Moreau. Nc                    t        j                  dd      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  d	d
      | _        y rX  r   r%   s    r'   r(   zTestMoreau.setUp  rY  r*   c                 8   t        j                  d      }t        j                  d      f}t        j                  d      }t        j                  dd      }t        j                  d      }d }t        j                  t        j                  |d   t        j
                  |d         z  t        j                  |t        j                  ddg            z   |j                  |z  z         |d   |d   z  |d   |d   z  z   |d   k(  |d   |d   z  |d   |d   z  z   |d   k  g      } |||||       |j                  t         j                  d	
      }|j                  t         j                  d
      }	| j                  ||	        |||||       |j                  t         j                  d
      }|j                  t         j                  d	
      }	| j                  ||	       |j                  t         j                  d	
      }| j                  ||	       y)r[  r   Tr\  r   c                 (   t         j                  j                         | d   _        t         j                  j	                  d      |_        t         j                  j                  d      |_        t         j                  j	                  d      |_        y r_  r`  rb  s       r'   rd  zBTestMoreau.test_moreau_parameter_update.<locals>.update_parameters  re  r*   r   r-   r   Fr   N)r#   r$   rg  r:   r;   rh  ri  r   r  r   r>   r  r?   rj  s
             r'   test_moreau_parameter_updatez'TestMoreau.test_moreau_parameter_update  s    KKNLL%&LLOLL4(LLO	) zzAaD1Q402<<277Aq6?3SSVWVYVY\]V]]^1!qtad{*ad21!qtad{*ad24 	!Q1%**BII%*@**BII$*?w0!Q1%**BII$*?**BII%*@w0 **BII%*@w0r*   c                 L    t        j                  t        j                         y ro  )r   rJ   r#   r  r%   s    r'   test_moreau_lp_0zTestMoreau.test_moreau_lp_0      !!3r*   c                 0    t        j                  d       y Nr  rH   rI   r%   s    r'   test_moreau_nonstandard_namez'TestMoreau.test_moreau_nonstandard_name  s    !!2r*   c                 0    t        j                  d       y r  rN   r%   s    r'   test_moreau_lp_1zTestMoreau.test_moreau_lp_1      !!2r*   c                 0    t        j                  d       y r  rR   r%   s    r'   test_moreau_lp_2zTestMoreau.test_moreau_lp_2  r  r*   c                 0    t        j                  d       y r  rV   r%   s    r'   test_moreau_lp_3zTestMoreau.test_moreau_lp_3  r  r*   c                 0    t        j                  d       y r  rZ   r%   s    r'   test_moreau_lp_4zTestMoreau.test_moreau_lp_4  r  r*   c                 0    t        j                  d       y r  r^   r%   s    r'   test_moreau_lp_5zTestMoreau.test_moreau_lp_5  r  r*   c                 0    t        j                  d       y r  r  r%   s    r'   test_moreau_qp_0zTestMoreau.test_moreau_qp_0  r  r*   c                 2    t        j                  dd       y )Nr  Fr  r  r%   s    r'   test_moreau_qp_0_linear_objz&TestMoreau.test_moreau_qp_0_linear_obj  s    !!Fr*   c                 0    t        j                  d       y r  rb   r%   s    r'   test_moreau_socp_0zTestMoreau.test_moreau_socp_0      %%X6r*   c                 0    t        j                  d       y r  rg   r%   s    r'   test_moreau_socp_1zTestMoreau.test_moreau_socp_1  r  r*   c                 0    t        j                  d       y r  rk   r%   s    r'   test_moreau_socp_2zTestMoreau.test_moreau_socp_2  r  r*   c                 \    t        j                  d       t        j                  d       y r  ro   r%   s    r'   test_moreau_socp_3zTestMoreau.test_moreau_socp_3      ((9((9r*   c                 0    t        j                  d       y r  ru   r%   s    r'   test_moreau_expcone_1z TestMoreau.test_moreau_expcone_1  s    ''x8r*   c                 0    t        j                  d       y r  rz   r%   s    r'   test_moreau_exp_soc_1z TestMoreau.test_moreau_exp_soc_1  s    ++8<r*   c                 0    t        j                  d       y r  rb   r%   s    r'   test_moreau_pcp_0zTestMoreau.test_moreau_pcp_0  r  r*   c                 0    t        j                  d       y r  rg   r%   s    r'   test_moreau_pcp_1zTestMoreau.test_moreau_pcp_1  r  r*   c                 0    t        j                  d       y r  rk   r%   s    r'   test_moreau_pcp_2zTestMoreau.test_moreau_pcp_2  r  r*   r~   )r   r   r   rP  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    sm     #/!1H43333333G777:9=777r*   r  c                      dt         vry	 ddl} | j                         }|j                         }|| j                  j
                  k(  S # t        $ r Y yw xY w)z7Check if MOSEK is installed and a license is available.MOSEKFr   N)r   mosekEnv
getlicenserescodeok	Exception)r  envr   s      r'   is_mosek_availabler    sT    ''iik!)))) s   <A 	AAz3MOSEK is not installed or license is not available.c                      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$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$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$y)%	TestMosekNc                 0    t        j                  d       y Nr  rH   rI   r%   s    r'   test_mosek_lp_0zTestMosek.test_mosek_lp_0	      !!1r*   c                 `    t        j                  d       t        j                  ddd       y )Nr  rH   r   T)r0   r   bfsrN   r%   s    r'   test_mosek_lp_1zTestMosek.test_mosek_lp_1  s"    !!1!!Er*   c                 0    t        j                  d       y r  rR   r%   s    r'   test_mosek_lp_2zTestMosek.test_mosek_lp_2  r   r*   c                 0    t        j                  d       y r  rV   r%   s    r'   test_mosek_lp_3zTestMosek.test_mosek_lp_3  r   r*   c                 0    t        j                  d       y r  rZ   r%   s    r'   test_mosek_lp_4zTestMosek.test_mosek_lp_4  r   r*   c                 0    t        j                  d       y r  r^   r%   s    r'   test_mosek_lp_5zTestMosek.test_mosek_lp_5  r   r*   c                 0    t        j                  d       y r  )r   test_lp_bound_attrr%   s    r'   test_mosek_lp_bound_attrz"TestMosek.test_mosek_lp_bound_attr  s    **':r*   c                 0    t        j                  d       y r  rb   r%   s    r'   test_mosek_socp_0zTestMosek.test_mosek_socp_0!      %%W5r*   c                 0    t        j                  d       y r  rg   r%   s    r'   test_mosek_socp_1zTestMosek.test_mosek_socp_1$  r  r*   c                 0    t        j                  d       y r  rk   r%   s    r'   test_mosek_socp_2zTestMosek.test_mosek_socp_2'  r  r*   c                 \    t        j                  d       t        j                  d       y r  ro   r%   s    r'   test_mosek_socp_3zTestMosek.test_mosek_socp_3*      ((8((8r*   c                 \    t        j                  d       t        j                  d       y r  r   r4  test_sdp_1maxr%   s    r'   test_mosek_sdp_1zTestMosek.test_mosek_sdp_10  s    &&g6&&g6r*   c                 0    t        j                  d       y r  r8  r%   s    r'   test_mosek_sdp_2zTestMosek.test_mosek_sdp_26      ##73r*   c                 0    t        j                  d       y r  ru   r%   s    r'   test_mosek_expcone_1zTestMosek.test_mosek_expcone_19      ''w7r*   c                 0    t        j                  d       y r  rz   r%   s    r'   test_mosek_exp_soc_1zTestMosek.test_mosek_exp_soc_1<      ++7;r*   c                 2    t        j                  dd       y )Nr  r   r0   r   rD  r%   s    r'   test_mosek_pcp_1zTestMosek.test_mosek_pcp_1?  s    ##71=r*   c                 0    t        j                  d       y r  rI  r%   s    r'   test_mosek_pcp_2zTestMosek.test_mosek_pcp_2B  r  r*   c                 0    t        j                  d       y r  rM  r%   s    r'   test_mosek_pcp_3zTestMosek.test_mosek_pcp_3E  r  r*   c                 0    t        j                  d       y r  r   test_mi_lp_0r%   s    r'   test_mosek_mi_lp_0zTestMosek.test_mosek_mi_lp_0H      $$G4r*   c                 0    t        j                  d       y r  r   test_mi_lp_1r%   s    r'   test_mosek_mi_lp_1zTestMosek.test_mosek_mi_lp_1K  r1  r*   c                 0    t        j                  d       y r  r   test_mi_lp_2r%   s    r'   test_mosek_mi_lp_2zTestMosek.test_mosek_mi_lp_2N  r1  r*   c                 0    t        j                  d       y r  r   test_mi_lp_3r%   s    r'   test_mosek_mi_lp_3zTestMosek.test_mosek_mi_lp_3Q  r1  r*   c                 0    t        j                  d       y r  r   test_mi_lp_5r%   s    r'   test_mosek_mi_lp_5zTestMosek.test_mosek_mi_lp_5T  r1  r*   c                 2    t        j                  dd       y )Nr  r   r'  r   test_mi_socp_1r%   s    r'   test_mosek_mi_socp_1zTestMosek.test_mosek_mi_socp_1W      ((Br*   c                 0    t        j                  d       y r  r   test_mi_socp_2r%   s    r'   test_mosek_mi_socp_2zTestMosek.test_mosek_mi_socp_2Z      ((8r*   c                 0    t        j                  d       y r  )r	   test_mi_pcp_0r%   s    r'   test_mosek_mi_pcp_0zTestMosek.test_mosek_mi_pcp_0]      &&g6r*   c                    dd l }d}d}t        j                  j                  d       t        j                  j	                  ||      }t        j                  j	                  |      }|j                  |      }t        j                  |      }t        j                  t        j                  |            }||z  |k(  g}	t        j                  ||	      }
ddi}| j                  |j                        5  |
j                  t        j                  |       d d d        | j                  t              5  |
j                  t        j                  d        d d d        |j                   j"                  dd	d
ddddddddi}t%        j&                         5  |
j                  t        j                  |       d d d        y # 1 sw Y   xY w# 1 sw Y   vxY w# 1 sw Y   y xY w)Nr   r   r   MSK_IPAR_NUM_THREADSz11.3r0   mosek_paramsr0   invalid_kwarg:0yE>MSK_IPAR_INTPNT_MAX_ITERATIONSr/   17MSK_IPAR_PRESOLVE_USEMSK_PRESOLVE_MODE_OFFMSK_DPAR_INTPNT_CO_TOL_DFEAS&.>MSK_DPAR_INTPNT_CO_TOL_PFEASz1e-9)r  r   r   r   ra  r   r#   r$   r;   norm1r:   assertRaisesErrorr>   r  
ValueErrordparambasis_tol_xpytestwarns)r&   r  r   mr   r   r   r   r   r   r   invalid_mosek_paramsrS  s                r'   test_mosek_paramszTestMosek.test_mosek_params`  s   
		qIIOOAq!IIOOAEE!H KKNKK,	1uzl**Y4 #F 
 u{{+ 	NMM8LMM	N z* 	?MMM>	? LL$$d,b"D#%<*D*F
 \\^ 	FMMME	F 	F	N 	N	? 	?	F 	Fs$   3"F=2"G	"G=G	GGc                    d}d}t         j                  j                  d       t         j                  j                  ||      }t         j                  j                  |      }|j	                  |      }t        j                  |      }t        j                  t        j                  |            }||z  |k(  g}t        j                  ||      }	|	j                  t
        j                  ddi       y )Nr   r   r   MSK_IPAR_OPTIMIZERMSK_OPTIMIZER_DUAL_SIMPLEXrR  )r   r   r   ra  r   r#   r$   r;   r^  r:   r>   r  
r&   r   rf  r   r   r   r   r   r   r   s
             r'   test_mosek_simplexzTestMosek.test_mosek_simplex  s    
		qIIOOAq!IIOOAEE!H KKNKK,	1uzl**Y488.0LM 	 	
r*   c                    d}t        j                  |      }t        j                  t        j                  |            }|d   dk\  |d   dk  |d   dk\  g}t        j                  ||      }|j                  t         j                         |j                  j                  d   }||d   j                     dkD  sJ ||d   j                     dkD  sJ ||d   j                     dk(  sJ d}d}t        j                  ||f      }t        j                         }	t        j                  t        j                  |            }|	dk(  |dk\  |d   |	z   d	k  g}t        j                  ||      }|j                  t         j                         |j                  j                  d   }t        ||d   j                           dkD  sJ t        j                  ||d   j                     |j                  d
      }
|
d   dkD  sJ |
d   dk(  sJ t        j                  |
dddf   dk(        sJ ||d   j                     dkD  sJ y)zTest IIS feature in Mosek.r   r   r-   r   rH   IIS)r   r   r!   )orderr   N)r#   r$   r;   r   r:   r>   r  r   extra_statsidabsr   reshaper   r	  )r&   r   r   r   r   r   iisrf  r   r   dual1s              r'   test_mosek_iiszTestMosek.test_mosek_iis  s    KKNKKq	*	tqy!A$"*adai8**Y4RXX&""..u5;q>$$%)));q>$$%)));q>$$%*** KKAKKMKKq	*	AvqAvqw{b'89**Y4RXX&""..u53{1~(()*Q...

3{1~001177#FT{QT{avveAqDkQ&''';q>$$%)))r*   c                 0    t        j                  d       y)zTest the problem in issue #2128r  rH   Nr@  r%   s    r'   test_mosek_sdp_powerzTestMosek.test_mosek_sdp_power  s    ++7;r*   c                    d\  }}t         j                  j                  d      }t        j                  |      dz   }|j	                  ||      dz  dz
  }||j
                  z  dz  t        j                  |j	                  |      dz  dz         dz  z   }t        j                  j                  ||||	      }t        j                  |d
f      }t        j                  d      }t        j                  d      }	t        j                  |d
f      }
t        j                  |d
f      }t        j                  |d
f      }t        j                  |d
f      }t        j                  d      }t        j                  d
|f      |z  }||z  }d}t        j                  |d
f      }t        j                  j                  j                  |	d
|z   z  d|z  z  |z  |d
|z   z  |z  |d
d
|z   z        t        j                  j                  j                  |
d
|z
  z  ||z  |	 d|z  z  |z  d
|z
        | |z
  |z   |
z   dk  |dk\  |	dk\  g}||	z   t        j                   ||z         z   }|t        j                   |      |k(  |dk\  |t        j"                  |      z  d
k\  gz  }t        j$                  |      }t        j&                  ||      }|j)                  t        j*                         |j,                  t        j.                  u sJ y)z)Test the portfolio problem in issue #2042)   r   {   MbP?g      ?r     gffffff?g333333?)meancovsizerandom_stater-   )r-   r-   g?r   r   rH   N)r   r   RandomStatezerosr   r   r  stmultivariate_normalrvsr#   r$   r  r   power	PowCone3Dr   r   r;   r:   r>   r  r   r   )r&   r   Nrsr  r  r   wtr   omegapsinuepsilonkr   r   hr  r   r   r   rC   s                          r'   test_power_portfoliozTestMosek.test_power_portfolio  s   1YY""3'xx{V#ggamc!C'CEEk$c)9C)?!@!EE""&&	 ' 
 KKAKKKKQF#kk1a&![[!Q ++q!f%KKGGQFOAEww1vNN  **1!9ac?T+A3!A#;q=RY[\^_`a^a[bcNN  **5!A#;1qb!A#hoPQRSPSUBFWu$)FF !ebffS2X&&q	QQBFF1I* 	 KK$	zz)[1

"((
#{{bjj(((r*   c                    ddi}t        j                         }|j                  t        j                  d|       |j
                  j                  t        j                  t        j                  hv sJ t        j                  t        j                  j                  d      5  |j                  t        j                  |       d d d        y # 1 sw Y   y xY w)NrW  r   T)r0   accept_unknownrS  zSolver 'MOSEK' failedmatchrR  )r  lp_5r>   r#   r  rC   r   r   r   rd  raiseserrorSolverError)r&   mosek_paramr  s      r'   test_mosek_accept_unknownz#TestMosek.test_mosek_accept_unknown  s    ,a
 iik		$[	Qxx2#8#8"**"EEEE]]288//7NO 	AIIRXXKI@	A 	A 	As   ""CCc                 V   t        j                         }|j                  t        j                         |j
                  j                  j                  dk\  sJ |j
                  j                  j                  d   dk(  sJ |j
                  j                  j                  d   dk(  sJ y )NrH   r   mio_intpnt_itermio_simplex_iter)	r  r  r>   r#   r  rC   r   	num_itersrs  r&   r  s     r'   test_mosek_number_itersz!TestMosek.test_mosek_number_iters  s    iik			"xx$$..!333xx$$001BCqHHHxx$$001CDIIIr*   c           	      j   t        j                         }t        j                  t        j                  |      |dk\  g      }|j	                  t         j
                  dddi       |j                  t         j                  u sJ ddl}t        j                  |j                  d      5  |j	                  t         j
                  d	ddi       ddd       dd
lm} |j                         }|j	                  t         j
                  d	|D ci c]  }|d c}       |j                  t         j                  u sJ t        j                  t        d      5  |j	                  t         j
                  d	|j                  j                   di       ddd       y# 1 sw Y   xY wc c}w # 1 sw Y   yxY w)z%Test that the eps keyword is acceptedr   rV  r[  r   )r0   r   rS  Nz$The parameter value 0.1 is too larger  皙?)r  znot compatible)r#   r$   r:   r;   r>   r  r   r   r  rd  r  r`  2cvxpy.reductions.solvers.conic_solvers.mosek_coniftolerance_paramsAssertionErrorrb  intpnt_co_tol_dfeas)r&   r   rC   r  r  
all_paramsr   s          r'   test_eps_keywordzTestMosek.test_eps_keyword  sc   KKMzz"++a.16(3

"((<Z\`;a
b{{bjj((( 	]]5;;.TU 	LJJbhh%CT$J  L	L 	M++-


"((Z;XAtG;X
Y{{bjj((( ]]>1AB 	NJJbhh%*\\%E%Et$L  N	N 	N	L 	L <Y	N 	Ns   )%F
F$9F)F!)F2r~   )%r   r   r   r  r  r  r  r	  r  r  r  r  r  r  r  r  r!  r$  r(  r*  r,  r0  r5  r9  r=  rA  rE  rJ  rN  rh  rm  ry  r{  r  r  r  r  r   r*   r'   r  r    s    2F2222;6669748<>4455555C97!FF
$*><
/)b	AJNr*   r  CVXOPTzCVXOPT is not installed.c                   |    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dZddZddZddZy)
TestCVXOPTNc                    t        j                  d      | _        t        j                  d      | _        t        j                  d      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  dd	      | _        t        j                  d
d      | _        t        j                  d
d      | _	        t        j                  dd      | _
        y r   r"   r%   s    r'   r(   zTestCVXOPT.setUp  r)   r*   c           
      b   d}t        j                  t        j                  t        j                  | j                  d      dz         | j                  dk(  g      }|j                  t         j                  |||dddd	       | j                  |j                  d       | j                  | j                  j                  ddg       d
fd}| j                  t              5 }|j                  d|       ddd       | j                  t        j                               y# 1 sw Y   /xY w)z6Test that all the CVXOPT solver options work.
        gHz>r-   r.   r   r/   Tcholr   )r0   r1   r2   r3   r7   r8   	kktsolver
refinementz&This setup-factor function was called.c                     t              )N)NotImplementedError)r   Gr  r   r   r   msgs         r'   setup_dummy_factorz:TestCVXOPT.test_cvxopt_options.<locals>.setup_dummy_factorA  s     &c**r*   r  r0   r  N)r#   r:   r;   r<   r   r>   r  r?   r@   rA   r_  r  r   str	exception)r&   rB   rC   r  nixr  s        @r'   test_cvxopt_optionszTestCVXOPT.test_cvxopt_options)  s     zz"++bggdffa&83&>?$&&A+O

"))SSA 	 	Otzz3/##DFFLL1a&96	+
 23 	FsJJh2DJE	Fc#--01	F 	Fs   #D%%D.c                 0    t        j                  d       y Nr  rH   rI   r%   s    r'   test_cvxopt_lp_0zTestCVXOPT.test_cvxopt_lp_0J  r  r*   c                 0    t        j                  d       y r  rN   r%   s    r'   test_cvxopt_lp_1zTestCVXOPT.test_cvxopt_lp_1M  r  r*   c                 0    t        j                  d       y r  rR   r%   s    r'   test_cvxopt_lp_2zTestCVXOPT.test_cvxopt_lp_2P  r  r*   c                 0    t        j                  d       y r  rV   r%   s    r'   test_cvxopt_lp_3zTestCVXOPT.test_cvxopt_lp_3S  r  r*   c                 0    t        j                  d       y r  rZ   r%   s    r'   test_cvxopt_lp_4zTestCVXOPT.test_cvxopt_lp_4V  r  r*   c                 l    ddl m} t        j                  d|       t        j                  dd       y )Nr   )setup_ldl_factorr  r  r  )"cvxpy.reductions.solvers.kktsolverr  r   r_   )r&   r  s     r'   test_cvxopt_lp_5zTestCVXOPT.test_cvxopt_lp_5Y  s&    G!!=MN!!VDr*   c                 0    t        j                  d       y r  rb   r%   s    r'   test_cvxopt_socp_0zTestCVXOPT.test_cvxopt_socp_0^  r  r*   c                 0    t        j                  d       y r  rg   r%   s    r'   test_cvxopt_socp_1zTestCVXOPT.test_cvxopt_socp_1a  r  r*   c                 0    t        j                  d       y r  rk   r%   s    r'   test_cvxopt_socp_2zTestCVXOPT.test_cvxopt_socp_2d  r  r*   c                 \    t        j                  d       t        j                  d       y r  ro   r%   s    r'   test_cvxopt_socp_3zTestCVXOPT.test_cvxopt_socp_3g  r  r*   c                 \    t        j                  d       t        j                  d       y r  r  r%   s    r'   test_cvxopt_sdp_1zTestCVXOPT.test_cvxopt_sdp_1m  s    &&h7&&h7r*   c                 0    t        j                  d       y r  r8  r%   s    r'   test_cvxopt_sdp_2zTestCVXOPT.test_cvxopt_sdp_2s  s    ##84r*   r~   )r   r   r   r(   r  r  r  r  r  r  r  r  r  r  r  r  r  r   r*   r'   r  r    sJ    /2B33333E
777:85r*   r  SDPAzSDPA is not installed.c                   t    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dZddZddZy)TestSDPANc                 0    t        j                  d       y Nr  rH   rI   r%   s    r'   test_sdpa_lp_0zTestSDPA.test_sdpa_lp_0z  rL   r*   c                 0    t        j                  d       y r  rN   r%   s    r'   test_sdpa_lp_1zTestSDPA.test_sdpa_lp_1}  rL   r*   c                 0    t        j                  d       y r  rR   r%   s    r'   test_sdpa_lp_2zTestSDPA.test_sdpa_lp_2  rL   r*   c                 0    t        j                  d       y r  rV   r%   s    r'   test_sdpa_lp_3zTestSDPA.test_sdpa_lp_3  rL   r*   c                 0    t        j                  d       y r  rZ   r%   s    r'   test_sdpa_lp_4zTestSDPA.test_sdpa_lp_4  rL   r*   c                 6    t        j                  dddd       y )Nr  r  g?g>)r0   betaBar	gammaStarepsilonDashr^   r%   s    r'   test_sdpa_lp_5zTestSDPA.test_sdpa_lp_5  s    !!*-&	Rr*   c                 0    t        j                  d       y r  )r   	test_lp_7r%   s    r'   test_sdpa_lp_7zTestSDPA.test_sdpa_lp_7  rL   r*   c                 0    t        j                  d       y r  rb   r%   s    r'   test_sdpa_socp_0zTestSDPA.test_sdpa_socp_0  re   r*   c                 0    t        j                  d       y r  rg   r%   s    r'   test_sdpa_socp_1zTestSDPA.test_sdpa_socp_1  re   r*   c                 0    t        j                  d       y r  rk   r%   s    r'   test_sdpa_socp_2zTestSDPA.test_sdpa_socp_2  re   r*   c                 \    t        j                  d       t        j                  d       y r  ro   r%   s    r'   test_sdpa_socp_3zTestSDPA.test_sdpa_socp_3  rs   r*   c                 \    t        j                  d       t        j                  d       y r  r  r%   s    r'   test_sdpa_sdp_1zTestSDPA.test_sdpa_sdp_1  s    &&f5&&f5r*   c                 0    t        j                  d       y r  r8  r%   s    r'   test_sdpa_sdp_2zTestSDPA.test_sdpa_sdp_2      ##62r*   r~   )r   r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r   r*   r'   r  r  w  sD    11111R
1555863r*   r  c                  P    ddl } | j                  d      }|j                  d       y)a
  
    C code in some solvers uses libc buffering; if we want to capture log output from
    those solvers to use in tests, we must flush the libc buffers before trying to read
    the log contents from python.
    https://github.com/pytest-dev/pytest/issues/8753
    r   N)ctypesCDLLfflush)r   libcs     r'   r  r    s!     ;;tDKKr*   CBCzCBC is not installed.reasonc                      e Zd 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ej                  j!                   e        d      d!d       Zej                  j%                  dddiddiddiddiddiddifD  cg c]9  }t        j&                  |t)        t+        |j-                                           ; c}}}}}       dedej0                  ddfd       Zdej0                  ddfd Zyc c}}}}} w )"TestCBCc                  >    	 ddl m}  | d   dk(  S # t        $ r Y yw xY w)Nr   problemStatuszsearch completedF)cylp.cy.CyCbcModelr  ImportErrorr
  s    r'   _cylp_checks_isProvenInfeasiblez'TestCBC._cylp_checks_isProvenInfeasible  s-    	8 #'999 		s    	r   Nc                 2    t        j                  dd       y Nr  Fr0   dualsrI   r%   s    r'   test_cbc_lp_0zTestCBC.test_cbc_lp_0      !!e<r*   c                 2    t        j                  dd       y r  rN   r%   s    r'   test_cbc_lp_1zTestCBC.test_cbc_lp_1  r  r*   c                 2    t        j                  dd       y r  rR   r%   s    r'   test_cbc_lp_2zTestCBC.test_cbc_lp_2  r  r*   c                 0    t        j                  d       y Nr  rH   rV   r%   s    r'   test_cbc_lp_3zTestCBC.test_cbc_lp_3  r&  r*   c                 0    t        j                  d       y r  rZ   r%   s    r'   test_cbc_lp_4zTestCBC.test_cbc_lp_4  r&  r*   c                 2    t        j                  dd       y r  r^   r%   s    r'   test_cbc_lp_5zTestCBC.test_cbc_lp_5  r  r*   c                 0    t        j                  d       y r  r.  r%   s    r'   test_cbc_mi_lp_0zTestCBC.test_cbc_mi_lp_0      $$E2r*   c                 0    t        j                  d       y r  r3  r%   s    r'   test_cbc_mi_lp_1zTestCBC.test_cbc_mi_lp_1  r"  r*   c                 0    t        j                  d       y r  r7  r%   s    r'   test_cbc_mi_lp_2zTestCBC.test_cbc_mi_lp_2  r"  r*   c                 0    t        j                  d       y r  r;  r%   s    r'   test_cbc_mi_lp_3zTestCBC.test_cbc_mi_lp_3  r"  r*   z=CyLP <= 0.91.4 has no working integer infeasibility detectionr  c                 0    t        j                  d       y r  r?  r%   s    r'   test_cbc_mi_lp_5zTestCBC.test_cbc_mi_lp_5  s     	$$E2r*   optsdualTolerancer.   primalTolerancemaxNumIterationr-   scalingr   optimizationDirectionr   presolveoff)rt  capfdc                 F   t                |j                          t        j                         }|j	                  dd       t                |j                         }	  |j                  dddd| t                |j                         }||k7  sJ y# t
        $ r Y yw xY w)z
        Validate that cylp is actually using each option.

        Tentative approach: run model with verbose output with or without the specified
        option; verbose output should be different each way.
        r  r   r0   logLevelNr   )r  
readouterrr  lp_4r>   r  )r&   r+  r3  r  basewith_opts         r'   test_cbc_lp_optionszTestCBC.test_cbc_lp_options  s    0 	iik			+!		$CII7UQ7$7 H'')H8###  		s   B 	B B c                 x   t                |j                          t        j                  ddd       t                |j                         }t        j                  ddd       t                |j                         }t	        |j
                        t	        |j
                        kD  sJ t        j                  dd       t                |j                         }t        j                  dd       t                |j                         }t	        |j
                        t	        |j
                        kD  sJ y)z4Validate that logLevel parameter is passed to solverr  Fr   )r0   r  r6  r   r5  N)r  r7  r   rJ   lenoutr/  )r&   r3  quiet_outputverbose_outputs       r'   test_cbc_lp_loggingzTestCBC.test_cbc_lp_logging  s     	 	!!eaH'')!!eaH))+>%%&\-=-=)>>>> 	$$EA>'')$$EA>))+>%%&\-=-=)>>>>r*   r~   )r   r   r   r  r  r  r  r  r  r  r!  r$  r&  r(  rd  markskipifr*  parametrizeparamnextiterkeysdictLogCaptureFixturer;  rA  ).0r+  rd  rF  rG  s   00000r'   r  r    s;   ===00=3333 [[;==^  `3`3 [[ !#&"C("A&A )%0U#		
 	
 LL$tDIIK'8"9:	
 $ $V5M5M $RV $! $6?)A)A ?d ?S	
s   
>C=r  GLPKzGLPK is not installed.c                       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dZddZddZddZddZy)TestGLPKNc                 0    t        j                  d       y NrL  rH   rI   r%   s    r'   test_glpk_lp_0zTestGLPK.test_glpk_lp_0-  rL   r*   c                 0    t        j                  d       y rP  rN   r%   s    r'   test_glpk_lp_1zTestGLPK.test_glpk_lp_10  rL   r*   c                 0    t        j                  d       y rP  rR   r%   s    r'   test_glpk_lp_2zTestGLPK.test_glpk_lp_23  rL   r*   c                 0    t        j                  d       y rP  rV   r%   s    r'   test_glpk_lp_3zTestGLPK.test_glpk_lp_36  rL   r*   c                 0    t        j                  d       y rP  rZ   r%   s    r'   test_glpk_lp_4zTestGLPK.test_glpk_lp_49  rL   r*   c                 0    t        j                  d       y rP  r^   r%   s    r'   test_glpk_lk_5zTestGLPK.test_glpk_lk_5<  rL   r*   c                 0    t        j                  d       y rP  r   	test_lp_6r%   s    r'   test_glpk_lp_6zTestGLPK.test_glpk_lp_6?  rL   r*   c                 0    t        j                  d       y NGLPK_MIrH   r.  r%   s    r'   test_glpk_mi_lp_0zTestGLPK.test_glpk_mi_lp_0B      $$I6r*   c                 0    t        j                  d       y ra  r3  r%   s    r'   test_glpk_mi_lp_1zTestGLPK.test_glpk_mi_lp_1E  rd  r*   c                 0    t        j                  d       y ra  r7  r%   s    r'   test_glpk_mi_lp_2zTestGLPK.test_glpk_mi_lp_2H  rd  r*   c                 0    t        j                  d       y ra  r;  r%   s    r'   test_glpk_mi_lp_3zTestGLPK.test_glpk_mi_lp_3K  rd  r*   c                 0    t        j                  d       y ra  r   test_mi_lp_4r%   s    r'   test_glpk_mi_lp_4zTestGLPK.test_glpk_mi_lp_4N  rd  r*   c                 0    t        j                  d       y ra  r?  r%   s    r'   test_glpk_mi_lp_5zTestGLPK.test_glpk_mi_lp_5Q  rd  r*   c                 R   t        j                         }dd l}d|j                  j                  vsJ |j                  dd       d|j                  j                  vsJ |j                  d       |j                  d       |j                  d       |j                  d       y )Nr   tm_limrL  d   )r0   rr  r   r   )
r  lp_1cvxoptglpkoptionsr>   r  r  r  r  r&   r  ru  s      r'   test_glpk_optionszTestGLPK.test_glpk_optionsT  s    iikv{{22222			,v{{22222A&$$A$.!!!+a(r*   c                    t        j                         }dd l}d|j                  j                  vsJ |j                  ddd       d|j                  j                  vsJ |j                  d       |j                  d       y )	Nr   rr  rb  rs  T)r0   rr  r8   r   r   )r  mi_lp_1ru  rv  rw  r>   r  verify_primal_valuesrx  s      r'   test_glpk_mi_optionszTestGLPK.test_glpk_mi_options_  st    llnv{{22222		3	=v{{22222A&   *r*   r~   )r   r   r   rQ  rS  rU  rW  rY  r[  r_  rc  rf  rh  rj  rn  rp  ry  r}  r   r*   r'   rN  rN  *  sM    1111111777777	)+r*   rN  GLOPzGLOP is not installed.c                       e Zd ZddZddZddZddZ ej                  d      dd       Z	ddZ
dd	Zdd
Z ej                  d      dd       ZddZddZy)TestGLOPNc                 0    t        j                  d       y Nr~  rH   rI   r%   s    r'   test_glop_lp_0zTestGLOP.test_glop_lp_0l  rL   r*   c                 0    t        j                  d       y r  rN   r%   s    r'   test_glop_lp_1zTestGLOP.test_glop_lp_1o  rL   r*   c                 0    t        j                  d       y r  rR   r%   s    r'   test_glop_lp_2zTestGLOP.test_glop_lp_2r  rL   r*   c                 l    ddl m} |j                         }d|_        t	        j
                  d|       y Nr   )parameters_pb2Fr~  r0   parameters_proto)ortools.glopr  GlopParametersuse_preprocessingr   rW   r&   r  paramss      r'   test_glop_lp_3_no_preprocessingz(TestGLOP.test_glop_lp_3_no_preprocessingu  +    /..0#( !!&Ir*   z'Known limitation of the GLOP interface.c                 0    t        j                  d       y r  rV   r%   s    r'   test_glop_lp_3zTestGLOP.test_glop_lp_3      !!0r*   c                 0    t        j                  d       y r  rZ   r%   s    r'   test_glop_lp_4zTestGLOP.test_glop_lp_4  rL   r*   c                 0    t        j                  d       y r  r^   r%   s    r'   test_glop_lp_5zTestGLOP.test_glop_lp_5  rL   r*   c                 l    ddl m} |j                         }d|_        t	        j
                  d|       y r  )r  r  r  r  r   r^  r  s      r'   test_glop_lp_6_no_preprocessingz(TestGLOP.test_glop_lp_6_no_preprocessing  r  r*   c                 0    t        j                  d       y r  r]  r%   s    r'   test_glop_lp_6zTestGLOP.test_glop_lp_6  r  r*   c                 *   t        j                  d      }t        j                  t        j                  |      |dk  g      }| j	                  t         j
                  j                        5  |j                  dd       d d d        y # 1 sw Y   y xY w)Nr-   r~  not a protor  r#   r$   r:   r   r_  r  r  r>   r&   r   rC   s      r'   test_glop_bad_parametersz!TestGLOP.test_glop_bad_parameters  n    KKNzz"++a.16(3rxx334 	FJJf}JE	F 	F 	F   ,B		Bc                 R    t        j                         }|j                  dd       y )Nr~  r.   r0   time_limit_secr  rt  r>   r  s     r'   test_glop_time_limitzTestGLOP.test_glop_time_limit      iik 				4r*   r~   )r   r   r   r  r  r  r  unittestskipr  r  r  r  r  r  r  r   r*   r'   r  r  i  sr    111J X]]<=1 >111J X]]<=1 >1F5r*   r  PDLPzPDLP is not installed.c                   l    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dZddZy)TestPDLPNc                 0    t        j                  d       y Nr  rH   rI   r%   s    r'   test_pdlp_lp_0zTestPDLP.test_pdlp_lp_0  rL   r*   c                 0    t        j                  d       y r  rN   r%   s    r'   test_pdlp_lp_1zTestPDLP.test_pdlp_lp_1  rL   r*   c                 0    t        j                  d       y r  rR   r%   s    r'   test_pdlp_lp_2zTestPDLP.test_pdlp_lp_2  rL   r*   c                 4   t        j                         }| j                  t              5  |j                  j                  d       | j                  |j                  j                  t        j                  j                         d d d        y # 1 sw Y   y xY wr  )r  lp_3assertWarnsWarningrC   r>   r   r   r#   settingsINFEASIBLE_OR_UNBOUNDEDr  s     r'   test_pdlp_lp_3zTestPDLP.test_pdlp_lp_3  h    iikg& 	SHHNN&N)SXX__bkk.Q.QR	S 	S 	S   ABBc                     ddl m} |j                         }d|j                  _        t        j                  d|       y Nr   )solvers_pb2Fr  r  )ortools.pdlpr  PrimalDualHybridGradientParamspresolve_optionsuse_glopr   rW   r&   r  r  s      r'   test_pdlp_lp_3_no_presolvez#TestPDLP.test_pdlp_lp_3_no_presolve  1    ,;;=+0(!!&Ir*   c                 4   t        j                         }| j                  t              5  |j                  j                  d       | j                  |j                  j                  t        j                  j                         d d d        y # 1 sw Y   y xY wr  )r  r8  r  r  rC   r>   r   r   r#   r  r  r  s     r'   test_pdlp_lp_4zTestPDLP.test_pdlp_lp_4  r  r  c                     ddl m} |j                         }d|j                  _        t        j                  d|       y r  )r  r  r  r  r  r   r[   r  s      r'   test_pdlp_lp_4_no_presolvez#TestPDLP.test_pdlp_lp_4_no_presolve  r  r*   c                 0    t        j                  d       y r  r^   r%   s    r'   test_pdlp_lp_5zTestPDLP.test_pdlp_lp_5  rL   r*   c                 4   t        j                         }| j                  t              5  |j                  j                  d       | j                  |j                  j                  t        j                  j                         d d d        y # 1 sw Y   y xY wr  )r  lp_6r  r  rC   r>   r   r   r#   r  r  r  s     r'   test_pdlp_lp_6zTestPDLP.test_pdlp_lp_6  r  r  c                     ddl m} |j                         }d|j                  _        t        j                  d|       y r  )r  r  r  r  r  r   r^  r  s      r'   test_pdlp_lp_6_no_presolvez#TestPDLP.test_pdlp_lp_6_no_presolve  r  r*   c                 *   t        j                  d      }t        j                  t        j                  |      |dk  g      }| j	                  t         j
                  j                        5  |j                  dd       d d d        y # 1 sw Y   y xY w)Nr-   r  r  r  r  r  s      r'   test_pdlp_bad_parametersz!TestPDLP.test_pdlp_bad_parameters  r  r  c                 R    t        j                         }|j                  dd       y )Nr  r.   r  r  r  s     r'   test_pdlp_time_limitzTestPDLP.test_pdlp_time_limit  r  r*   r~   )r   r   r   r  r  r  r  r  r  r  r  r  r  r  r  r   r*   r'   r  r    sE    111SJSJ1SJF5r*   r  QOCOzQOCO is not installed.c                   `    e Zd 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y)TestQOCOz Unit tests for QOCO. Nc                    t        j                  dd      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  d	d
      | _        y rX  r   r%   s    r'   r(   zTestQOCO.setUp  s\    QS)QS)V#.V#.V#.r*   c                 0    t        j                  d       y Nr  rH   rI   r%   s    r'   test_qoco_lp_0zTestQOCO.test_qoco_lp_0  rL   r*   c                 0    t        j                  d       y r  rN   r%   s    r'   test_qoco_lp_1zTestQOCO.test_qoco_lp_1  rL   r*   c                 0    t        j                  d       y r  rR   r%   s    r'   test_qoco_lp_2zTestQOCO.test_qoco_lp_2  rL   r*   c                 0    t        j                  d       y r  r^   r%   s    r'   test_qoco_lp_5zTestQOCO.test_qoco_lp_5  rL   r*   c                 0    t        j                  d       y r  r  r%   s    r'   test_qoco_qp_0zTestQOCO.test_qoco_qp_0  rL   r*   c                 0    t        j                  d       y r  rb   r%   s    r'   test_qoco_socp_0zTestQOCO.test_qoco_socp_0  re   r*   c                 0    t        j                  d       y r  rg   r%   s    r'   test_qoco_socp_1zTestQOCO.test_qoco_socp_1  re   r*   c                 0    t        j                  d       y r  rk   r%   s    r'   test_qoco_socp_2zTestQOCO.test_qoco_socp_2  re   r*   c                 \    t        j                  d       t        j                  d       y r  ro   r%   s    r'   test_qoco_socp_3zTestQOCO.test_qoco_socp_3  rs   r*   r~   )r   r   r   rP  r(   r  r  r  r  r  r  r  r  r  r   r*   r'   r  r    s7     /111115558r*   r  CPLEXzCPLEX is not installed.c                       e Zd 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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y)	TestCPLEXz* Unit tests for solver specific behavior. Nc                    t        j                  d      | _        t        j                  d      | _        t        j                  d      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  dd	      | _        t        j                  d
d      | _        t        j                  d
d      | _	        t        j                  dd      | _
        y r   r"   r%   s    r'   r(   zTestCPLEX.setUp  r)   r*   c           	      
   t         j                  t        v r t        j                  d      }t        j                  d      }t        j                  d      }t        j                  d      }t	        j
                  ddgddgg      |_        t	        j
                  ddg      |_        t	        j
                  ddg      |_        t	        j
                  ddg      |_        t        j                  |d   | j                  d   z  |d   | j                  d   z  z         }| j                  d   |d   k  | j                  d   |d   k  || j                  z  |k(  g}t        j                  ||      }|j                  t         j                  d      }| j                  |d       | j                  | j                  j                  ddg       t	        j
                  ddgddgg      |_        t	        j
                  ddg      |_        t	        j
                  ddg      |_        t	        j
                  ddg      |_        |j                  t         j                  d      }| j                  |d       | j                  | j                  j                  ddg       t	        j
                  ddgddgg      |_        t	        j
                  ddg      |_        t	        j
                  ddg      |_        t	        j
                  ddg      |_        |j                  t         j                  d      }| j                  |d       | j                  | j                  j                  ddg       t	        j
                  ddgddgg      |_        t	        j
                  ddg      |_        t	        j
                  ddg      |_        t	        j
                  ddg      |_        |j                  t         j                  d      }| j                  |d       | j                  | j                  j                  ddg       y	| j                  t              5 }	t        j                  t        j                  t        j                   | j                  d            | j                  dk(  g      }|j                  t         j                  d       d	d	d	       | j                  t#        	j$                        d
t         j                  z         y	# 1 sw Y   @xY w)zMake sure that warm starting CPLEX behaves as expected
           Note: This only checks output, not whether or not CPLEX is warm starting internally
        r   r   r-   r   Tr   r   r   NThe solver %s is not installed.)r#   r  r   rg  r   r   r@   r   r   r:   r>   r   rA   r_  r  r;   r<   r  r  )
r&   r   r   r  r   r   r   rC   r   cms
             r'   test_cplex_warm_startzTestCPLEX.test_cplex_warm_start  s    88((V$AQAQAQAhhAA/0AGhh1v&AGhh1v&AGhh1v&AGAaD466!9$4qtdffQi7G$GHI66!9!,66!9!,tvv:?,K ::i5DZZrxxDZAFVQ'''q!f= hhAA/0AGhh1v&AGhh1v&AGhh1v&AG ZZrxxDZAFVQ'''q!f= hhAA/0AGhh1v&AGhh1v&AGhh1v&AG ZZrxxDZAFVQ'''q!f= hhAA/0AGhh1v&AGhh1v&AGhh1v&AG ZZrxxDZAFVQ'''q!f= ""9- =zz"++bggdffa.@"ADFFaK=Q

"((t
<= S.0QTVT\T\0\]= =s   A7TTc                 X   t         j                  t        v r{d\  }}t        j                  j                  d       t        j                  j                  ||      }t        j                  j                  |      }|j                  |      }t        j                  |      }t        j                  t        j                  |            }||z  |k(  g}t        j                  ||      }	ddi}
| j                  t              5  |	j                  t         j                  |
       d d d        | j                  t              5  |	j                  t         j                  d        d d d        dddd	d
}|	j                  t         j                  |       y y # 1 sw Y   rxY w# 1 sw Y   ?xY w)Nr   r   r   bogusfoo)r0   cplex_paramsrT  r  g     @@z"mydir")advancezsimplex.limits.iterations	timelimitworkdir)r#   r  r   r   r   r   ra  r   r$   r;   r^  r:   r_  ra  r>   )r&   r   rf  r   r   r   r   r   r   r   invalid_cplex_paramsr  s               r'   test_cplex_paramszTestCPLEX.test_cplex_paramsV  s_   88((DAqIINN1		1%A		"AaA AABHHQK0Iq5A:,KjjK8G $  "":. ARXX+?  AA "":. CRXXTBC -1#$	L MMME; ) A AC Cs   "F "F F F)c                 0    t        j                  d       y Nr  rH   rI   r%   s    r'   test_cplex_lp_0zTestCPLEX.test_cplex_lp_0v  r   r*   c                 0    t        j                  d       y r  rN   r%   s    r'   test_cplex_lp_1zTestCPLEX.test_cplex_lp_1y  r   r*   c                 0    t        j                  d       y r  rR   r%   s    r'   test_cplex_lp_2zTestCPLEX.test_cplex_lp_2|  r   r*   c                 b   t        j                         }| j                  t              5  |j                  j                  d       | j                  |j                  j                  t        j                  j                         d d d        t        j                  dd       y # 1 sw Y   !xY w)Nr  rH   Tr0   
reoptimizer  r  r  r  rC   r>   r   r   r#   r  r  r   rW   r  s     r'   test_cplex_lp_3zTestCPLEX.test_cplex_lp_3  sz    iikg& 	SHHNN'N*SXX__bkk.Q.QR	S 	!!TB		S 	Ss   AB%%B.c                 0    t        j                  d       y r  rZ   r%   s    r'   test_cplex_lp_4zTestCPLEX.test_cplex_lp_4  r   r*   c                 0    t        j                  d       y r  r^   r%   s    r'   test_cplex_lp_5zTestCPLEX.test_cplex_lp_5  r   r*   c                 0    t        j                  d       y r  rb   r%   s    r'   test_cplex_socp_0zTestCPLEX.test_cplex_socp_0  r  r*   c                 :    t        j                  ddddd       y )Nr  r   r   )zpreprocessing.presolvezpreprocessing.reduce)r0   r   r  rg   r%   s    r'   test_cplex_socp_1zTestCPLEX.test_cplex_socp_1  s#     	%%WQDEBC4E	Fr*   c                 0    t        j                  d       y r  rk   r%   s    r'   test_cplex_socp_2zTestCPLEX.test_cplex_socp_2  r  r*   c                 \    t        j                  d       t        j                  d       y r  ro   r%   s    r'   test_cplex_socp_3zTestCPLEX.test_cplex_socp_3  r  r*   c                 0    t        j                  d       y r  r.  r%   s    r'   test_cplex_mi_lp_0zTestCPLEX.test_cplex_mi_lp_0  r1  r*   c                 0    t        j                  d       y r  r3  r%   s    r'   test_cplex_mi_lp_1zTestCPLEX.test_cplex_mi_lp_1  r1  r*   c                 0    t        j                  d       y r  r7  r%   s    r'   test_cplex_mi_lp_2zTestCPLEX.test_cplex_mi_lp_2  r1  r*   c                 0    t        j                  d       y r  r;  r%   s    r'   test_cplex_mi_lp_3zTestCPLEX.test_cplex_mi_lp_3  r1  r*   c                 0    t        j                  d       y r  r?  r%   s    r'   test_cplex_mi_lp_5zTestCPLEX.test_cplex_mi_lp_5  r1  r*   c                 2    t        j                  dd       y )Nr  r   r'  rC  r%   s    r'   test_cplex_mi_socp_1zTestCPLEX.test_cplex_mi_socp_1  rF  r*   c                 0    t        j                  d       y r  rH  r%   s    r'   test_cplex_mi_socp_2zTestCPLEX.test_cplex_mi_socp_2  rK  r*   r~   )r   r   r   rP  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    sq    4/A^FF@222C226F6955555C9r*   r  GUROBIzGUROBI is not installed.c                       e Zd 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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y)
TestGUROBIzNOTE: solves of LPs (or MILPs) get routed through GUROBI's QP interface!
    So many of these tests are testing the behavior of qurobi_qpif.pyNc                    t        j                  d      | _        t        j                  d      | _        t        j                  d      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  dd	      | _        t        j                  d
d      | _        t        j                  d
d      | _	        t        j                  dd      | _
        y r   r"   r%   s    r'   r(   zTestGUROBI.setUp  r)   r*   c           	      ~   t         j                  t        v rPddl}ddl}t        j
                  d      }t        j
                  d      }t        j
                  d      }t        j
                  d      } |j                  ddgddgg      |_         |j                  ddg      |_         |j                  ddg      |_         |j                  ddg      |_        t        j                  |d   | j                  d   z  |d   | j                  d   z  z         }| j                  d   dz  |d   dz  k  | j                  d   |d   k  || j                  z  |k(  g}t        j                  ||      }	|	j                  t         j                  d      }
| j                  |
d       | j                  | j                  j                  ddg        |j                  ddgddgg      |_         |j                  ddg      |_         |j                  ddg      |_         |j                  ddg      |_        |	j                  t         j                  d      }
| j                  |
d       | j                  | j                  j                  ddg        |j                  ddgddgg      |_         |j                  ddg      |_         |j                  ddg      |_         |j                  ddg      |_        |	j                  t         j                  d      }
| j                  |
d       | j                  | j                  j                  ddg        |j                  ddgddgg      |_         |j                  ddg      |_         |j                  ddg      |_         |j                  ddg      |_        |	j                  t         j                  d      }
| j                  |
d	       | j                  | j                  j                  ddg        |j                  ddg      }|| j                  _        t        j                  ||      }	|	j                  t         j                  d      }
| j                  |
d	       | j                  | j                  j                  ddg       |	j                  j                   }|j#                         }t%        | j                  j&                        D ]R  }||   ||   j(                  k(  sJ  |j*                  | j                  j                  |   ||   j                        rRJ  t        j,                         }t        j,                  d
      } |j.                   |j0                  d      d
      }|dz   |_        t        j                  |t        j2                  |      z         }||k  |dk  g}t        j                  ||      }	|	j                  t         j                  d      }
| j                  |
|j3                         dz          | j                  |j                  d       | j                  |j                  |       |	j                  j                   }|j#                         }|j4                  j6                  |d   j(                  k(  sJ  |j*                  d|d   j                        sJ t%        d|j&                  dz         D ]y  }|dz
  |j8                  d   z  }|dz
  |j8                  d   z  }|||f   dz   ||   j(                  k(  sJ  |j*                  |j                  ||f   ||   j                        ryJ  y| j;                  t<              5 }t        j                  t        j>                  t        j@                  | j                  d            | j                  dk(  g      }	|	j                  t         j                  d       ddd       | j                  tC        jD                        dt         j                  z         y# 1 sw Y   @xY w)zMake sure that warm starting Gurobi behaves as expected
           Note: This only checks output, not whether or not Gurobi is warm starting internally
        r   Nr   r   r-   Tr   r   r   r    r   r  )#r#   r)  r   gurobipynumpyrg  r   r@   r   r   r:   r>   r?   rA   r   r   rs  getVarsr=   r  startr  r$   rv  aranger   GRB	UNDEFINEDr   r_  r  r;   r<   r  r  )r&   r.  r   r   r   r  r   r   r   rC   r   
init_valuemodelmodel_xrD   r   r   Y_valrowcolr  s                        r'   test_gurobi_warm_startz!TestGUROBI.test_gurobi_warm_start  s    99))V$AQAQAQAbhhAA/0AGbhh1v&AGbhh1v&AGbhh1v&AGAaD466!9$4qtdffQi7G$GHI66!9a<1Q47266!9!,tvv:?,K ::i5DZZryyTZBF""61-''q!f= bhhAA/0AGbhh1v&AGbhh1v&AGbhh1v&AG ZZryyTZBF""61-''q!f= bhhAA/0AGbhh1v&AGbhh1v&AGbhh1v&AG ZZryyTZBF""61-''q!f= bhhAA/0AGbhh1v&AGbhh1v&AGbhh1v&AG ZZryyTZBFVQ'''q!f= "1a&)J%DFFL::i5DZZryyTZBFVQ'''q!f=%%11EmmoG466;;' A!!}
(8(8888!rzz$&&,,q/71:<<@@@A
 AF#ABJJyryy|V4EaiAGAq	M2I:6#K::i5DZZryyTZBFVUYY[1_5""177A.''7%%11EmmoG<<))WQZ-=-====2::a...1affqj) C1u
*1u+S#X*gaj.>.>>>>!rzz!''#s("3WQZ\\BBB	C ""9- >zz"++bggdffa.@"ADFFaK=Q

"))
=> S.0QTVT]T]0]^> >s   =A7`33`<c           	      N   t         j                  t        v rddl}t        j                  | j
                  d         }t        j                  | j
                  d         dk  g}t        j                  ||      }	 |j                  t         j                  d       d}t        |dd      }|rt        |dd      }| j                  |d	       t        |d
d      }|r| j                  d       t        |dd      }	|	|j                  j                  k7  r| j                  d       yy| j!                  t              5 }
t        j                  t        j                  t        j"                  | j
                  d            | j
                  dk(  g      }|j                  t         j                  d       ddd       | j%                  t'        
j(                        dt         j                  z         y# t        $ r}| j                  d|z         Y d}~wd}~ww xY w# 1 sw Y   kxY w)at  Make sure that if Gurobi terminates due to a time limit before finding a solution:
            1) no error is raised,
            2) solver stats are returned.
            The test is skipped if something changes on Gurobi's side so that:
            - a solution is found despite a time limit of zero,
            - a different termination criteria is hit first.
        r   Nr-           r0   	TimeLimitz8An exception %s is raised instead of returning a result.r   rs  z$Solver stats have not been returned.SolCountz>Gurobi has found a solution, the test is not relevant anymore.StatuszdGurobi terminated for a different reason than reaching time limit, the test is not relevant anymore.r  )r#   r)  r   r.  r;   r   rh  r:   r>   r  failgetattr
assertTruer   r3  
TIME_LIMITr_  r<   r   r  r  )r&   r.  r   r   rC   r   rs  r   nb_solutionssolver_statusr  s              r'   "test_gurobi_time_limit_no_solutionz-TestGUROBI.test_gurobi_time_limit_no_solution6  s    99))DFF1I.I99TVVAY/145K::i5DZ

"))s
; K"4>L%lM4HOOK)OP";
DAL^_#K4@M 7 77 B C 8
 ""9- :zz"++bggdffa.@"ADFFaK=Q

"))q
9: S.0QTVT]T]0]^-  Z		TWXXYYZ&: :s%   ;!G0 :A7H0	H9HHH$c           	         t         j                  t        v rddl}t        j
                  j                         t        j
                  j                  d      t        j
                  j                         d}|j                         }|j                         D ]  \  }}|j                  ||        t        j                  d|      }|j                  j                  j                  }|j                         D ]/  \  }}|j                  |      \  }}	}
}}}| j!                  ||
       1 y| j#                  t$              5 }t        j&                  t        j(                  t        j*                  | j,                  d            | j,                  dk(  g      }|j/                  t         j                  d       ddd       | j!                  t1        j2                        d	t         j                  z         y# 1 sw Y   @xY w)
zTests that Gurobi environments can be passed to Model.
        Gurobi environments can include licensing and model parameter data.
        r   Nr   )MIPGapAggFillPerturbValuer)  )r0   r  r-   r>  r  )r#   r)  r   r.  r   r   randintr  itemssetParamr   rc   rC   r   rs  getParamInfor   r_  r  r:   r;   r<   r   r>   r  r  )r&   r.  r  
custom_envr  vr  r6  r   p_typep_valp_minp_maxp_defr  rC   s                   r'   test_gurobi_environmentz"TestGUROBI.test_gurobi_environment]  s    99)) ))**,99,,R0 "		 0 0 2F "J *1##Aq)* $//xZPCHH))55E +1;@;M;Ma;P8feUE5  E*+ ""9- :zz"++bggdffa.@"ADFFaK=Q

"))q
9: S.0QTVT]T]0]^: :s    A7G66G?c                 0    t        j                  d       y Nr)  rH   rI   r%   s    r'   test_gurobi_lp_0zTestGUROBI.test_gurobi_lp_0~  r  r*   c                 0    t        j                  d       y rZ  rN   r%   s    r'   test_gurobi_lp_1zTestGUROBI.test_gurobi_lp_1  r  r*   c                 0    t        j                  d       y rZ  rR   r%   s    r'   test_gurobi_lp_2zTestGUROBI.test_gurobi_lp_2  r  r*   c                    t        j                         }| j                  t              5  |j                  j                  d       | j                  |j                  j                  t        j                  j                         d d d        t        j                  dd       t        j                  dd       y # 1 sw Y   8xY w)Nr)  rH   r-   )r0   InfUnbdInfoTr  r  r  s     r'   test_gurobi_lp_3zTestGUROBI.test_gurobi_lp_3  s    iikg& 	SHHNN(N+SXX__bkk.Q.QR	S 	!!qA!!dC	S 	Ss   AB<<Cc                 2    t        j                  dd       y )Nr)  Tr  rZ   r%   s    r'   test_gurobi_lp_4zTestGUROBI.test_gurobi_lp_4  s    !!dCr*   c                 0    t        j                  d       y rZ  r^   r%   s    r'   test_gurobi_lp_5zTestGUROBI.test_gurobi_lp_5  r  r*   c                    t        j                  d      }|j                  j                  j                  }|j                  j                         d   j                  }|j                         D cg c]  }|j                   }}|j                         D cg c]  }|j                   }}t        j                  j                  ||g|       y c c}w c c}w )Nr)  rH   r   )r   r  rC   r   rs  	variablesboundsr0  LBUBr   testingassert_equal)r&   r  r6  expected_boundsrR  	actual_lb	actual_ubs          r'   test_gurobi_lp_bound_attrz$TestGUROBI.test_gurobi_lp_bound_attr  s    00A%%11((,,.q188#(==?3aQTT3	3#(==?3aQTT3	3


I 6H 43s   0CCc                 0    t        j                  d       y rZ  rb   r%   s    r'   test_gurobi_socp_0zTestGUROBI.test_gurobi_socp_0  r  r*   c                 0    t        j                  d       y rZ  rg   r%   s    r'   test_gurobi_socp_1zTestGUROBI.test_gurobi_socp_1  r  r*   c                 0    t        j                  d       y rZ  rk   r%   s    r'   test_gurobi_socp_2zTestGUROBI.test_gurobi_socp_2  r  r*   c                 \    t        j                  d       t        j                  d       y rZ  ro   r%   s    r'   test_gurobi_socp_3zTestGUROBI.test_gurobi_socp_3  r  r*   c                 P   t        j                  d      }|j                  j                  j                  }|j                  d      }|j                  j                         d   j                  }|j                  |j                  g}t        j                  j                  ||       y )Nr)  rH   x_0r   )r   test_socp_bounds_attrrC   r   rs  getVarByNamerh  ri  rj  rk  r   rl  rm  )r&   r  r6  r   rn  actual_boundss         r'   test_gurobi_socp_bound_attrz&TestGUROBI.test_gurobi_socp_bound_attr  sy    55XF%%11u%((,,.q188qtt


?r*   c                 0    t        j                  d       y rZ  r.  r%   s    r'   test_gurobi_mi_lp_0zTestGUROBI.test_gurobi_mi_lp_0      $$H5r*   c                 0    t        j                  d       y rZ  r3  r%   s    r'   test_gurobi_mi_lp_1zTestGUROBI.test_gurobi_mi_lp_1  r  r*   c                 0    t        j                  d       y rZ  r7  r%   s    r'   test_gurobi_mi_lp_2zTestGUROBI.test_gurobi_mi_lp_2  r  r*   c                 0    t        j                  d       y rZ  r;  r%   s    r'   test_gurobi_mi_lp_3zTestGUROBI.test_gurobi_mi_lp_3  r  r*   c                 0    t        j                  d       y rZ  r?  r%   s    r'   test_gurobi_mi_lp_5zTestGUROBI.test_gurobi_mi_lp_5  r  r*   c                 2    t        j                  dd       y )Nr)  r   r'  rC  r%   s    r'   test_gurobi_mi_socp_1z TestGUROBI.test_gurobi_mi_socp_1  s    ((Cr*   c                 0    t        j                  d       y rZ  rH  r%   s    r'   test_gurobi_mi_socp_2z TestGUROBI.test_gurobi_mi_socp_2      ((9r*   r~   )r   r   r   rP  r(   r;  rH  rX  r[  r]  r_  rb  rd  rf  rq  rs  ru  rw  ry  r  r  r  r  r  r  r  r  r   r*   r'   r+  r+    s    I/i_V%_N_B333	DD3I777:@66666D:r*   r+  XPRESSzXPRESS is not installed.c                       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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y)
TestXPRESSNc                    t        j                  d      | _        t        j                  d      | _        t        j                  d      | _        t        j                  ddd      | _        t        j                  d	d
      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  dd      | _	        t        j                  dd      | _
        y )Nr   r   r   r   r   r   Tr   integerr   r   r   r   r   r   r    r!   r"   r%   s    r'   r(   zTestXPRESS.setUp  s    #&#&#&QS$7QS)QS)V#.V#.V#.r*   c           	      	   t         j                  t        v rddl}t        j                  d      }t        j                  d      }t        j                  d      }t        j                  d      } |j
                  ddgddgg      |_         |j
                  ddg      |_         |j
                  ddg      |_         |j
                  ddg      |_        t        j                  |d   | j                  d   z  |d   | j                  d   z  z         }| j                  d   |d   k  | j                  d   |d   k  || j                  z  |k(  g}t        j                  ||      }|j                  t         j                  d      }	| j                  |	d       | j                  | j                  j                  ddg        |j
                  ddgddgg      |_         |j
                  ddg      |_         |j
                  ddg      |_         |j
                  ddg      |_        |j                  t         j                  d      }	| j                  |	d       | j                  | j                  j                  ddg        |j
                  ddgddgg      |_         |j
                  ddg      |_         |j
                  ddg      |_         |j
                  ddg      |_        |j                  t         j                  d      }	| j                  |	d       | j                  | j                  j                  ddg        |j
                  ddgddgg      |_         |j
                  ddg      |_         |j
                  ddg      |_         |j
                  ddg      |_        |j                  t         j                  d      }	| j                  |	d	       | j                  | j                  j                  ddg       y| j                  t              5 }
t        j                  t        j                  t        j                   | j                  d            | j                  dk(  g      }|j                  t         j                  d       ddd       | j                  t#        
j$                        d
t         j                  z         y# 1 sw Y   @xY w)zMake sure that warm starting Xpress behaves as expected
           Note: Xpress does not have warmstart yet, it will re-solve problem from scratch
        r   Nr   r   r-   Tr   r   r   r  )r#   r  r   r/  rg  r   r@   r   r   r:   r>   r   rA   r_  r  r;   r<   r  r  )r&   r   r   r   r  r   r   r   rC   r   r  s              r'   test_xpress_warm_startz!TestXPRESS.test_xpress_warm_start  s    99))V$AQAQAQAbhhAA/0AGbhh1v&AGbhh1v&AGbhh1v&AGAaD466!9$4qtdffQi7G$GHI66!9!,66!9!,tvv:?,K ::i5DZZryyTZBFVQ'''q!f= bhhAA/0AGbhh1v&AGbhh1v&AGbhh1v&AG ZZryyTZBFVQ'''q!f= bhhAA/0AGbhh1v&AGbhh1v&AGbhh1v&AG ZZryyTZBFVQ'''q!f= bhhAA/0AGbhh1v&AGbhh1v&AGbhh1v&AG ZZryyTZBFVQ'''q!f= ""9- >zz"++bggdffa.@"ADFFaK=Q

"))
=> S.0QTVT]T]0]^> >s   !A7SS c                     t         j                  t        v rd\  }}t        j                  j                  d       t        j                  j                  ||      }t        j                  j                  |      }|j                  |      }t        j                  |      }t        j                  t        j                  |            }||z  |k(  g}t        j                  ||      }	ddd}
 |	j                  ddt         j                  i|
 y y )Nr  r   r  )lpiterlimitmaxtimer0   r   )r#   r  r   r   r   r   ra  r   r$   r;   r^  r:   r>   )r&   r   rf  r   r   r   r   r   r   r   r  s              r'   test_xpress_paramszTestXPRESS.test_xpress_params#  s    99))DAqIINN1		1%A		"AaA AABHHQK0Iq5A:,KjjK8G  $F GMM55f5# *r*   c                    t         j                  t        v rt        j                  ddgddgddgg      }t        j                  g d      }t        j
                  d      }t        j                  t        j                  |            }||z  |k  g}t        j                  ||      }ddi} |j                  ddt         j                  i| y y )	Nr   r-   r   r   rq  save_iisr   r0   r   )
r#   r  r   r   r   r$   r;   norm2r:   r>   r&   r   r   r   r   
constraintr   r  s           r'   test_xpress_iis_nonezTestXPRESS.test_xpress_iis_none7  s    99))1a&1a&2r(34A$AAABHHQK0Ia%1*JjjJ7G !_FGMM55f5 *r*   c                    t         j                  t        v rt        j                  ddgddgddgg      }t        j                  g d      }t        j
                  d      }t        j                  t        j                  |            }||z  |k  g}t        j                  ||      }ddi} |j                  d	dt         j                  i| d|j                  j                  v sJ y y )
Nr   r-   r  r  r  ro  r0   
XPRESS_IISr   )r#   r  r   r   r   r$   r;   r  r:   r>   solutionattrr  s           r'   test_xpress_iis_fullzTestXPRESS.test_xpress_iis_fullE  s    99))1a&1a&2r(34A$AAABHHQK0Ia%1*JjjJ7G "%FGMM55f57#3#3#8#8888 *r*   c                 0    t        j                  d       y Nr  rH   rI   r%   s    r'   test_xpress_lp_0zTestXPRESS.test_xpress_lp_0U  r  r*   c                 0    t        j                  d       y r  rN   r%   s    r'   test_xpress_lp_1zTestXPRESS.test_xpress_lp_1X  r  r*   c                 0    t        j                  d       y r  rR   r%   s    r'   test_xpress_lp_2zTestXPRESS.test_xpress_lp_2[  r  r*   c                 0    t        j                  d       y r  rV   r%   s    r'   test_xpress_lp_3zTestXPRESS.test_xpress_lp_3^  r  r*   c                 0    t        j                  d       y r  rZ   r%   s    r'   test_xpress_lp_4zTestXPRESS.test_xpress_lp_4a  r  r*   c                 0    t        j                  d       y r  rb   r%   s    r'   test_xpress_socp_0zTestXPRESS.test_xpress_socp_0d  r  r*   c                 0    t        j                  d       y r  rg   r%   s    r'   test_xpress_socp_1zTestXPRESS.test_xpress_socp_1g  r  r*   c                 0    t        j                  d       y r  rk   r%   s    r'   test_xpress_socp_2zTestXPRESS.test_xpress_socp_2j  r  r*   c                 0    t        j                  d       y r  r.  r%   s    r'   test_xpress_mi_lp_0zTestXPRESS.test_xpress_mi_lp_0m  r  r*   c                 0    t        j                  d       y r  r3  r%   s    r'   test_xpress_mi_lp_1zTestXPRESS.test_xpress_mi_lp_1p  r  r*   c                 0    t        j                  d       y r  r7  r%   s    r'   test_xpress_mi_lp_2zTestXPRESS.test_xpress_mi_lp_2s  r  r*   c                 0    t        j                  d       y r  r;  r%   s    r'   test_xpress_mi_lp_3zTestXPRESS.test_xpress_mi_lp_3v  r  r*   c                 0    t        j                  d       y r  r?  r%   s    r'   test_xpress_mi_lp_5zTestXPRESS.test_xpress_mi_lp_5y  r  r*   c                 0    t        j                  d       y r  rC  r%   s    r'   test_xpress_mi_socp_1z TestXPRESS.test_xpress_mi_socp_1|  r  r*   c                 0    t        j                  d       y r  rH  r%   s    r'   test_xpress_mi_socp_2z TestXPRESS.test_xpress_mi_socp_2  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    si    /B_H6(69 3333377766666::r*   r  NAGzNAG is not installed.c                   d    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dZy)TestNAGNc                 0    t        j                  d       y Nr  rH   rI   r%   s    r'   test_nag_lp_0zTestNAG.test_nag_lp_0  r&  r*   c                 0    t        j                  d       y r  rN   r%   s    r'   test_nag_lp_1zTestNAG.test_nag_lp_1  r&  r*   c                 0    t        j                  d       y r  rR   r%   s    r'   test_nag_lp_2zTestNAG.test_nag_lp_2  r&  r*   c                 0    t        j                  d       y r  rV   r%   s    r'   test_nag_lp_3zTestNAG.test_nag_lp_3  r&  r*   c                 0    t        j                  d       y r  rZ   r%   s    r'   test_nag_lp_4zTestNAG.test_nag_lp_4  r&  r*   c                 0    t        j                  d       y r  r^   r%   s    r'   test_nag_lp_5zTestNAG.test_nag_lp_5  r&  r*   c                 0    t        j                  d       y r  rb   r%   s    r'   test_nag_socp_0zTestNAG.test_nag_socp_0      %%U3r*   c                 0    t        j                  d       y r  rg   r%   s    r'   test_nag_socp_1zTestNAG.test_nag_socp_1  r  r*   c                 0    t        j                  d       y r  rk   r%   s    r'   test_nag_socp_2zTestNAG.test_nag_socp_2  r  r*   c                 \    t        j                  d       t        j                  d       y r  ro   r%   s    r'   test_nag_socp_3zTestNAG.test_nag_socp_3  r1  r*   c                    t        j                  d      }t        j                  |      }|dk\  g}t        j                  t        j                  |      |      }|j                  d      }| j                  |d   d   j                  dt        j                  d      z         |j                  d      }t        j                  t        j                  |      |      }ddi}|j                  d|	      }d|d   vsJ  |j                  dd
di|}t        j                  ||      sJ t        j                  |d      }t        j                  t        j                  |      |      }|j                  d      }d|d   vsJ y)z>Test NAG canonicalization with a quadratic objective.
        r   r-   r  rH   r   r  r  Fr  r0   Nr   )r#   r$   r  r:   r;   r  rA   r   r   r  r>   r  r<   )	r&   r   r  r   rC   r  r  r  r  s	            r'   test_nag_quad_objzTestNAG.test_nag_quad_obj  sU    KKN~~a q&zz"++d+V4$$E$2##DGCLNNAbffQiK@JJeJ,	 zz"++d+V4%u-$$E{$K$q'!!!DJJ;e;{;	zz)Y/// wwq!}zz"++d+V4$$E$2$q'!!!r*   r~   )r   r   r   r  r  r  r  r  r  r  r  r  r  r  r   r*   r'   r  r    s9    0000004447"r*   r  SCIPzSCIP is not installed.c                       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dZddZddZddZddZddZd ZddZddZddZddZddZddZy)TestSCIPNc                 0    t        j                  d       y Nr  rH   rI   r%   s    r'   test_scip_lp_0zTestSCIP.test_scip_lp_0  rL   r*   c                 0    t        j                  d       y r  rN   r%   s    r'   test_scip_lp_1zTestSCIP.test_scip_lp_1  rL   r*   c                 2    t        j                  dd       y Nr  Fr  rR   r%   s    r'   test_scip_lp_2zTestSCIP.test_scip_lp_2  s    !!u=r*   c                 0    t        j                  d       y r  rV   r%   s    r'   test_scip_lp_3zTestSCIP.test_scip_lp_3  rL   r*   c                 0    t        j                  d       y r  rZ   r%   s    r'   test_scip_lp_4zTestSCIP.test_scip_lp_4  rL   r*   c                 0    t        j                  d       y r  rb   r%   s    r'   test_scip_socp_0zTestSCIP.test_scip_socp_0  re   r*   c                 4    t        j                  ddd       y Nr  r   F)r0   r   r  rg   r%   s    r'   test_scip_socp_1zTestSCIP.test_scip_socp_1      %%VAUKr*   c                 4    t        j                  ddd       y r  rk   r%   s    r'   test_scip_socp_2zTestSCIP.test_scip_socp_2  r  r*   c                 `    t        j                  dd       t        j                  dd       y r  ro   r%   s    r'   test_scip_socp_3zTestSCIP.test_scip_socp_3  s"    ((eD((eDr*   c                 0    t        j                  d       y r  r.  r%   s    r'   test_scip_mi_lp_0zTestSCIP.test_scip_mi_lp_0      $$F3r*   c                 0    t        j                  d       y r  r3  r%   s    r'   test_scip_mi_lp_1zTestSCIP.test_scip_mi_lp_1  r  r*   c                 0    t        j                  d       y r  r7  r%   s    r'   test_scip_mi_lp_2zTestSCIP.test_scip_mi_lp_2  r  r*   c                 0    t        j                  d       y r  r;  r%   s    r'   test_scip_mi_lp_3zTestSCIP.test_scip_mi_lp_3  r  r*   c                 0    t        j                  d       y r  r?  r%   s    r'   test_scip_mi_lp_5zTestSCIP.test_scip_mi_lp_5  r  r*   c                 2    t        j                  dd       y )Nr  r   r'  rC  r%   s    r'   test_scip_mi_socp_1zTestSCIP.test_scip_mi_socp_1  s    ((qAr*   c                 0    t        j                  d       y r  rH  r%   s    r'   test_scip_mi_socp_2zTestSCIP.test_scip_mi_socp_2      ((7r*   c                     t        j                         }t        j                         }|dk\  |dk\  ||z   dk  g}t        j                  |      }t        j                  ||      }|S )z9Example problem that can be used within additional tests.r   r-   r   )r#   r$   r   r:   )r&   r   r   r   r   rC   s         r'   get_simple_problemzTestSCIP.get_simple_problem  s\    KKMKKMFFEQJ

 kk!nzz#{+r*   c                 j    | j                         }|j                  d       |j                  dk(  sJ y )Nr  rH   r   r  r>   r@   r&   rC   s     r'   $test_scip_test_params__no_params_setz-TestSCIP.test_scip_test_params__no_params_set	  s.    &&(

&
!zzQr*   c                 l    | j                         }|j                  dd       |j                  dk(  sJ y )Nr  F)r0   gpr   r  r  s     r'   #test_scip_test_params__valid_paramsz,TestSCIP.test_scip_test_params__valid_params	  s0    &&(

&U
+zzQr*   c                 r    | j                         }|j                  dddd       |j                  dk(  sJ y )Nr  r-   r  )z
lp/fastmipz
limits/gapr0   scip_paramsr   r  r  s     r'   (test_scip_test_params__valid_scip_paramsz1TestSCIP.test_scip_test_params__valid_scip_params	  s5    &&(

&Qc.R
SzzQr*   c                     | j                         }t        j                  t              5 }|j	                  dd       d}|j
                  |k(  sJ 	 d d d        y # 1 sw Y   y xY w)Nr  what?)r0   r   zNOne or more solver params in ['a'] are not valid: 'Not a valid parameter name'r  rd  r  KeyErrorr>   r  r&   rC   keexcs       r'   %test_scip_test_params__invalid_paramsz.TestSCIP.test_scip_test_params__invalid_params	  s\    &&( ]]8$ 	'JJfJ0bC<<3&&&	' 	' 	's   'AA$c                     | j                         }t        j                  t              5 }|j	                  dddi       d}|j
                  |k(  sJ 	 d d d        y # 1 sw Y   y xY w)Nr  r   r  r  zLOne or more scip params in ['a'] are not valid: 'Not a valid parameter name'r  r  s       r'   *test_scip_test_params__invalid_scip_paramsz3TestSCIP.test_scip_test_params__invalid_scip_params!	  s`    &&( ]]8$ 	'JJf3.JA`C<<3&&&	' 	' 	's   )AA&c                    t        j                         }t        j                  t        j
                  j                        5 }|j                  dddi       d}t        |j                        |k(  sJ 	 d d d        y # 1 sw Y   y xY w)Nr  zlimits/timer=  r  zZSolver 'SCIP' failed. Try another solver, or solve with verbose=True for more information.)
r  mi_lp_7rd  r  r#   r  r  r>   r  r@   )r&   r  ser  s       r'   test_scip_time_limit_reachedz%TestSCIP.test_scip_time_limit_reached*	  so    lln ]]288//0 	(BIIV-1EIFYCrxx=C'''		( 	( 	(s   2A>>B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    sy    11>115LLE44444B8''(r*   r  HIGHSzHiGHS is not installed.c                   R   e Zd Zej                  j                  dej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                   ej"                  ej$                  g      d
d       Zej                  j                  ddgej                  dfej                  dfg      d
d       Zd
dZej                  j                  dej                  ej                  g      d
d	       Zy)	TestHIGHSr   Nc                 @    ddl m}  |       }d |_         ||       y )Nr   )r'  c                       y)NzHIGHS CONICr   r   r*   r'   <lambda>z.TestHIGHS.test_highs_solving.<locals>.<lambda>U	  s    r*   rH   )2cvxpy.reductions.solvers.conic_solvers.highs_conifr'  r   )r&   r   r'  r0   s       r'   test_highs_solvingzTestHIGHS.test_highs_solving?	  s    ( 	M+vr*   confirmation_stringzSolving LP with useful basiszAssessing feasibility of MIPc                      |t         j                  d      }|j                  j                  t         j                  dd       |j	                         }t        j                  ||j                        J y)a  Test that HiGHS actually gets warm started for each problem type.

        Args:
            problem: LP or MIP.
            confirmation_string: Regex that confirms that HiGHS was warm started.
            capfd: Captures stdout to search for confirmation_string.
        T)r8   )r9   r8   N)r#   r'  rC   r>   r7  researchr>  )r&   r   r/  r3  r   captureds         r'   test_highs_warm_startzTestHIGHS.test_highs_warm_startX	  sX     BHHd+	RXX$=##%yy,hll;GGGr*   c                 0    t        j                  d       y)z3Test HiGHS solver with non-capitalized solver name.HiGHSrH   NrI   r%   s    r'   test_highs_nonstandard_namez%TestHIGHS.test_highs_nonstandard_namem	  s     	!!1r*   c           	      *   t        j                  t              5   |t        j                  dd i       d d d        t        j                  t              5   |t        j                  d        d d d        d}t        j                  t              5   |t        j                  d|i       d d d        t        j                  t              5   |t        j                  |       d d d        t        j                  t
              5   |t        j                  dt        d      	       d d d        d
dddddddd} |t        j                  |       y # 1 sw Y   %xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   ^xY w)Ninvalid_highs_option)r0   highs_options)r0   r9  _invalid_value_threads)r0   r<  r2  )r1  )r0   r1  r:  simplexTgrh|?i  r.   r  i   )r0   output_flag
time_limitrandom_seedmip_rel_gapprimal_feasibility_tolerancedual_feasibility_tolerancepresolve_rule_off)rd  r  ra  r#   r'  	TypeErrorrI  )r&   r   invalid_valuer:  s       r'   test_highs_optionszTestHIGHS.test_highs_optionsr	  sP    ]]:& 	S2884JD3QR	S ]]:& 	@288$?	@ *]]:& 	O288I}3MN	O ]]:& 	<288];	< ]]9% 	Y288e4QVCWX	Y
  ,0*.!&
 	rxx}==	S 	S	@ 	@	O 	O	< 	<	Y 	Ys;   EE%E1E=$F	E"%E.1E:=F	Fr~   )r   r   r   rd  rB  rD  r   rJ   rO   rS   rW   r[   r_   r/  r4  r8  r<  rm  r@  r.  r4  r7  rG  r   r*   r'   r)  r)  =	  s'   [[%%%%%%%%%%%%((((((((((((	
"#" [[	)*&&(FG))+IJ	
HH2
 [[		"	"O$@$@A
>
>r*   r)  c                   $    e Zd ZddZddZddZy)TestAllSolversNc                    t        j                  d      | _        t        j                  d      | _        t        j                  d      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  dd	      | _        t        j                  d
d      | _        t        j                  d
d      | _	        t        j                  dd      | _
        y r   r"   r%   s    r'   r(   zTestAllSolvers.setUp	  r)   r*   c                    ddl m}m}m} t	        j
                  t	        j                  t	        j                  | j                  d      dz         | j                  dk(  g      }|j                         D ]  }||v rW|j                  |       | j                  |j                  d       | j                  | j                  j                  ddg       ^| j                  t              5 }|j                  |       ddd       | j!                  t#        j$                        d|z          |j                         D ]  }||v r;|j                  |       | j                  | j                  j                  ddg       B| j                  t              5 }|j                  |       ddd       | j!                  t#        j$                        d|z          y# 1 sw Y   xY w# 1 sw Y   @xY w)z,Test the list of installed solvers.
        r   )r   SOLVER_MAP_CONICSOLVER_MAP_QPr-   r.   rH   Nr  ) cvxpy.reductions.solvers.definesr   rL  rM  r#   r:   r;   r<   r   rH  r>   r?   r@   rA   r_  r  r   r  r  )r&   r   rL  rM  rC   r0   r  s          r'   test_installed_solversz%TestAllSolvers.test_installed_solvers	  s   	
 	

 zz"++bggdffa&83&>?$&&A+O&++- 	`F**

&
)&&tzz37++DFFLL1a&A&&y1 .RJJfJ-.  R\\!24UX^4^_	` $((* 	`F**

&
)++DFFLL1a&A&&y1 .RJJfJ-.  R\\!24UX^4^_	`	. .. .s   &GG$G!	$G-	c                    t        j                  ddd      }t        j                  t        j                  |            }t        j                  ||dk\  g      }t
        t         j                  gk(  rIt        j                  t         j                  j                  d      5  |j                          d d d        y |j                          | j                  |j                  ddg       y # 1 sw Y   y xY w)Nr   r   Tr  r   .You need a mixed-integer solver for this modelr  )r#   r$   r;   r   r:   r   ECOS_BBrd  r  r  r  r>   rA   r@   r&   r   r   rC   s       r'   test_mixed_integer_behaviorz*TestAllSolvers.test_mixed_integer_behavior	  s    KKT2KKq	*	zz)a1fX.BJJ</rxx33 <S T 

  JJL''!Q8 s   "C++C4r~   )r   r   r   r(   rO  rT  r   r*   r'   rI  rI  	  s    /`8
9r*   rI  zECOS_BB is not installed.c                      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dZddZddZddZej$                  j'                  d      dd       ZddZddZej$                  j'                  d      dd       Zy)TestECOS_BBNc                    t        j                  ddd      }t        j                  t        j                  |            }t        j                  ||dk\  g      }t
        t         j                  gk7  r:|j                          |j                  j                  t         j                  k7  sJ yt        j                  t         j                  j                  d      5  |j                          ddd       y# 1 sw Y   yxY w)	z3Test that ECOS_BB isn't chosen by default.
        r-   r   Tr  r   rQ  r  N)r#   r$   r;   r   r:   r   rR  r>   r   solver_namerd  r  r  r  rS  s       r'   test_ecos_bb_explicit_onlyz&TestECOS_BB.test_ecos_bb_explicit_only	  s     KKT2KKq	*	zz)a1fX.BJJ</JJL$$00BJJ>>>rxx33 <S T 

  s   C66C?c                 0    t        j                  d       y NrR  rH   rI   r%   s    r'   test_ecos_bb_lp_0zTestECOS_BB.test_ecos_bb_lp_0	      !!3r*   c                 \    t        j                  d       t        j                  d       y r[  rN   r%   s    r'   test_ecos_bb_lp_1zTestECOS_BB.test_ecos_bb_lp_1	  s    !!3!!3r*   c                 0    t        j                  d       y r[  rR   r%   s    r'   test_ecos_bb_lp_2zTestECOS_BB.test_ecos_bb_lp_2	  r]  r*   c                 0    t        j                  d       y r[  rV   r%   s    r'   test_ecos_bb_lp_3zTestECOS_BB.test_ecos_bb_lp_3	  r]  r*   c                 0    t        j                  d       y r[  rZ   r%   s    r'   test_ecos_bb_lp_4zTestECOS_BB.test_ecos_bb_lp_4	  r]  r*   c                 0    t        j                  d       y r[  r^   r%   s    r'   test_ecos_bb_lp_5zTestECOS_BB.test_ecos_bb_lp_5	  r]  r*   c                 0    t        j                  d       y r[  rb   r%   s    r'   test_ecos_bb_socp_0zTestECOS_BB.test_ecos_bb_socp_0	      %%Y7r*   c                 0    t        j                  d       y r[  rg   r%   s    r'   test_ecos_bb_socp_1zTestECOS_BB.test_ecos_bb_socp_1	  rj  r*   c                 0    t        j                  d       y r[  rk   r%   s    r'   test_ecos_bb_socp_2zTestECOS_BB.test_ecos_bb_socp_2	  rj  r*   c                 \    t        j                  d       t        j                  d       y r[  ro   r%   s    r'   test_ecos_bb_socp_3zTestECOS_BB.test_ecos_bb_socp_3
  s    ((	:((	:r*   c                 0    t        j                  d       y r[  ru   r%   s    r'   test_ecos_bb_expcone_1z"TestECOS_BB.test_ecos_bb_expcone_1
  s    ''y9r*   c                 0    t        j                  d       y r[  rz   r%   s    r'   test_ecos_bb_exp_soc_1z"TestECOS_BB.test_ecos_bb_exp_soc_1

  s    ++9=r*   c                 0    t        j                  d       y r[  r.  r%   s    r'   test_ecos_bb_mi_lp_0z TestECOS_BB.test_ecos_bb_mi_lp_0
  rd  r*   zKnown bug in ECOS BBr  c                 0    t        j                  d       y r[  r7  r%   s    r'   test_ecos_bb_mi_lp_2z TestECOS_BB.test_ecos_bb_mi_lp_2
  s    $$I6r*   c                 0    t        j                  d       y r[  r;  r%   s    r'   test_ecos_bb_mi_lp_3z TestECOS_BB.test_ecos_bb_mi_lp_3
  rd  r*   c                 0    t        j                  d       y r[  r?  r%   s    r'   test_ecos_bb_mi_lp_5z TestECOS_BB.test_ecos_bb_mi_lp_5
  rd  r*   c                 0    t        j                  d       y r[  rC  r%   s    r'   test_ecos_bb_mi_socp_1z"TestECOS_BB.test_ecos_bb_mi_socp_1
  s    ((	:r*   r~   )r   r   r   rY  r\  r_  ra  rc  re  rg  ri  rl  rn  rp  rr  rt  rv  rd  rB  r  rx  rz  r|  r~  r   r*   r'   rV  rV  	  s    444444888;:>7 [[347 5777 [[34; 5;r*   rV  c                   
   e Zd Zd ZddZddZddZddZddZddZ	dd	Z
 ej                  d
ev d      dd       Z ej                  d
ev d      dd       Z ej                  d
ev d      dd       Z ej                  d
ev d      dd       Z ej                  d
ev d      dd       Z ej                  d
ev d      dd       Z ej                  d
ev d      dd       Z ej                  d
ev d      dd       Zy)	TestSCIPYc                 X    dd l }t        |j                        t        d      k\  | _        y )Nr   z1.7.0)scipyr   r  d)r&   r  s     r'   r(   zTestSCIPY.setUp!
  s!    **+ww/??r*   Nc                 F    t        j                  d| j                         y NSCIPYr  )r   rJ   r  r%   s    r'   test_scipy_lp_0zTestSCIPY.test_scipy_lp_0%
      !!?r*   c                 F    t        j                  d| j                         y r  )r   rO   r  r%   s    r'   test_scipy_lp_1zTestSCIPY.test_scipy_lp_1(
  r  r*   c                 F    t        j                  d| j                         y r  )r   rS   r  r%   s    r'   test_scipy_lp_2zTestSCIPY.test_scipy_lp_2+
  r  r*   c                 0    t        j                  d       y Nr  rH   rV   r%   s    r'   test_scipy_lp_3zTestSCIPY.test_scipy_lp_3.
  r   r*   c                 0    t        j                  d       y r  rZ   r%   s    r'   test_scipy_lp_4zTestSCIPY.test_scipy_lp_41
  r   r*   c                 F    t        j                  d| j                         y r  )r   r_   r  r%   s    r'   test_scipy_lp_5zTestSCIPY.test_scipy_lp_54
  r  r*   c                     t        j                  d| j                        }| j                  |j                  j
                  j                  d       y )Nr  r  r   )r   rJ   r  assertGreaterEqualrC   r   r  r  s     r'   test_scipy_lp_solver_statsz$TestSCIPY.test_scipy_lp_solver_stats7
  s:    ''wdffE 	 5 5 ? ?Cr*   r  z SCIPY version cannot solve MILPsc                 0    t        j                  d       y r  r.  r%   s    r'   test_scipy_mi_lp_0zTestSCIPY.test_scipy_mi_lp_0=
      $$G4r*   c                 0    t        j                  d       y r  r3  r%   s    r'   test_scipy_mi_lp_1zTestSCIPY.test_scipy_mi_lp_1A
  r  r*   c                 0    t        j                  d       y r  r7  r%   s    r'   test_scipy_mi_lp_2zTestSCIPY.test_scipy_mi_lp_2E
  r  r*   c                 0    t        j                  d       y r  r;  r%   s    r'   test_scipy_mi_lp_3zTestSCIPY.test_scipy_mi_lp_3I
  r  r*   c                 0    t        j                  d       y r  rl  r%   s    r'   test_scipy_mi_lp_4zTestSCIPY.test_scipy_mi_lp_4M
  r  r*   c                 0    t        j                  d       y r  r?  r%   s    r'   test_scipy_mi_lp_5zTestSCIPY.test_scipy_mi_lp_5Q
  r  r*   c                 V    t        j                         }|j                  dddi       y )Nr  r?  r  )r0   scipy_options)r  r$  r>   r  s     r'    test_scipy_mi_time_limit_reachedz*TestSCIPY.test_scipy_mi_time_limit_reachedU
  s$    lln 			s0C	Dr*   c                 v   t        j                         }|j                  d       | j                  d|j                  j
                  j                  v        | j                  d|j                  j
                  j                  v        | j                  d|j                  j
                  j                  v        y )Nr  rH   mip_gapmip_node_countmip_dual_bound)r  r$  r>   rD  rC   r   rs  r  s     r'   test_scipy_mi_solver_statsz$TestSCIPY.test_scipy_mi_solver_stats\
  s    lln			!	SXX%:%:%F%FFG(CHH,A,A,M,MMN(CHH,A,A,M,MMNr*   r~   )r   r   r   r(   r  r  r  r  r  r  r  r  
skipUnlessr   r  r  r  r  r  r  r  r  r   r*   r'   r  r  
  s   @@@@22@D X$88:\]5 ^5 X$88:\]5 ^5 X$88:\]5 ^5 X$88:\]5 ^5 X$88:\]5 ^5 X$88:\]5 ^5 X$88:\]E ^E X$88:\]O ^Or*   r  COPTzCOPT is not installed.c                       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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y)TestCOPTNc                 0    t        j                  d       y Nr  rH   rI   r%   s    r'   test_copt_lp_0zTestCOPT.test_copt_lp_0h
  rL   r*   c                 0    t        j                  d       y r  rN   r%   s    r'   test_copt_lp_1zTestCOPT.test_copt_lp_1k
  rL   r*   c                 0    t        j                  d       y r  rR   r%   s    r'   test_copt_lp_2zTestCOPT.test_copt_lp_2n
  rL   r*   c                 0    t        j                  d       y r  rV   r%   s    r'   test_copt_lp_3zTestCOPT.test_copt_lp_3q
  rL   r*   c                 0    t        j                  d       y r  rZ   r%   s    r'   test_copt_lp_4zTestCOPT.test_copt_lp_4t
  rL   r*   c                 0    t        j                  d       y r  r^   r%   s    r'   test_copt_lp_5zTestCOPT.test_copt_lp_5w
  rL   r*   c                 0    t        j                  d       y r  rb   r%   s    r'   test_copt_socp_0zTestCOPT.test_copt_socp_0z
  re   r*   c                 2    t        j                  dd       y )Nr  r   r'  rg   r%   s    r'   test_copt_socp_1zTestCOPT.test_copt_socp_1}
  s    %%VA>r*   c                 0    t        j                  d       y r  rk   r%   s    r'   test_copt_socp_2zTestCOPT.test_copt_socp_2
  re   r*   c                 \    t        j                  d       t        j                  d       y r  ro   r%   s    r'   test_copt_socp_3zTestCOPT.test_copt_socp_3
  rs   r*   c                 0    t        j                  d       y r  ru   r%   s    r'   test_copt_expcone_1zTestCOPT.test_copt_expcone_1
  rx   r*   c                 0    t        j                  d       y r  rz   r%   s    r'   test_copt_exp_soc_1zTestCOPT.test_copt_exp_soc_1
  r}   r*   c                 0    t        j                  d       y r  r.  r%   s    r'   test_copt_mi_lp_0zTestCOPT.test_copt_mi_lp_0
  r  r*   c                 0    t        j                  d       y r  r3  r%   s    r'   test_copt_mi_lp_1zTestCOPT.test_copt_mi_lp_1
  r  r*   c                 0    t        j                  d       y r  r7  r%   s    r'   test_copt_mi_lp_2zTestCOPT.test_copt_mi_lp_2
  r  r*   c                 0    t        j                  d       y r  r;  r%   s    r'   test_copt_mi_lp_3zTestCOPT.test_copt_mi_lp_3
  r  r*   c                 0    t        j                  d       y r  r?  r%   s    r'   test_copt_mi_lp_5zTestCOPT.test_copt_mi_lp_5
  r  r*   c                 0    t        j                  d       y r  rC  r%   s    r'   test_copt_mi_socp_1zTestCOPT.test_copt_mi_socp_1
  r  r*   c                 0    t        j                  d       y r  rH  r%   s    r'   test_copt_mi_socp_2zTestCOPT.test_copt_mi_socp_2
  r  r*   c                 0    t        j                  d       y r  r3  r%   s    r'   test_copt_sdp_1minzTestCOPT.test_copt_sdp_1min
      &&f5r*   c                 0    t        j                  d       y r  )r   r  r%   s    r'   test_copt_sdp_1maxzTestCOPT.test_copt_sdp_1max
  r  r*   c                 0    t        j                  d       y r  r8  r%   s    r'   test_copt_sdp_2zTestCOPT.test_copt_sdp_2
  r  r*   c                 z   d}d}t         j                  j                  d       t         j                  j                  ||      }t         j                  j                  |      }|j	                  |      }t        j                  |      }t        j                  t        j                  |            }||z  |k(  g}t        j                  ||      }	| j                  t              5  |	j                  t
        j                  d        d d d        |	j                  t
        j                  d       y # 1 sw Y   +xY w)Nr   r   r   rT  r\  )r0   r1   )r   r   r   ra  r   r#   r$   r;   r^  r:   r_  AttributeErrorr>   r  rl  s
             r'   test_copt_paramszTestCOPT.test_copt_params
  s    
		qIIOOAq!IIOOAEE!H KKNKK,	1uzl**Y4~. 	>MMM=	> 	RWWd3		> 	>s   %"D11D: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  e
  su    1111115?587;44444886634r*   r  COSMOzCOSMO is not installed.c                       e Zd 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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y)	TestCOSMOz&Unit tests for COSMO solver interface.Nc                    t        j                  d      | _        t        j                  d      | _        t        j                  d      | _        t        j                  dd      | _        t        j                  dd      | _        t        j                  dd	      | _        t        j                  d
d      | _        t        j                  d
d      | _	        t        j                  dd      | _
        y r   r"   r%   s    r'   r(   zTestCOSMO.setUp
  r)   r*   c                 J   t        j                  t        j                  t        j                  | j                  d      dz         | j                  dk(  g      }|j                  t         j                  d       | j                  |j                  d       | j                  | j                  j                  ddg       |j                  t         j                  dd       | j                  |j                  d       | j                  | j                  j                  ddg       y)	z$Test that COSMO solver options work.r-   r.   r   T)r0   r8   r,   )r0   eps_absr8   N)
r#   r:   r;   r<   r   r>   r  r?   r@   rA   r  s     r'   test_cosmo_optionszTestCOSMO.test_cosmo_options
  s     zz"++bggdffa&83&>?$&&A+O 	

"((D
1tzz3/##DFFLL1a&9 	

"((D$
?tzz3/##DFFLL1a&9r*   c                 0    t        j                  d       y Nr  rH   rI   r%   s    r'   test_cosmo_lp_0zTestCOSMO.test_cosmo_lp_0
  r   r*   c                 0    t        j                  d       y r  rN   r%   s    r'   test_cosmo_lp_1zTestCOSMO.test_cosmo_lp_1
  r   r*   c                 0    t        j                  d       y r  rR   r%   s    r'   test_cosmo_lp_2zTestCOSMO.test_cosmo_lp_2
  r   r*   c                 0    t        j                  d       y r  rV   r%   s    r'   test_cosmo_lp_3zTestCOSMO.test_cosmo_lp_3
  r   r*   c                 0    t        j                  d       y r  rZ   r%   s    r'   test_cosmo_lp_4zTestCOSMO.test_cosmo_lp_4
  r   r*   c                 0    t        j                  d       y r  r^   r%   s    r'   test_cosmo_lp_5zTestCOSMO.test_cosmo_lp_5
  r   r*   c                 0    t        j                  d       y r  r  r%   s    r'   test_cosmo_qp_0zTestCOSMO.test_cosmo_qp_0
  r   r*   c                 0    t        j                  d       y r  rb   r%   s    r'   test_cosmo_socp_0zTestCOSMO.test_cosmo_socp_0
  r  r*   c                 0    t        j                  d       y r  rg   r%   s    r'   test_cosmo_socp_1zTestCOSMO.test_cosmo_socp_1
  r  r*   c                 0    t        j                  d       y r  rk   r%   s    r'   test_cosmo_socp_2zTestCOSMO.test_cosmo_socp_2
  r  r*   c                 \    t        j                  d       t        j                  d       y r  ro   r%   s    r'   test_cosmo_socp_3zTestCOSMO.test_cosmo_socp_3   r  r*   c                 0    t        j                  d       y r  ru   r%   s    r'   test_cosmo_expcone_1zTestCOSMO.test_cosmo_expcone_1  r"  r*   c                 0    t        j                  d       y r  rz   r%   s    r'   test_cosmo_exp_soc_1zTestCOSMO.test_cosmo_exp_soc_1	  r%  r*   c                 0    t        j                  d       y r  rD  r%   s    r'   test_cosmo_pcp_1zTestCOSMO.test_cosmo_pcp_1  r  r*   c                 0    t        j                  d       y r  rI  r%   s    r'   test_cosmo_pcp_2zTestCOSMO.test_cosmo_pcp_2  r  r*   c                 0    t        j                  d       y r  rM  r%   s    r'   test_cosmo_pcp_3zTestCOSMO.test_cosmo_pcp_3  r  r*   c                 0    t        j                  d       y r  r3  r%   s    r'   test_cosmo_sdp_1minzTestCOSMO.test_cosmo_sdp_1min  rO  r*   c                     d}t        j                         }|j                  d       |j                  |       |j	                  |       |j                  |       |j                  |       |j                  |       y )Nr   r  rH   )r  r  r>   r  r  r|  r  r  r  s      r'   test_cosmo_sdp_2zTestCOSMO.test_cosmo_sdp_2  sf    jjl			!V$$$V,  (!!&)v&r*   c                    t        j                  d      }t        j                  t        j                  t        j                  |                  }t        j
                  |t        j                  |      dk(  g      }|j                  t         j                        }|j                  j                  }|j                  t         j                  d      }|j                  j                  }| j                  ||d       t        ||kD         yr   )r#   r$   r;   r   r   r:   r>   r  r   r   r?   r   r   s           r'   r   zTestCOSMO.test_warm_start"  s     KKOkk"&&+,zz#q	Q/0288,  ++**BHH*>!!,,wq9dUlr*   r~   )r   r   r   rP  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  
  sn    0/:222222266698<4447'r*   r  c                      dt         vry	 ddl} | j                         }|y| j                  |       y# t        $ r Y yw xY w)z8Check if KNITRO is installed and a license is available.KNITROFr   NT)r   knitroKN_newKN_freer  )r  kcs     r'   is_knitro_availabler  /  sJ    ((	]]_:r s   4 4 	A A z4KNITRO is not installed or license is not available.c                      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"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"dZd"dZd"dZd"dZd"dZ d"d Z!d"d!Z"y)#
TestKNITRONc                 L    t        j                  t        j                         y ro  )r   rJ   r#   r  r%   s    r'   test_knitro_lp_0zTestKNITRO.test_knitro_lp_0A  r  r*   c                 L    t        j                  t        j                         y ro  )r   rO   r#   r  r%   s    r'   test_knitro_lp_1zTestKNITRO.test_knitro_lp_1D  r  r*   c                 L    t        j                  t        j                         y ro  )r   rS   r#   r  r%   s    r'   test_knitro_lp_2zTestKNITRO.test_knitro_lp_2G  r  r*   c                 L    t        j                  t        j                         y ro  )r   rW   r#   r  r%   s    r'   test_knitro_lp_3zTestKNITRO.test_knitro_lp_3J  r  r*   c                 L    t        j                  t        j                         y ro  )r   r[   r#   r  r%   s    r'   test_knitro_lp_4zTestKNITRO.test_knitro_lp_4M  r  r*   c                 L    t        j                  t        j                         y ro  )r   r_   r#   r  r%   s    r'   test_knitro_lp_5zTestKNITRO.test_knitro_lp_5P  r  r*   c                 L    t        j                  t        j                         y ro  )r   r^  r#   r  r%   s    r'   test_knitro_lp_6zTestKNITRO.test_knitro_lp_6S  r  r*   c                 L    t        j                  t        j                         y ro  )r   r  r#   r  r%   s    r'   test_knitro_lp_bound_attrz$TestKNITRO.test_knitro_lp_bound_attrV  s    **"))<r*   c                 L    t        j                  t        j                         y ro  )r   rc   r#   r  r%   s    r'   test_knitro_socp_0zTestKNITRO.test_knitro_socp_0Y      %%RYY7r*   c                 L    t        j                  t        j                         y ro  )r   rh   r#   r  r%   s    r'   test_knitro_socp_1zTestKNITRO.test_knitro_socp_1\  r)  r*   c                 L    t        j                  t        j                         y ro  )r   rl   r#   r  r%   s    r'   test_knitro_socp_2zTestKNITRO.test_knitro_socp_2_  r)  r*   c                     t        j                  t        j                         t        j                  t        j                         y ro  )r   rp   r#   r  rq   r%   s    r'   test_knitro_socp_3zTestKNITRO.test_knitro_socp_3b  s&    ((		:((		:r*   c                 L    t        j                  t        j                         y ro  )r   r|  r#   r  r%   s    r'   test_knitro_socp_bounds_attrz'TestKNITRO.test_knitro_socp_bounds_attrh  s    //ryyAr*   c                 L    t        j                  t        j                         y ro  )r   r/  r#   r  r%   s    r'   test_knitro_mi_lp_0zTestKNITRO.test_knitro_mi_lp_0k      $$BII6r*   c                 L    t        j                  t        j                         y ro  )r   r4  r#   r  r%   s    r'   test_knitro_mi_lp_1zTestKNITRO.test_knitro_mi_lp_1n  r4  r*   c                 L    t        j                  t        j                         y ro  )r   r8  r#   r  r%   s    r'   test_knitro_mi_lp_2zTestKNITRO.test_knitro_mi_lp_2q  r4  r*   c                 L    t        j                  t        j                         y ro  )r   r<  r#   r  r%   s    r'   test_knitro_mi_lp_3zTestKNITRO.test_knitro_mi_lp_3t  r4  r*   c                 L    t        j                  t        j                         y ro  )r   r@  r#   r  r%   s    r'   test_knitro_mi_lp_5zTestKNITRO.test_knitro_mi_lp_5w  r4  r*   c                 L    t        j                  t        j                         y ro  )r   rD  r#   r  r%   s    r'   test_knitro_mi_socp_1z TestKNITRO.test_knitro_mi_socp_1z      ((		:r*   c                 L    t        j                  t        j                         y ro  )r   rI  r#   r  r%   s    r'   test_knitro_mi_socp_2z TestKNITRO.test_knitro_mi_socp_2}  r?  r*   c                 L    t        j                  t        j                         y ro  )r
   r  r#   r  r%   s    r'   test_knitro_qp_0zTestKNITRO.test_knitro_qp_0  r  r*   c                 L    t        j                  t        j                         y ro  )r   rv   r#   r  r%   s    r'   test_knitro_expcone_1z TestKNITRO.test_knitro_expcone_1  s    ''ryy9r*   c                 L    t        j                  t        j                         y ro  )r	   rE  r#   r  r%   s    r'   test_knitro_pcp_1zTestKNITRO.test_knitro_pcp_1      ##2995r*   c                 L    t        j                  t        j                         y ro  )r	   rJ  r#   r  r%   s    r'   test_knitro_pcp_2zTestKNITRO.test_knitro_pcp_2  rH  r*   c                 L    t        j                  t        j                         y ro  )r	   rN  r#   r  r%   s    r'   test_knitro_pcp_3zTestKNITRO.test_knitro_pcp_3  rH  r*   c                 L    t        j                  t        j                         y ro  )r	   rM  r#   r  r%   s    r'   test_knitro_mi_pcp_0zTestKNITRO.test_knitro_mi_pcp_0      &&bii8r*   c                 L    t        j                  t        j                         y ro  )r   r4  r#   r  r%   s    r'   test_knitro_sdp_1minzTestKNITRO.test_knitro_sdp_1min  rO  r*   c                 L    t        j                  t        j                         y ro  )r   r  r#   r  r%   s    r'   test_knitro_sdp_1maxzTestKNITRO.test_knitro_sdp_1max  rO  r*   c                 L    t        j                  t        j                         y ro  )r   r9  r#   r  r%   s    r'   test_knitro_sdp_2zTestKNITRO.test_knitro_sdp_2  rH  r*   c                 L    t        j                  t        j                         y ro  )r   r{   r#   r  r%   s    r'   test_knitro_exp_soc_1z TestKNITRO.test_knitro_exp_soc_1      ++299=r*   c                 L    t        j                  t        j                         y ro  )r   rA  r#   r  r%   s    r'   test_knitro_sdp_pcp_1z TestKNITRO.test_knitro_sdp_pcp_1  rX  r*   c                 .   d}d}t         j                  j                  d       t         j                  j                  ||      }t         j                  j                  |      }|j	                  |      }t        j                  |      }t        j                  t        j                  |            }||z  |k(  g}t        j                  ||      }	| j                  t              5  ddi}
 |	j                  ddt
        j                  i|
 d d d        | j                  t              5  ddi}
 |	j                  ddt
        j                  i|
 d d d        ddi}
 |	j                  ddt
        j                  i|
 y # 1 sw Y   txY w# 1 sw Y   <xY w)	Nr   r   r   r   invalidr0   	algorithmr   )r   r   r   ra  r   r#   r$   r;   r^  r:   r_  r  r>   r  )r&   r   rf  r   r   r   r   r   r   r   r+  s              r'   test_knitro_paramszTestKNITRO.test_knitro_params  sI   
		qIIOOAq!IIOOAEE!H KKNKK,	1uzl**Y4y) 	4#DGMM33d3	4 y) 	4+DGMM33d3	4 Q/RYY/$/	4 	4	4 	4s   %'E?)'F?FFr~   )#r   r   r   r  r  r  r  r   r"  r$  r&  r(  r+  r-  r/  r1  r3  r6  r8  r:  r<  r>  rA  rC  rE  rG  rJ  rL  rN  rQ  rS  rU  rW  rZ  r^  r   r*   r'   r  r  >  s    4444444=888;B77777;;4:6669996>>0r*   r  CUOPTzCUOPT is not installed.c                       e Zd ZddlZej                  j                  dd      ej                  j                  d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dZy)	TestCUOPTr   NCUOPT_PDLP_SOLVER_MODEStable2CUOPT_SOLVER_METHOD)pdlp_solver_modesolver_methodc                 R    t        j                  dddddt        j                   y Nr_  Tr   r0   r  r   r   )r   rJ   ra  kwargsr%   s    r'   test_cuopt_lp_0zTestCUOPT.test_cuopt_lp_0  "    !![Q[)JZJZ[r*   c                 R    t        j                  dddddt        j                   y rh  )r   rO   ra  rj  r%   s    r'   test_cuopt_lp_1zTestCUOPT.test_cuopt_lp_1  rl  r*   c                 R    t        j                  dddddt        j                   y rh  )r   rS   ra  rj  r%   s    r'   test_cuopt_lp_2zTestCUOPT.test_cuopt_lp_2  rl  r*   c                 R    t        j                  dddddt        j                   y rh  )r   rW   ra  rj  r%   s    r'   test_cuopt_lp_3zTestCUOPT.test_cuopt_lp_3  rl  r*   c                     	 t        j                  dddddt        j                   y # t        $ r}dt        |      v sJ Y d }~y d }~ww xY w)Nr_  Tr   ri  zcrossing boundsr   )r   r[   ra  rj  r  r  r&   r   s     r'   test_cuopt_lp_4zTestCUOPT.test_cuopt_lp_4  sI    	/%%_WD_iN^N^_ 	/$A...	/s   '* 	AAAc                 R    t        j                  dddddt        j                   y rh  r   r_   ra  rj  r%   s    r'   test_cuopt_lp_5zTestCUOPT.test_cuopt_lp_5  rl  r*   c                 R    t        j                  dddddt        j                   y rh  rw  r%   s    r'   test_cuopt_lp_6zTestCUOPT.test_cuopt_lp_6  rl  r*   c                 R    t        j                  dddddt        j                   y rh  rw  r%   s    r'   test_cuopt_lp_7zTestCUOPT.test_cuopt_lp_7  rl  r*   c                 N    t        j                  dddit        j                   y Nr0   r_  r   )r   r/  ra  rj  r%   s    r'   test_cuopt_mi_lp_0zTestCUOPT.test_cuopt_mi_lp_0      $$HGHy7G7GHr*   c                 N    t        j                  dddit        j                   y r~  )r   r4  ra  rj  r%   s    r'   test_cuopt_mi_lp_1zTestCUOPT.test_cuopt_mi_lp_1  r  r*   c                 N    t        j                  dddit        j                   y r~  )r   r8  ra  rj  r%   s    r'   test_cuopt_mi_lp_2zTestCUOPT.test_cuopt_mi_lp_2  r  r*   c                     dt         j                  d<   	 t        j                  dddit         j                   t         j                  d= y # t         j                  d= w xY w)Nr   r?  r0   r_  r   )ra  rj  r   r<  r%   s    r'   test_cuopt_mi_lp_3zTestCUOPT.test_cuopt_mi_lp_3  sP    )*	&	/((LL9;K;KL  .	  .s   %A Ac                     	 t        j                  dddit        j                   y # t        $ r}dt        |      v sJ Y d }~y d }~ww xY w)Nr0   r_  z/there are not enough constraints in the problemr   )r   rm  ra  rj  r  r  rt  s     r'   test_cuopt_mi_lp_4zTestCUOPT.test_cuopt_mi_lp_4  sH    	O((LL9;K;KL 	ODANNN	Os   %( 	A
AA
c                 V    t        j                  dddit        j                  ddi y Nr0   r_  r?  r   r   r   r@  ra  rj  r%   s    r'   test_cuopt_mi_lp_5zTestCUOPT.test_cuopt_mi_lp_5  $    $$VGVy7G7GVTUVr*   c                 V    t        j                  dddit        j                  ddi y r  r  r%   s    r'   test_cuopt_mi_lp_7zTestCUOPT.test_cuopt_mi_lp_7  r  r*   r~   )r   r   r   osenvirongetrj  rk  rn  rp  rr  ru  rx  rz  r|  r  r  r  r  r  r  r  r   r*   r'   ra  ra    s      "

/G SZZ^^,A1EF\\\\/\\\III/OWWr*   ra  r~   )BrP  r   r1  r  r/  r   rd  scipy.linalgr  r   scipy.statsstatsr  cvxpyr#   cvxpy.tests.solver_test_helperstestssolver_test_helpersr  rN  r   r   cvxpy.tests.base_testr   r   r   r   r	   r
   r   r   cvxpy.utilities.versioningr   r  r   r   rU  r  r  r  TestCaser  r  r  r  rB  rC  r  rN  r  r  r  r  r+  r  r  r  r)  rI  rV  r  r  r  r  r  ra  r   r*   r'   <module>r     s     	       . . +   / V002JKD;x D; LD;Np=h p=f	 Z#446RSw'8 w' Tw'r \%668TUh;X h; Vh;T X!224NOh7 h7 Ph7V ')+`aON!! ON bONd X!224NOZ5 Z5 PZ5z V002JK/3x /3 L/3d	 E!22;RSn? n? Tn?b V002JK;+x   ;+ L;+| V002JK45x   45 L45n V002JK=5x   =5 L=5~ V002JK8x 8 L8@ W 113LMs9 s9 Ns9l X!224NOR: R: PR:j X!224NOp: p: Pp:f U//1HI<"h <" J<"~ V002JKt(x   t( Lt(r G#44=VWX> X> XX>x59X 59p V002MNI;(## I; OI;XDO!! DOL V002JKY4x   Y4 LY4x W 113LMj j NjX (*,bcy0 y0 dy0v W 113LM@W!! @W N@Wr*   