
    biQ                         d Z ddlmZmZmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddef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.
    )DCPErrorDGPErrorSolverError)Maximize)Chain)complex2real)CvxAttr2Constr)Dcp2Cone)Dgp2Dcp)FlipObjective)qp2symbolic_qp)Qp2SymbolicQp)build_non_disciplined_error_msggpc                 f   g }t        | j                               dk(  rt        |      S t        j                  |       r|t        j
                         gz  }|r|t               gz  }|sU| j                         sEt        | d      }| j                         r|dz  }n| j                         r|dz  }t        d|z         |rU| j                         sEt        | d      }| j                         r|dz  }n| j                         r|dz  }t        d	|z         t        | j                        t        k(  r|t!               gz  }|d
   r8t#        j                  |       r#|t%               t'               gz  }t        |      S |d   st)        d|z        |t+               t%               gz  }t        |      S )a  
    Builds a chain that rewrites a problem into an intermediate
    representation suitable for numeric reductions.

    Parameters
    ----------
    problem : Problem
        The problem for which to build a chain.
    candidates : dict
        Dictionary of candidate solvers divided in qp_solvers
        and conic_solvers.
    gp : bool
        If True, the problem is parsed as a Disciplined Geometric Program
        instead of as a Disciplined Convex Program.

    Returns
    -------
    Chain
        A Chain that can be used to convert the problem to an intermediate form.

    Raises
    ------
    DCPError
        Raised if the problem is not DCP and `gp` is False.
    DGPError
        Raised if the problem is not DGP and `gp` is True.
    r   )
reductionsDCPzU
However, the problem does follow DGP rules. Consider calling solve() with `gp=True`.zW
However, the problem does follow DQCP rules. Consider calling solve() with `qcp=True`.z1Problem does not follow DCP rules. Specifically:
DGPzV
However, the problem does follow DCP rules. Consider calling solve() with `gp=False`.z"Problem does not follow DGP rules.
qp_solversconic_solversz^Problem could not be reduced to a QP, and no conic solvers exist among candidate solvers (%s).)len	variablesr   r   acceptsComplex2Realr   is_dcpr   is_dgpis_dqcpr   r   type	objectiver   r   r   r	   r   r   r
   )problem
candidatesr   r   appends        f/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/reductions/solvers/intermediate_chain.pyconstruct_intermediate_chainr$      s   : J
71$
++G$|00233
	wyk!
gnn&0%@>> B CF__ C DFKfTUU	GNN$0%@>> C DF__ C DF;fDEE G(*}''
 ,N$:$:7$C~'$( 	(

++ o& "$./ 0 	0 8:!#% %JJ''    N)F)__doc__cvxpy.errorr   r   r   cvxpy.problems.objectiver   cvxpy.reductions.chainr   cvxpy.reductions.complex2realr    cvxpy.reductions.cvx_attr2constrr	   "cvxpy.reductions.dcp2cone.dcp2coner
    cvxpy.reductions.dgp2dcp.dgp2dcpr   cvxpy.reductions.flip_objectiver   cvxpy.reductions.qp2quad_formr   ,cvxpy.reductions.qp2quad_form.qp2symbolic_qpr   cvxpy.utilities.debug_toolsr   boolr$    r%   r#   <module>r4      s>    8 7 - ( 6 ; 7 4 9 8 F GK($ K(r%   