o
    `^h                     @   s   d dl mZ d dlmZ d dlZd dlZd dlmZm	Z	m
Z
mZ d dlmZ ddlmZmZ ddlmZmZ dd	lmZ G d
d dZG dd dZG dd dZG dd dZG dd dZdS )    )suppress)	signatureN)BoundsLinearConstraintNonlinearConstraintOptimizeResult)PreparedConstraint   )PRINT_OPTIONSBARRIER)CallbackSuccessget_arrays_tol)exact_1d_arrayc                   @   s8   e Zd ZdZdd Zdd Zedd Zedd	 Zd
S )ObjectiveFunctionz)
    Real-valued objective function.
    c                 G   sP   |r|du st |sJ t|tsJ t|tsJ || _|| _|| _d| _dS )a  
        Initialize the objective function.

        Parameters
        ----------
        fun : {callable, None}
            Function to evaluate, or None.

                ``fun(x, *args) -> float``

            where ``x`` is an array with shape (n,) and `args` is a tuple.
        verbose : bool
            Whether to print the function evaluations.
        debug : bool
            Whether to make debugging tests during the execution.
        *args : tuple
            Additional arguments to be passed to the function.
        Nr   )callable
isinstancebool_fun_verbose_args_n_eval)selffunverbosedebugargs r   W/home/air/shanriGPT/back/venv/lib/python3.10/site-packages/scipy/_lib/cobyqa/problem.py__init__   s   
zObjectiveFunction.__init__c                 C   s   t j|td}| jdu rd}|S tt | j|g| jR  }|  jd7  _| jrOt jdi t	 t
| j d| d|  W d   |S 1 sJw   Y  |S )a  
        Evaluate the objective function.

        Parameters
        ----------
        x : array_like, shape (n,)
            Point at which the objective function is evaluated.

        Returns
        -------
        float
            Function value at `x`.
        dtypeN        r	   () = r   )nparrayfloatr   squeezer   r   r   printoptionsr
   printname)r   xfr   r   r   __call__6   s   

zObjectiveFunction.__call__c                 C      | j S 
        Number of function evaluations.

        Returns
        -------
        int
            Number of function evaluations.
        )r   r   r   r   r   n_evalO      
zObjectiveFunction.n_evalc                 C   s:   d}| j durz| j j}W |S  ty   d}Y |S w |S )
        Name of the objective function.

        Returns
        -------
        str
            Name of the objective function.
         Nr   )r   __name__AttributeError)r   r*   r   r   r   r*   [   s   


zObjectiveFunction.nameN)	r6   
__module____qualname____doc__r   r-   propertyr2   r*   r   r   r   r   r      s    
r   c                   @   sH   e Zd ZdZdd Zedd Zedd Zdd	 Zd
d Z	dd Z
dS )BoundConstraintsz.
    Bound constraints ``xl <= x <= xu``.
    c                 C   s   t |jt| _t |jt| _t j | jt 	| j< t j| j
t 	| j
< t | j| j
ko@t | jt jk o@t | j
t j k| _t | jt j kt | j
t jk  | _t|t |jj| _dS )z
        Initialize the bound constraints.

        Parameters
        ----------
        bounds : scipy.optimize.Bounds
            Bound constraints.
        N)r$   r%   lbr&   _xlub_xuinfxlisnanxuallis_feasiblecount_nonzeromr   onessizepcs)r   boundsr   r   r   r   s   s   	
zBoundConstraints.__init__c                 C   r.   )z|
        Lower bound.

        Returns
        -------
        `numpy.ndarray`, shape (n,)
            Lower bound.
        )r>   r1   r   r   r   rB      r3   zBoundConstraints.xlc                 C   r.   )z|
        Upper bound.

        Returns
        -------
        `numpy.ndarray`, shape (n,)
            Upper bound.
        )r@   r1   r   r   r   rD      r3   zBoundConstraints.xuc                 C   s   t j|td}| |S )0  
        Evaluate the maximum constraint violation.

        Parameters
        ----------
        x : array_like, shape (n,)
            Point at which the maximum constraint violation is evaluated.

        Returns
        -------
        float
            Maximum constraint violation at `x`.
        r   )r$   asarrayr&   	violationr   r+   r   r   r   maxcv   s   
zBoundConstraints.maxcvc                 C   s   | j r	tdgS | j|S )Nr   )rF   r$   r%   rK   rO   rP   r   r   r   rO      s   zBoundConstraints.violationc                 C   s   | j rt|| j| jS |S )a  
        Project a point onto the feasible set.

        Parameters
        ----------
        x : array_like, shape (n,)
            Point to be projected.

        Returns
        -------
        `numpy.ndarray`, shape (n,)
            Projection of `x` onto the feasible set.
        )rF   r$   cliprB   rD   rP   r   r   r   project   s   zBoundConstraints.projectN)r6   r8   r9   r:   r   r;   rB   rD   rQ   rO   rS   r   r   r   r   r<   n   s    

r<   c                   @   sp   e Zd ZdZdd Zedd Zedd Zedd	 Zed
d Z	edd Z
edd Zdd Zdd ZdS )LinearConstraintszK
    Linear constraints ``a_ub @ x <= b_ub`` and ``a_eq @ x == b_eq``.
    c                    s  |rt |ts	J |D ]	}t |tsJ qt |tsJ td f| _td| _td f| _td| _	|D ]a}t
|j|j t|j|jk}t|rpt| j|j| f| _t| jd|j| |j|   f| _	t|st| j|j|  |j|   f| _t| j|j|  |j|   f| _q:d| jt| j< d| jt| j< t| jt| jB }t| j}| j| ddf | _| j|  | _| j| ddf | _| j|  | _	 fdd|D | _dS )a2  
        Initialize the linear constraints.

        Parameters
        ----------
        constraints : list of LinearConstraint
            Linear constraints.
        n : int
            Number of variables.
        debug : bool
            Whether to make debugging tests during the execution.
        r         ?r!   Nc                    s$   g | ]}|j jrt|t qS r   )ArJ   r   r$   rI   ).0cnr   r   
<listcomp>  s
    z.LinearConstraints.__init__.<locals>.<listcomp>)r   listr   r   r$   empty_a_ub_b_ub_a_eq_b_eqabsr?   r=   r   anyvstacka_eqrV   concatenateb_eqrE   a_ubb_ubrC   isinfrK   )r   constraintsrZ   r   
constraintis_equalityundef_ubundef_eqr   rY   r   r      sf   





	
zLinearConstraints.__init__c                 C   r.   )z
        Left-hand side matrix of the linear inequality constraints.

        Returns
        -------
        `numpy.ndarray`, shape (m, n)
            Left-hand side matrix of the linear inequality constraints.
        )r^   r1   r   r   r   rh     r3   zLinearConstraints.a_ubc                 C   r.   )z
        Right-hand side vector of the linear inequality constraints.

        Returns
        -------
        `numpy.ndarray`, shape (m, n)
            Right-hand side vector of the linear inequality constraints.
        )r_   r1   r   r   r   ri   #  r3   zLinearConstraints.b_ubc                 C   r.   )z
        Left-hand side matrix of the linear equality constraints.

        Returns
        -------
        `numpy.ndarray`, shape (m, n)
            Left-hand side matrix of the linear equality constraints.
        )r`   r1   r   r   r   re   /  r3   zLinearConstraints.a_eqc                 C   r.   )z
        Right-hand side vector of the linear equality constraints.

        Returns
        -------
        `numpy.ndarray`, shape (m, n)
            Right-hand side vector of the linear equality constraints.
        )ra   r1   r   r   r   rg   ;  r3   zLinearConstraints.b_eqc                 C      | j jS z
        Number of linear inequality constraints.

        Returns
        -------
        int
            Number of linear inequality constraints.
        )ri   rJ   r1   r   r   r   m_ubG     
zLinearConstraints.m_ubc                 C   rp   z
        Number of linear equality constraints.

        Returns
        -------
        int
            Number of linear equality constraints.
        )rg   rJ   r1   r   r   r   m_eqS  rs   zLinearConstraints.m_eqc                 C   s   t j| |ddS )rM   r!   initialr$   maxrO   rP   r   r   r   rQ   _  s   zLinearConstraints.maxcvc                    s.   t | jrt fdd| jD S tg S )Nc                       g | ]}|  qS r   rO   rW   pcr+   r   r   r[   q      z/LinearConstraints.violation.<locals>.<listcomp>)lenrK   r$   rf   r%   rP   r   r~   r   rO   o  s   

zLinearConstraints.violationN)r6   r8   r9   r:   r   r;   rh   ri   re   rg   rr   ru   rQ   rO   r   r   r   r   rT      s"    D





rT   c                   @   sX   e Zd ZdZdd Zdd Zedd Zedd	 Zed
d Z	dddZ
dddZdS )NonlinearConstraintszI
    Nonlinear constraints ``c_ub(x) <= 0`` and ``c_eq(x) == b_eq``.
    c                 C   st   |r#t |ts	J |D ]	}t |tsJ qt |tsJ t |ts#J || _g | _|| _d| _d| _d | _	| _
dS )aA  
        Initialize the nonlinear constraints.

        Parameters
        ----------
        constraints : list
            Nonlinear constraints.
        verbose : bool
            Whether to print the function evaluations.
        debug : bool
            Whether to make debugging tests during the execution.
        N)r   r\   r   r   _constraintsrK   r   _map_ub_map_eq_m_ub_m_eq)r   rk   r   r   rl   r   r   r   r   z  s   zNonlinearConstraints.__init__c              
   C   s  t | jsd | _| _tg tg fS tj|td}t | jsg | _g | _	d| _d| _| jD ]q}t
|jsLt|}dd |_dd |_t||}nt||}d|j_| j| t|jj}|jd |jd }}t||}t|| |k}	| j	||	  | j||	   |  jt|	7  _|  jt|	 7  _q0g }
g }t| jD ]\}}|j|}| jrtjdi t/ tt | j| jj}t| d| d	|  W d
   n1 sw   Y  W d
   n1 sw   Y  | j	| }| j| }|| }t |r=|jd | }|jd | }|tj  k}|| ||  }|
| |tj k }|| ||  }|
| || }t |rZd|jd | |jd |   }||8 }|| q| jrjt!|}ntg }| jryt!|
}
ntg }
|
j"| _|j"| _|
|fS )a  
        Calculates the residual (slack) for the constraints.

        Parameters
        ----------
        x : array_like, shape (n,)
            Point at which the constraints are evaluated.

        Returns
        -------
        `numpy.ndarray`, shape (m_nonlinear_ub,)
            Nonlinear inequality constraint slack values.
        `numpy.ndarray`, shape (m_nonlinear_eq,)
            Nonlinear equality constraint slack values.
        r   r   c                 S   s   | S Nr   )x0r   r   r   <lambda>      z/NonlinearConstraints.__call__.<locals>.<lambda>c                 S   s   dS )Nr!   r   )r   vr   r   r   r     r   Tr	   r"   r#   NrU   r   )#r   r   r   r   r$   r%   r&   rK   r   r   r   jaccopyhessr   r   	f_updatedappendarangerH   rL   r   rb   rG   	enumerater   r(   r
   r   r7   r6   r)   rA   rf   rJ   )r   r+   rl   rX   r}   idxr=   r?   arr_tolrm   c_ubc_eqivalfun_nameeq_idxub_idxub_valrB   rD   	finite_xl_v	finite_xueq_valmidpointr   r   r   r-     s   
















 

zNonlinearConstraints.__call__c                 C      | j du r	td| j S )a  
        Number of nonlinear inequality constraints.

        Returns
        -------
        int
            Number of nonlinear inequality constraints.

        Raises
        ------
        ValueError
            If the number of nonlinear inequality constraints is unknown.
        Nz:The number of nonlinear inequality constraints is unknown.)r   
ValueErrorr1   r   r   r   rr     
   
zNonlinearConstraints.m_ubc                 C   r   )a  
        Number of nonlinear equality constraints.

        Returns
        -------
        int
            Number of nonlinear equality constraints.

        Raises
        ------
        ValueError
            If the number of nonlinear equality constraints is unknown.
        Nz8The number of nonlinear equality constraints is unknown.)r   r   r1   r   r   r   ru     r   zNonlinearConstraints.m_eqc                 C   s   t | jr| jd jjS dS )r0   r   )r   rK   r   nfevr1   r   r   r   r2   /  s   

zNonlinearConstraints.n_evalNc                 C   s   t j| j|||dddS a  
        Evaluate the maximum constraint violation.

        Parameters
        ----------
        x : array_like, shape (n,)
            Point at which the maximum constraint violation is evaluated.
        cub_val : array_like, shape (m_nonlinear_ub,), optional
            Values of the nonlinear inequality constraints. If not provided,
            the nonlinear inequality constraints are evaluated at `x`.
        ceq_val : array_like, shape (m_nonlinear_eq,), optional
            Values of the nonlinear equality constraints. If not provided,
            the nonlinear equality constraints are evaluated at `x`.

        Returns
        -------
        float
            Maximum constraint violation at `x`.
        )cub_valceq_valr!   rv   rx   r   r+   r   r   r   r   r   rQ   >  s   zNonlinearConstraints.maxcvc                    s   t  fdd| jD S )Nc                    rz   r   r{   r|   r~   r   r   r[   W  r   z2NonlinearConstraints.violation.<locals>.<listcomp>)r$   rf   rK   r   r   r~   r   rO   V  s   zNonlinearConstraints.violationNN)r6   r8   r9   r:   r   r-   r;   rr   ru   r2   rQ   rO   r   r   r   r   r   u  s    l



r   c                   @   s  e Zd ZdZdd Zd0ddZedd Zed	d
 Zedd Z	edd Z
edd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zedd  Zed!d" Zed#d$ Zed%d& Zd'd( Zd1d*d+Zd1d,d-Zd.d/ Zd)S )2Problemz
    Optimization problem.
    c                 C   s  |rVt |ts	J t |tsJ t |tsJ t |tsJ t |ts%J t |ts,J t |	ts3J t |
ts:J |	rB|
dksBJ t |tsIJ |dksOJ t |tsVJ || _|| _	|| _
|durkt|sktd|| _t|d}|j}|jj|krtd| d|jjd |krtd| d	t|j|j}|j|jkt|j|j |k @ | _d
|j| j |j| j   | _t| j|j| j |j| j | _|| _tt|j| j  |j| j  | _| j|| j  | _|j |j!dd| jf | j  }tt"|jdd| j f tj# |j$|jdd| jf | j  t"|j!dd| j f ||g| j%|| _	|oM| jj&oMt't(| jjoMt't(| jj}|rd
| jj| jj  | _)d
| jj| jj  | _*ttt+| j% t+| j%| _| j	j | j	j!| j*  }tt"| j	jt,| j) tj# | j	j$| j	j| j*  t"| j	j!t,| j) ||g| j%|| _	| j| j* | j) | _nt+| j%| _)t-| j%| _*|| _.|| _/g | _0g | _1g | _2|	| _3|
| _4g | _5g | _6g | _7dS )aY  
        Initialize the nonlinear problem.

        The problem is preprocessed to remove all the variables that are fixed
        by the bound constraints.

        Parameters
        ----------
        obj : ObjectiveFunction
            Objective function.
        x0 : array_like, shape (n,)
            Initial guess.
        bounds : BoundConstraints
            Bound constraints.
        linear : LinearConstraints
            Linear constraints.
        nonlinear : NonlinearConstraints
            Nonlinear constraints.
        callback : {callable, None}
            Callback function.
        feasibility_tol : float
            Tolerance on the constraint violation.
        scale : bool
            Whether to scale the problem according to the bounds.
        store_history : bool
            Whether to store the function evaluations.
        history_size : int
            Maximum number of function evaluations to store.
        filter_size : int
            Maximum number of points in the filter.
        debug : bool
            Whether to make debugging tests during the execution.
        r   Nz)The callback must be a callable function.z#The initial guess must be a vector.zThe bounds must have z
 elements.r	   z@The left-hand side matrices of the linear constraints must have z	 columns.rU   )8r   r   r<   rT   r   r&   r   int_obj_linear
_nonlinearr   	TypeError	_callbackr   rJ   rB   r   rh   shaper   rD   r$   rb   
_fixed_idx
_fixed_valrR   _orig_boundsr   _boundsrS   _x0rg   re   r   rA   ri   rZ   rF   rE   isfinite_scaling_factor_scaling_shiftrI   diagzeros_feasibility_tol_filter_size_fun_filter_maxcv_filter	_x_filter_store_history_history_size_fun_history_maxcv_history
_x_history)r   objr   rL   linear	nonlinearcallbackfeasibility_tolscalestore_historyhistory_sizefilter_sizer   rZ   tolrg   r   r   r   r   _  s   0



 	
zProblem.__init__r!   c              
      sT  t j|td}| |}| | | |\}}| |||| jrN| j	  | j
	 | j	| t| j| jkrN| jd | j
d | jd t  r`t r`t| jdk}n=t  rvtfddt| j| jD }n't rt fddt| j| jD }nt fddt| j| jD }|r*| j	  | j	 | j	| tt| jd ddD ]Q}t  rt | j| }n,t rt | j| }nt | j| pt | j| p | j| ko| j| k}|r| j| | j| | j| qt| j| jkr*| jd | jd | jd | jd	urpt| j}	z*| |\}
}}| |
}
t|	jd
hkrYt|
|d}| j|d n| |
 W n tyo } zt|d	}~ww t  rxt t|t |< t|t |< t t! tt  t "t #|tt }t "t #|tt } ||fS )a  
        Evaluate the objective and nonlinear constraint functions.

        Parameters
        ----------
        x : array_like, shape (n,)
            Point at which the functions are evaluated.
        penalty : float, optional
            Penalty parameter used to select the point in the filter to forward
            to the callback function.

        Returns
        -------
        float
            Objective function value.
        `numpy.ndarray`, shape (m_nonlinear_ub,)
            Nonlinear inequality constraint function values.
        `numpy.ndarray`, shape (m_nonlinear_eq,)
            Nonlinear equality constraint function values.

        Raises
        ------
        `cobyqa.utils.CallbackSuccess`
            If the callback function raises a ``StopIteration``.
        r   r   c                 3   s0    | ]\}}t |r |k pt |V  qd S r   r$   rC   rW   
fun_filtermaxcv_filter)	maxcv_valr   r   	<genexpr>7      

z#Problem.__call__.<locals>.<genexpr>c                 3   s0    | ]\}}t |r |k pt |V  qd S r   r   r   )fun_valr   r   r   A  r   c                 3   s$    | ]\}} |k p|k V  qd S r   r   r   r   r   r   r   r   K  s
    
   Nintermediate_result)r+   r   )r   )$r$   rN   r&   build_xr   r   rQ   r   r   r   r   r   r   r   poprC   r   rE   zipr   r   ranger   r   r   	best_evalset
parametersr   StopIterationr   r   ry   minmaximumminimum)r   r+   penaltyx_fullr   r   include_pointkremove_pointsigx_bestfun_best_r   excr   r   r   r-   
  s   




	







zProblem.__call__c                 C   rp   )zt
        Number of variables.

        Returns
        -------
        int
            Number of variables.
        )r   rJ   r1   r   r   r   rZ     rs   z	Problem.nc                 C   rp   )z
        Number of variables in the original problem (with fixed variables).

        Returns
        -------
        int
            Number of variables in the original problem (with fixed variables).
        )r   rJ   r1   r   r   r   n_orig  rs   zProblem.n_origc                 C   r.   )z
        Initial guess.

        Returns
        -------
        `numpy.ndarray`, shape (n,)
            Initial guess.
        )r   r1   r   r   r   r     r3   z
Problem.x0c                 C   rp   r/   )r   r2   r1   r   r   r   r2     rs   zProblem.n_evalc                 C   rp   )r4   )r   r*   r1   r   r   r   r     rs   zProblem.fun_namec                 C   r.   )z}
        Bound constraints.

        Returns
        -------
        BoundConstraints
            Bound constraints.
        )r   r1   r   r   r   rL     r3   zProblem.boundsc                 C   r.   )z
        Linear constraints.

        Returns
        -------
        LinearConstraints
            Linear constraints.
        )r   r1   r   r   r   r     r3   zProblem.linearc                 C   rp   )z
        Number of bound constraints.

        Returns
        -------
        int
            Number of bound constraints.
        )rL   rH   r1   r   r   r   m_bounds  rs   zProblem.m_boundsc                 C   rp   rq   )r   rr   r1   r   r   r   m_linear_ub  rs   zProblem.m_linear_ubc                 C   rp   rt   )r   ru   r1   r   r   r   m_linear_eq  rs   zProblem.m_linear_eqc                 C   rp   )a   
        Number of nonlinear inequality constraints.

        Returns
        -------
        int
            Number of nonlinear inequality constraints.

        Raises
        ------
        ValueError
            If the number of nonlinear inequality constraints is not known.
        )r   rr   r1   r   r   r   m_nonlinear_ub     zProblem.m_nonlinear_ubc                 C   rp   )a  
        Number of nonlinear equality constraints.

        Returns
        -------
        int
            Number of nonlinear equality constraints.

        Raises
        ------
        ValueError
            If the number of nonlinear equality constraints is not known.
        )r   ru   r1   r   r   r   m_nonlinear_eq  r   zProblem.m_nonlinear_eqc                 C      t j| jtdS )z
        History of objective function evaluations.

        Returns
        -------
        `numpy.ndarray`, shape (n_eval,)
            History of objective function evaluations.
        r   )r$   r%   r   r&   r1   r   r   r   fun_history(     
zProblem.fun_historyc                 C   r   )z
        History of maximum constraint violations.

        Returns
        -------
        `numpy.ndarray`, shape (n_eval,)
            History of maximum constraint violations.
        r   )r$   r%   r   r&   r1   r   r   r   maxcv_history4  r   zProblem.maxcv_historyc                 C   s`   z%| j dks| jdkrW dS | jdks| jdkrW dS | jdkr#W dS W dS  ty/   Y dS w )z
        Type of the problem.

        The problem can be either 'unconstrained', 'bound-constrained',
        'linearly constrained', or 'nonlinearly constrained'.

        Returns
        -------
        str
            Type of the problem.
        r   znonlinearly constrainedzlinearly constrainedzbound-constrainedunconstrained)r   r   r   r   r   r   r1   r   r   r   type@  s   
zProblem.typec                 C   s
   | j dkS )z
        Whether the problem is a feasibility problem.

        Returns
        -------
        bool
            Whether the problem is a feasibility problem.
        r5   )r   r1   r   r   r   is_feasibility^  s   

zProblem.is_feasibilityc                 C   s<   t | j}| j|| j< || j | j || j < | j|S )a0  
        Build the full vector of variables from the reduced vector.

        Parameters
        ----------
        x : array_like, shape (n,)
            Reduced vector of variables.

        Returns
        -------
        `numpy.ndarray`, shape (n_orig,)
            Full vector of variables.
        )	r$   r]   r   r   r   r   r   r   rS   )r   r+   r   r   r   r   r   j  s   zProblem.build_xNc                 C   s,   | j |||d}t|rtj|ddS dS r   )rO   r$   rG   ry   )r   r+   r   r   rO   r   r   r   rQ   ~  s   
zProblem.maxcvc                 C   s   g }| j js| j |}|| t| jjr"| j|}|| t| jjr5| j|||}|| t|r>t	|S d S r   )
rL   rF   rO   r   r   r   rK   r   r$   rf   )r   r+   r   r   rO   blcnlcr   r   r   rO     s   



zProblem.violationc                 C   s  t | jdkr| | j t| j}t| j}t| j}t|}t|r|| j	k}t|rat
t|| sa||t|| k@ }t|dkrY||t|| kM }t|d }nt|rnt|d }nzt|tj}	|| |||   |	|< t
t|	r|t|k}
t|
d }nP|	t|	k}t|dkr||t|| kM }t|dkr||t|| kM }t|d }nt
t|s|t|k}t|d }nt |d }| j||ddf || || fS )a  
        Return the best point in the filter and the corresponding objective and
        nonlinear constraint function evaluations.

        Parameters
        ----------
        penalty : float
            Penalty parameter

        Returns
        -------
        `numpy.ndarray`, shape (n,)
            Best point.
        float
            Corresponding objective function value.
        float
            Corresponding maximum constraint violation.
        r   r	   r   N)r   r   r   r$   r%   r   r   r   rc   r   rE   rC   nanminrG   r   flatnonzero	full_likenanrL   rS   )r   r   r   r   x_filter
finite_idxfeasible_idxfun_min_idxr   merit_filtermin_maxcv_idxmerit_min_idxr   r   r   r     sZ   




	zProblem.best_eval)r!   r   )r6   r8   r9   r:   r   r-   r;   rZ   r   r   r2   r   rL   r   r   r   r   r   r   r   r   r   r   r   rQ   rO   r   r   r   r   r   r   Z  sT     
, 

















r   )
contextlibr   inspectr   r   numpyr$   scipy.optimizer   r   r   r   scipy.optimize._constraintsr   settingsr
   r   utilsr   r   r   r   r<   rT   r   r   r   r   r   r   <module>   s     Z` ( f