
    bi                     J    d Z ddlZddlZddlZddlmZ d Zd Z	d Z
d Zd Zy)	a+  
Copyright, the CVXPY authors

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)Equalityc                  P   t        j                         } t        j                  |       }t        j                  |       }| j                  |j                  k(  sJ | j                  |j                  k7  sJ t	        |       t	        |      k(  sJ t	        |       t	        |      k7  sJ y )NcpVariablecopydeepcopyid)abcs      P/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/tests/test_copy.py	test_leafr      sx    
A		!AaA44144<<44144<<a5BqE>>a5BqE>>    c                     t        j                         } t        | d      }t        j                  |      }t        j                  |      }|j
                  |j
                  k(  sJ |j
                  |j
                  k7  sJ t        |      t        |      k7  sJ t        |      t        |      k7  sJ t        |      t        |      k7  sJ y )Nr   )r   r   r   r   r	   r
   xr   r   r   s       r   test_constraintr   %   s    
AAA		!AaA44144<<44144<<a5BqE>>a5BqE>>a5BqE>>r   c                     t        j                         } | dz   }t        j                  |      }t        j                  |      }|j                  |j                  k7  sJ |j                  |j                  k7  sJ t	        |      t	        |      k7  sJ t	        |      t	        |      k7  sJ t	        |      t	        |      k7  sJ y )N   r   r   s       r   test_expressionr   4   s    
A	AA		!AaA44144<<44144<<a5BqE>>a5BqE>>a5BqE>>r   c                     t        j                         } t        j                         }t        j                  | |z   dz        }| |z   dk(  g}t        j                  ||      }t	        j                  |      }t	        j
                  |      }t        |      t        |      k7  sJ t        |      t        |      k7  sJ t        |      t        |      k7  sJ |j                          |j                  t         j                  k(  sJ |j                          |j                  t         j                  k(  sJ |j                          |j                  t         j                  k(  sJ y )N   r   )
r   r   MinimizeProblemr   r	   r
   solvestatusOPTIMAL)r   yobjconstraintsprob	prob_copyprob_deepcopys          r   test_problemr%   C   s   
A
A
++q1ul
#Cq5A:,K::c;'D		$IMM$'Md8r)}$$$d8r-((((i=B}----JJL;;"**$$$OOrzz)))2::---r   c                  8   t        j                  dd      } t        j                  dd      }| |z   dk(  g}t        j                  |      }t        j                  | d|z  z         }t        j                  ||      }|j                          |j                  t         j                  k(  sJ t        j                  | j                  d      sJ t        j                  |j                  d      sJ t        j                  |      }t        j                  ||      }|j                          |j                  t         j                  k(  sJ |d   j                         d   }|d   j                         d   }t        j                  |d|z  z         }	t        j                  |	|      }|j                          |j                  t         j                  k(  sJ t        j                  |j                  d      sJ t        j                  |j                  d      sJ y )Nr   T)namenonnegr   r   r   r   )r   r   r   Maximizer   r   r   r   npallclosevaluer	   	UNBOUNDED	variables)
r   r   original_constraintsshallow_constraintsr    r"   deep_constraintsx_copiedy_copieddeep_objs
             r   test_constraints_in_problemr5   Z   s   
T*A
T*A 	
A
 ))$89
++q1q5y
"C::c./DJJL;;"**$$$;;qww""";;qww"""}}%9:::c+,DJJL;;",,&&&",,.q1H",,.q1H{{Hq8|35H::h 01DJJL;;"**$$$;;x~~q)));;x~~q)))r   )__doc__r   numpyr*   cvxpyr   cvxpy.constraintsr   r   r   r   r%   r5    r   r   <module>r;      s1        &	.. *r   