
    bi                     V    d Z ddlmZmZmZmZmZmZ ddlm	Z	 ddl
mZ  G d de	      Zy)a/  
Copyright 2017 Robin Verschueren

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.
    )absmaxmaximumnorm1norm_infsum_largest)Canonicalization)CANON_METHODSc                   <     e Zd ZdZdd fdZdefdZ fdZ xZS )EliminatePwlz"Eliminates piecewise linear atoms.returnc                 8    t         t        |   |t               y )N)problemcanon_methods)superr   __init__elim_pwl_methodsselfr   	__class__s     g/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/reductions/eliminate_pwl/eliminate_pwl.pyr   zEliminatePwl.__init__   s    lD*)9 	+ 	;    c                     |j                         D cg c]  }t        |       }}t        t        t        t
        t        t        gt        fd|D              S c c}w )Nc              3   &   K   | ]  }|v  
 y wN ).0atom	pwl_typess     r   	<genexpr>z'EliminatePwl.accepts.<locals>.<genexpr>    s     <49$<s   )	atomstyper   r   r   r   r   r   any)r   r   r   
atom_typesr   s       @r   acceptszEliminatePwl.accepts   sH    -4]]_=Td4j=
=';UHE	<<<< >s   Ac                 b    | j                  |      st        d      t        t        |   |      S )NzCannot canonicalize pwl atoms.)r%   
ValueErrorr   r   applyr   s     r   r(   zEliminatePwl.apply"   s-    ||G$=>>\4.w77r   r   )r   N)	__name__
__module____qualname____doc__r   boolr%   r(   __classcell__)r   s   @r   r   r      s!    ,;=$ =
8 8r   r   N)r,   cvxpy.atomsr   r   r   r   r   r   !cvxpy.reductions.canonicalizationr	   -cvxpy.reductions.eliminate_pwl.canonicalizersr
   r   r   r   r   r   <module>r2      s&     H G > [8# 8r   