
    bi\                     v    d Z ddlZddlZddlZddlmZ ddl	m
Z
mZ ddlmZ ddlmZ ddlmZ  G d d	e      Zy)
a,  
Copyright 2013 Steven Diamond

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)reshape)	PowCone3D	PowConeND)SOC)Variable)BaseTestc                       e Zd Z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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)TestConstraintsz2 Unit tests for the expression/expression module. Nc                     t        d      | _        t        d      | _        t        dd      | _        t        dd      | _        t        dd      | _        t        d	d
      | _        t        d	d      | _        t        dd      | _        y )Na)nameb   x   yzr   r   AB)r   r   C)	r   r   r   r   r   r   r   r   r   selfs    W/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/tests/test_constraints.pysetUpzTestConstraints.setUp   sn    s#s#!#&!#&!#&&s+&s+&s+    c                    t        j                  dd      }dgdgdgt        j                  dg      t        j                  dg      t        j                  dg      fD ]_  }| j	                  |      5  ||_        |dk\  }|j                         }t        j                  dg      }t        j                  j                  ||d       d|z
  dk  }|j                         }t        j                  dg      }t        j                  j                  ||d       |dk  }|j                         }t        j                  d	g      }t        j                  j                  ||d       d|z
  dk\  }|j                         }t        j                  dg      }t        j                  j                  ||d       d d d        b y # 1 sw Y   nxY w)
N   T)booleang      ?valueg333333?g        )strictg?)	cpr   nparraysubTestr!   	violationtestingassert_array_equal)r   r   r!   
constraintactualexpecteds         r   test_boolean_violationz&TestConstraints.test_boolean_violation+   s   KK4(cC54&"((A3-3%"((TXSYJZ[ 	MEE* M#X
#--/88SE?

--fht-LUc\
#--/88SE?

--fht-L#X
#--/88SE?

--fht-LUc\
#--/88SE?

--fht-L+M M	MM Ms   5EGG	c                    | j                   | j                  k(  }| j                  |j                         d       | j                  |j                  d       |j
                  J | j                  t              5  |j                          ddd       | j                   j                  d       | j                  j                  d       |j                         sJ | j                   j                  d       |j                         rJ t        j                  ddg      | j                   _        t        j                  ddg      | j                  _        |j                         rJ | j                  |j                         ddg       | j                  |j                  ddg       t        j                  ddg      | j                  _        |j                         sJ | j                  |j                         ddg       | j                  |j                  ddg       | j                  t              5  | j                   | j                  k(   ddd       |j!                         }| j#                  t%        |      t%        |      u        | j                  |j&                  |j&                         | j)                  |j&                  |j&                  u        |j!                  | j*                  | j,                  g      }| j#                  t%        |      t%        |      u        | j#                  |j&                  d   | j*                  u        y# 1 sw Y   xY w# 1 sw Y   xY w)	z!Test the Equality class.
        zx == zr   Nr   r   r   r   args)r   r   assertEqualr   shape
dual_valueassertRaises
ValueErrorr!   
save_valuer$   r%   assertItemsAlmostEqualr'   residualr   copy
assertTruetyper1   assertFalser   r   r   constrr:   s      r   test_equalityzTestConstraints.test_equalityF   s    466!1t,  (((z* 	LLN	!!||~~!<<>!!xxA'xxA'<<>!!##F$4$4$6A?##FOOaV<xxA'||~~##F$4$4$6A?##FOOaV< z* 	VVtvv	 {{}T
d6l23 	FKK0fkk12{{ 0{1T
d6l23		!./C	 	(	 	   9M2MMM%c                    | j                   | j                  k  }| j                  |j                         d       | j                  |j                  d       |j
                  J | j                  t              5  |j                          ddd       | j                   j                  d       | j                  j                  d       |j                         sJ | j                   j                  d       |j                         rJ t        j                  ddg      | j                   _        t        j                  ddg      | j                  _        |j                         rJ | j                  |j                         ddg       | j                  |j                  ddg       t        j                  ddg      | j                  _        |j                         sJ | j                  |j                         ddg       | j                  |j                  ddg       | j                  t              5  | j                   | j                   k   ddd       |j#                         }| j%                  t'        |      t'        |      u        | j                  |j(                  |j(                         | j+                  |j(                  |j(                  u        |j#                  | j,                  | j.                  g      }| j%                  t'        |      t'        |      u        | j%                  |j(                  d   | j,                  u        y# 1 sw Y   xY w# 1 sw Y   xY w)	z#Test the Inequality class.
        x <= zr/   Nr   r   r   r   r0   )r   r   r2   r   r3   r4   r5   r6   r!   r7   r$   r%   r8   r'   r9   	Exceptionr   r:   r;   r<   r1   r=   r   r   r>   s      r   test_inequalityzTestConstraints.test_inequalityq   s    466!1t,  (((z* 	LLN	!!||~~!<<>!! xxA'xxA'<<>!!##F$4$4$6A?##FOOaV<xxA'||~~##F$4$4$6A?##FOOaV< y) 	VVtvv	 {{}T
d6l23 	FKK0fkk12{{ 0{1T
d6l23		!./E	 	*	 	rA   c                 J   | j                   | j                  z	  }| j                  |j                         d       | j                  |j                  d       |j
                  J | j                  t              5  |j                          ddd       | j                   j                  t        j                  ddgddgg             | j                  j                  t        j                  ddgddgg             |j                         sJ | j                  |j                         d       | j                  |j                  d       | j                  j                  t        j                  ddgddgg             |j                         rJ | j                  |j                         d       | j                  |j                  d       | j                  t              5 }| j                   dz	   ddd       | j                  t#        j$                        d	       |j'                         }| j)                  t+        |      t+        |      u        | j                  |j,                  |j,                         | j/                  |j,                  |j,                  u        |j'                  | j                  g
      }| j)                  t+        |      t+        |      u        | j)                  |j,                  d   | j                  u        y# 1 sw Y   xY w# 1 sw Y   +xY w)$Test the PSD constraint <<.
        zA + -B >> 0r   Nr   r   r   r   2Non-square matrix in positive definite constraint.r0   )r   r   r2   r   r3   r4   r5   r6   r!   r7   r$   r%   assertAlmostEqualr'   r9   rD   r   str	exceptionr:   r;   r<   r1   r=   )r   r?   cmr:   s       r   test_psd_constraintz#TestConstraints.test_psd_constraint   s^    466!6v.  (((z* 	LLN	"((QGaV#456"((QFQF#345||~~v//115v2"((QFQF#345<<>!!v//115v2y) 	RVVq[	R\\*,`a {{}T
d6l23 	FKK0fkk12{{{)T
d6l23		!./7	 		 	s   9LLLL"c                 |   | j                   | j                  z  }| j                  |j                         d       | j                  |j                  d       |j
                  J | j                  t              5  |j                          ddd       | j                  j                  t        j                  ddgddgg             | j                   j                  t        j                  ddgddgg             |j                         sJ | j                   j                  t        j                  ddgddgg             |j                         rJ | j                  t              5 }| j                  dz   ddd       | j                  t        j                        d	       y# 1 sw Y   xY w# 1 sw Y   <xY w)
rG   zB + -A >> 0r   Nr   rH   r   r   r   rI   )r   r   r2   r   r3   r4   r5   r6   r!   r7   r$   r%   rD   r   rK   rL   )r   r?   rM   s      r   test_nsd_constraintz#TestConstraints.test_nsd_constraint   s`    466!6v.  (((z* 	LLN	"((QGaV#456"((QFQF#345||~~"((QFQF#345<<>!!y) 	RFFaK	R\\*M	O	 		 	s   9F%'F2%F/2F;c                 4   | j                   | j                  k\  }| j                  |j                         d       | j                  |j                  d       | j                  t              5  | j                  | j                  k\   ddd       y# 1 sw Y   yxY w)zTest the >= operator.
        rC   r/   N)r   r   r2   r   r3   r5   r6   r   )r   r?   s     r   test_geqzTestConstraints.test_geq   su     466!1t, z* 	VVtvv	 	 	s   +BBc                    | j                   | j                  z   }| j                  | j                  z   }t	        ||      }| j                  |j                  d       d}| j                  t              5 }t	        t        d      t        d             d d d        | j                  t        j                        |       d}t        j                  |      }d}t        j                  ||      }	t        j                  |      }
t	        |
|	      j                  }|j                   dk(  sJ t        j"                  |	|z
        t        j$                  |
|z
        z   }t        j&                  t        j(                  |      t	        |
|	      g      }|j+                          | j-                  t        j.                  |j0                        |       d}d}t        j                  ||z        j3                  ||f      }t        j4                  g d	      }t        j                  ||f|      }	t        j                  ||      }
t	        |
|	d
      j                  }|j6                  |fk(  sJ t9        |      D ]  }t        j"                  |	d d |f   |d d |f   z
        t        j"                  |
|   ||   z
        z   }t        j&                  t        j(                  |      t	        |
|   |	d d |f         g      }|j+                          | j-                  t        j.                  |j0                        ||           d}d}t        j                  ||z        j3                  ||f      }t        j4                  g d	      }t        j                  ||f|      }	t        j                  ||      }
t	        |
|	d
      j                  }|j6                  |fk(  sJ t9        |      D ]  }t        j"                  |	|d d f   ||d d f   z
        t        j"                  |
|   ||   z
        z   }t        j&                  t        j(                  |      t	        |
|   |	|d d f         g      }|j+                          | j-                  t        j.                  |j0                        ||           d\  }}t        j:                  ||f      }t        j<                  j?                  |d      }t        j4                  g d      |z  }t        j                  ||f|      }	t        j                  ||      }
t	        |
|	d
      j                  }|j6                  |fk(  sJ t9        |      D ]  }t        j"                  |	|d d f   ||d d f   z
        t        j"                  |
|   ||   z
        z   }t        j&                  t        j(                  |      t	        |
|   |	|d d f         g      }|j+                          | j-                  t        j.                  |j0                        ||   d        y # 1 sw Y   xY w)Nr   zCArgument dimensions (1,) and (1, 4), with axis=0, are incompatible.r   )r         r   r    r   r   r   r   axisr   r   )ord)r         ?rT   )places) r   r   r   r   r   r2   sizer5   rD   r   rK   rL   r$   aranger#   r9   ndimsum_squaressquareProblemMinimizesolverJ   sqrtr!   r   r%   r3   rangeoneslinalgnorm)r   exp
scalar_expr?   	error_strrM   nx0t0r   tresiddistprobkinormss                    r   test_soc_constraintz#TestConstraints.test_soc_constraint   s   fftvvoVVdff_
Z%a()	y) 	/RXf-.	/R\\*I6 YYq\KK$KKb!Aq	""zzQ~~a"f%		!b&(99zz"++d+c!Qi[9

rwwtzz2E: YYq1u%%q!f-XXi KKAb)KK$Aqq!**{{qd"""q 	BA>>!AqD'Bq!tH"45qtbQRe|8TTD::bkk$/#adAadG2D1EFDJJL""2774::#6aA		B YYq1u%%q!f-XXi KKAb)KK$Aqq!**{{qd"""q 	BA>>!AqD'Bq!tH"45qtbQRe|8TTD::bkk$/#adAadG2D1EFDJJL""2774::#6aA		B 1WWaV_		rq)XXl#e+KKAb)KK$Aqq!**{{qd"""q 	LA>>!AqD'Bq!tH"45qtbQRe|8TTD::bkk$/#adAadG2D1EFDJJL""2774::#6a"K		L{	/ 	/s   2X>>Yc                 P   d}t         j                  j                  d       d}t        |      t        |      t        |      }}}t	        ||||      }dt         j                  j                  |      z   dt         j                  j                  |      z   }}||z  |d|z
  z  z  }	|	dxx   dz  cc<   |||	c|_        |_        |_        |j                  }
| j                  |
d       |j                         }|dxx   dz  cc<   ||_        |j                  }
| j                  |
d	t        |d         z         | j                  t              5  t	        |||d
      }d d d        | j                  t              5  t	        |||d      }d d d        y # 1 sw Y   6xY w# 1 sw Y   y xY w)Nr   r   g?皙?r   rH   gHz>ggGz?gjt?gh㈵)r$   randomseedr   r   randr!   r9   assertLessEqualr:   assertGreaterEqualabsr5   r6   )r   rn   alphar   r   r   conro   y0z0violx1s               r   test_pow3d_constraintz%TestConstraints.test_pow3d_constraint/  ss   
		q1+x{HQKa11a'ryy~~a((#		q0A*ABYag&
1$&B!!'||T4(WWY
1||d3r!u:o6z* 	,Aq!U+C	,z* 	/Aq!X.C	/ 	/	, 	,	/ 	/s   F8FFF%c                    t        j                  d      }t        j                  d      }t        j                  |d   |d   |d   d      |dk  g}t        j                  t        j                  ||z
              }t        j
                  ||      }|j                          | j                  |j                  d       y	)
z_
        Simple test case with scalar AND vector `alpha`
        inputs to `PowCone3D`
        r   )r3   r   r   r   g      ?ig5R1@N)	r#   r   r   rd   rj   rc   re   rJ   r!   )r   x_0r   consobjrt   s         r   "test_pow3d_scalar_alpha_constraintz2TestConstraints.test_pow3d_scalar_alpha_constraintH  s    
 kk%KKd#SVSVSVT:Skk"''!c'*+zz#t$

tzz+=>r   c           	         d}t        |      t               }}t        j                  j                  d       dt        j                  j	                  |      z   }|t        j
                  |      z  }| j                  t              5  t        |||dz         }d d d        | j                  t              5  t        |||j                  |df            }d d d        | j                  t              5  t        t        ||dfd      ||j                  |df      d      }d d d        t        |||      }d	t        j                  j	                  |      z   }t        j                  t        j                  ||            d
z   }||c|_        |_        |j                         }| j                  |d       | j!                  |d       y # 1 sw Y   1xY w# 1 sw Y   xY w# 1 sw Y   xY w)NrT   r   r[   g{Gz?r   F)orderrW   rz   g?gQ?)r   r$   r{   r|   r}   sumr5   r6   r   r   reshape_atomprodpowerr!   r'   r   r~   )	r   rn   Wr   r   r   W0r   r   s	            r   test_pownd_constraintz%TestConstraints.test_pownd_constraintV  s   {HJ1
		qbiinnQ''z* 	.Aq%*-C	. z* 	9Aq%--A"78C	9 z* 	$LQF#>!MM1a&1!"$C	$ 1e$299>>!$$WWRXXb%()$.r}}d+T4(%	. 	.	9 	9	$ 	$s$   G4G0/G GG G)c                    d}| j                  t              5 }| j                  | j                  cxk  xr dk  nc  ddd       | j	                  t        j                        |       | j                  t              5 }| j                  | j                  cxk(  xr dk(  nc  ddd       | j	                  t        |j                        |       | j                  t              5 }| j                  | j                  k  j                          ddd       | j	                  t        |j                        |       y# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   HxY w)z9Tests that chaining constraints raises an error.
        zXCannot evaluate the truth value of a constraint or chain constraints, e.g., 1 >= x >= 0.r   N)r5   rD   r   r   r2   rK   rL   __bool__)r   rm   rM   s      r   test_chained_constraintsz(TestConstraints.test_chained_constraintsp  s   =	y) 	$RVVtvv""	$R\\*I6y) 	$RVVtvv""	$R\\*I6y) 	*RVVtvv'')	*R\\*I6	$ 	$	$ 	$	* 	*s#   %D<?%E	&(E<E	EEc                    t        j                  d      }t        j                  d      }t        j                  t        j
                  t        j                  |            t        j                  ||z
        g      }|j                  t         j                         | j                  |j                  |       |j                  t         j                         | j                  |j                  |       y)z`Solve a trivial NonNeg-constrained problem through
        the conic and QP code paths.
        r   solverN)r#   r   r$   r_   rc   rd   r   NonNegre   CLARABELr8   r!   OSQPr   r   crt   s       r   test_nonnegzTestConstraints.test_nonneg  s     KKNIIaLzz"++bffQi099QU+,.

"++
&##AGGQ/

"''
"##AGGQ/r   c                    t        j                  d      }t        j                  d      }t        j                  t        j
                  t        j                  |            t        j                  ||z
        g      }|j                  t         j                         | j                  |j                  |       |j                  t         j                         | j                  |j                  |       y)zZTests the NonPos constraint for correctness with conic and
        QP code paths.
        r   r   N)r#   r   r$   r_   rc   Maximizer   NonPosre   r   r8   r!   r   r   s       r   test_nonposzTestConstraints.test_nonpos  s     KKNIIaLzz"++bffQi0299QU3C2DE

"++
&##AGGQ/

"''
"##AGGQ/r   c                    t        j                  d      }t        j                  d      }t        j                  t        j
                  |            }t        j                  |||z
  dk  g      }|j                  t         j                         |j                  d   j                  }t        j                  |t        j                  ||z
        g      }|j                  t         j                         | j                  |j                  d   j                  |       |j                  t         j                         | j                  |j                  d   j                  |       y )Nr   r   r   )r#   r   r$   r_   rd   r   rc   re   r   constraintsr4   r   r8   r   )r   r   r   	objectivert   duals         r   test_nonneg_dualz TestConstraints.test_nonneg_dual  s    KKNIIaLKKq	*	zz)a!eqj\2

"++
&"-- zz)biiA&6%78

"++
&##D$4$4Q$7$B$BDI

"''
"##D$4$4Q$7$B$BDIr   c                    t        j                  ddg      j                         sJ t        j                  ddg      j                         rJ t        j                  ddg      j                         rJ t        j                  ddg      j                         sJ t        j                  ddg      j                         sJ t        j                  ddg      j                         sJ y)zTest basic bound properties.r   Nboundsr   )r#   r   _has_lower_bounds_has_upper_boundsr   s    r   test_bound_propertiesz%TestConstraints.test_bound_properties  s    {{1d),>>@@@;;q$i0BBDDD;;tQi0BBDDD{{4),>>@@@{{1a&);;==={{1a&);;===r   c                 l   t        j                  d      }t        j                  t        j                  d            }||k(  }|j
                  dk(  sJ t        j                  t        j                  d      |g      }|j                  t         j                         t        j                  |j                  |j                        sJ t        j                  t        d      5  t        j                  t        j                  d      |g      }|j                  t         j                  t         j                         d	d	d	       t        j                  t        j                  t        j                   |            |g      }|j                  t         j"                         t        j                  |j                  |j                        sJ t        j                  t        d      5  t        j                  t        j                  t        j                   |            |g      }|j                  t         j"                  t         j                         d	d	d	       ||k\  }|j
                  dk(  sJ t        j                  t        j                  t        j$                  |            |g      }|j                  t         j                         t        j                  |j                  |j                        sJ t        j                  t        d      5  t        j                  t        j                  t        j$                  |            |g      }|j                  t         j                  t         j                         d	d	d	       y	# 1 sw Y   SxY w# 1 sw Y   GxY w# 1 sw Y   y	xY w)
z1Test interaction of constraints and broadcasting.)r   r   r   rY   r   r   zThe CPP backend cannot be usedmatch)r   canon_backendN)r#   r   Constantr$   rh   r3   rc   rd   re   r   allcloser!   pytestraisesr6   CPP_CANON_BACKENDra   r   r   )r   r   r   r   rt   s        r   test_broadcastingz!TestConstraints.test_broadcasting  sx   KKKK
#AvyyF"""zz"++a.3%0

"++
&{{177AGG,,,]]:-MN 	O::bkk!nse4DJJbkk9M9MJN	O
 zz"++bnnQ&783%@

"''
"{{177AGG,,,]]:-MN 	K::bkk"..*;<seDDJJbggR5I5IJJ	K
 AvyyF"""zz"++bffQi03%8

"++
&{{177AGG,,,]]:-MN 	O::bkk"&&)4se<DJJbkk9M9MJN	O 	O)	O 	O	K 	K	O 	Os'   %AN+A-NA-N*NN'*N3c           	         t        j                  g dg dg dg      }t        j                  dt        j                  g d      t        j                  g d      g      }t        j                  dd	d
g      }t        j                  dt        j                  ddg      dg      }t        j                  dd	t        j                  g d      g      }t        j                  d	d	g      }t        j                  g d      }t        j                  t        j
                  ||z              j                          | j                  |j                  g d       | j                  |j                  g d      g d       t        j                  t        d      5  g d|_        ddd       t        j                  |j                  |j                        }t        j                  t        j
                  ||z        |j                        j                          | j                  |j                  g d       t        j                  t        j
                  t        j                   ||      |j"                  |z  z               j                          | j                  |j                  g d       t        j                  t        j
                  ||z              j                          | j                  |j                  d	d	g       t        j                  t        j$                  ||z              j                          | j                  |j                  ddg       t        j                  t        j$                  ||z              j                          | j                  |j                  g d       t        j                  t        d      5  t        j                  dt        j                  g d      g       ddd       t        j                  t        d      5  t        j                  dt        j                  d	d
g      t        j                  g d      g       ddd       t        j                  t        d      5  t        j                  dt        j                  g d      dg       ddd       t        j                  dt         j&                   t        j                  d	d
g      g      }	t        j                  ddt         j&                  g      }
t        j                  dt         j&                   t         j&                  g      }t        j                  t        j$                  |	|z              j                          | j                  |	j                  d	d
g       | j                  |	j                  d
d	g      d	d	g       ddg|	_        t        j                  t        d      5  d
d	g|	_        ddd       t        j                  t        j
                  |
|z              j                          | j                  |
j                  g d       t        j                  t        j
                  ||z              j                          | j)                  |j                         dt         j&                   d	g}dt         j&                  d
g}t+        ||      D ]  \  }}t        j                  ||g      }t        j                  t        j
                  |            j                         }|t         j&                   }t        j,                  ||      sJ t        j                  t        j$                  |            j                         }|t         j&                  }t        j,                  ||      rJ  t        j                  t        d      5  t        j                  dt        j                  d
dg      t        j                  d	dg      g       ddd       t        j                  t        d      5  t        j                  ddt         j&                   g       ddd       t        j                  t        d      5  t        j                  dt         j&                   t        j                  d	t         j&                   g      g       ddd       t        j                  t        d      5  t        j                  dt        j                  d	t         j&                   g      t        j                  d
t         j&                   g      g       ddd       t        j                  t        d      5  t        j                  dt         j&                  t         j&                  g       ddd       t        j                  t        d      5  t        j                  dt        j                  d	t         j&                  g      t         j&                  g       ddd       t        j                  t        d      5  t        j                  dt        j                  d	t         j&                  g      t        j                  d
t         j&                  g      g       ddd       t        j                  t        d      5  t        j                  dt         j.                  t         j.                  g       ddd       t        j                  t        d      5  t        j                  dt         j.                  t        j                  d	t         j.                  g      g       ddd       t        j                  t        d      5  t        j                  dt        j                  d	t         j.                  g      t         j.                  g       ddd       t        j                  t        d      5  t        j                  dt        j                  d	t         j.                  g      t        j                  d
t         j.                  g      g       ddd       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# 1 sw Y   xY w# 1 sw Y   PxY w# 1 sw Y   xY w# 1 sw Y   uxY w# 1 sw Y   )xY w# 1 sw Y   xY w# 1 sw Y   RxY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   DxY w# 1 sw Y   yxY w) zVTest that the bounds attribute for variables and parameters is set correctly.
        )r   r   r   )r   r   r   )r   r   r   r   rV   )rT   rU      r   r/   r   r   rT   rU   r   )r   r   rT   )r   r   r   )r   r   r   z
in bounds.r   N)r3   var_idz%Bounds should be a list of two items.)r   r   r   z3with the same dimensions as the variable/parameter.)r   r   r   rT   r   r   )r   r   r   zKInvalid bounds: some upper bounds are less than corresponding lower bounds.z*-np.inf is not feasible as an upper bound.z(np.inf is not feasible as a lower bound.z/np.nan is not feasible as lower or upper bound.)r$   r%   r#   r   rc   rd   re   r8   r!   projectr   r   r6   r3   iddomain	quad_formTr   infassertIsNonezipisclosenan)r   Qx_1x_2x_3x_4c_1c_2r   x_5x_6x_7lower_boundsupper_boundsloweruppermin_zmax_zs                     r   test_bounds_attrz TestConstraints.test_bounds_attr  s	    HHiI67kk$(9288G;L'MNkk$!u-kk$!A';<kk$288G+<'=>hh!uohhw 	

2;;s3w'(..0##CIIy9##CKK	$:IF]]:\: 	"!CI	" KKcii7


2;;qu%szz288:##AGGY7 	

2;;r||C3ceeckABCIIK##CIIg6 	

2;;s3w'(..0##CII1v6 	

2;;s3w'(..0##CII1v6 	

2;;s3w'(..0##CIIy9 ]]:-TU 	<KKbhhy&9%:;	< ]]:-bc 	KKKbhh!uorxx7H%IJ	K]]:-bc 	?KKbhhy&91%=>	? kk$1Q%'ABkk$266{3kk$w&78


2;;s3w'(..0##CII1v6##CKKA$7!Q@F	]]:\: 	ACI	


2;;s3w'(..0##CIIw7 	

2;;sSy)*002#))$ rvvgq)bffa(l; 	,LE5E5>2AJJr{{1~.446E}::eU+++JJr{{1~.446E}::eU+++	, ]]: -_ ` 	IKKbhh!uorxx1%GH	I ]]:-YZ 	6KKdRVVG_5	6]]:-YZ 	GKKrvvgrxxBFF7/D%EF	G]]:-YZ 	WKKbhhBFF7|&<bhhBFF7|>T%UV	W ]]:-WX 	7KKbffbff%56	7]]:-WX 	EKKbhh"&&z&:BFF%CD	E]]:-WX 	UKKbhh266{&;RXXq"&&k=R%ST	U ]]:-^_ 	7KKbffbff%56	7]]:-^_ 	FKKbffbhh266{.C%DE	F]]:-^_ 	FKKbhh266{&;RVV%DE	F]]:-^_ 	UKKbhh266{&;RXXq"&&k=R%ST	U 	Uy	" 	"2	< 	<	K 	K	? 	?	 	2	I 	I	6 	6	G 	G	W 	W	7 	7	E 	E	U 	U	7 	7	F 	F	F 	F	U 	Us   
q8.r$Ar/r<
r,(Ar9)sAsA"s 6s-)As:A t6t3At!!At.A t;8rrrr),r69sss s*-s7:ttt!t+.t8;u)returnN)__name__
__module____qualname____doc__r   r-   r@   rE   rN   rP   rR   rx   r   r   r   r   r   r   r   r   r   r    r   r   r
   r
      sl    <
,M6)0V*0X#0JO*	JLX/2?)47"0
0J >!OLoUr   r
   )r   numpyr$   r   cvxpyr#   cvxpy.atoms.affine.reshaper   r   cvxpy.constraints.powerr   r   cvxpy.constraints.second_orderr   cvxpy.expressions.variabler   cvxpy.tests.base_testr   r
   r   r   r   <module>r      s4        > 8 . / *lUh lUr   