o
    i                     @   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   S/home/kim/smarthome/.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`.
        ZdtypeN        r	   () = r   )nparrayfloatr   Z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)	r4   
__module____qualname____doc__r   r+   propertyr0   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<   r/   r   r   r   r@      r1   zBoundConstraints.xlc                 C   r,   )z|
        Upper bound.

        Returns
        -------
        `numpy.ndarray`, shape (n,)
            Upper bound.
        )r>   r/   r   r   r   rB      r1   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   )rD   r#   r$   rI   rM   rN   r   r   r   rM      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.
        )rD   r#   clipr@   rB   rN   r   r   r   project   s   zBoundConstraints.projectN)r4   r6   r7   r8   r   r9   r@   rB   rO   rM   rQ   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   )ArH   r   r#   rG   ).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   anyZvstacka_eqrT   concatenateb_eqrC   a_ubb_ubrA   isinfrI   )r   constraintsrX   r   
constraintis_equalityZundef_ubZundef_eqr   rW   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\   r/   r   r   r   re     r1   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]   r/   r   r   r   rf   #  r1   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^   r/   r   r   r   rb   /  r1   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.
        )r_   r/   r   r   r   rd   ;  r1   zLinearConstraints.b_eqc                 C      | j jS z
        Number of linear inequality constraints.

        Returns
        -------
        int
            Number of linear inequality constraints.
        )rf   rH   r/   r   r   r   m_ubG     
zLinearConstraints.m_ubc                 C   rk   z
        Number of linear equality constraints.

        Returns
        -------
        int
            Number of linear equality constraints.
        )rd   rH   r/   r   r   r   m_eqS  rn   zLinearConstraints.m_eqc                 C   s   t j| |ddS )rK   r    initialr#   maxrM   rN   r   r   r   rO   _  s   zLinearConstraints.maxcvc                    s.   t | jrt fdd| jD S tg S )Nc                       g | ]}|  qS r   rM   rU   pcr)   r   r   rY   q      z/LinearConstraints.violation.<locals>.<listcomp>)lenrI   r#   rc   r$   rN   r   ry   r   rM   o  s   

zLinearConstraints.violationN)r4   r6   r7   r8   r   r9   re   rf   rb   rd   rm   rp   rO   rM   r   r   r   r   rR      s"    D





rR   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   rZ   r   r   _constraintsrI   r   _map_ub_map_eq_m_ub_m_eq)r   rh   r   r   ri   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"   NrS   r   )#r{   r}   r   r   r#   r$   r%   rI   r~   r   r   ZjaccopyZhessr   r   Z	f_updatedappendZarangerF   rJ   r   r`   rE   	enumerater   r&   r
   r   r5   r4   r'   r?   rc   rH   )r   r)   ri   rV   rx   idxr;   r=   Zarr_tolrj   Zc_ubZc_eqivalfun_nameZeq_idxZub_idxZub_valr@   rB   Z	finite_xl_vZ	finite_xuZeq_valZ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   
ValueErrorr/   r   r   r   rm     
   
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   r/   r   r   r   rp     r   zNonlinearConstraints.m_eqc                 C   s   t | jr| jd jjS dS )r.   r   )r{   rI   r   Znfevr/   r   r   r   r0   /  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    rq   rs   r   r)   r   r   r   r   r   rO   >  s   zNonlinearConstraints.maxcvc                    s   t  fdd| jD S )Nc                    ru   r   rv   rw   ry   r   r   rY   W  rz   z2NonlinearConstraints.violation.<locals>.<listcomp>)r#   rc   rI   r   r   ry   r   rM   V  s   zNonlinearConstraints.violationNN)r4   r6   r7   r8   r   r+   r9   rm   rp   r0   rO   rM   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.rS   )8r   r   r:   rR   r|   r%   r   int_obj_linear
_nonlinearr   	TypeError	_callbackr   rH   r@   r   re   shaper   rB   r#   r`   
_fixed_idx
_fixed_valrP   _orig_boundsr   _boundsrQ   _x0rd   rb   r   r?   rf   rX   rD   rC   isfinite_scaling_factor_scaling_shiftrG   ZdiagZzeros_feasibility_tol_filter_size_fun_filter_maxcv_filter	_x_filter_store_history_history_size_fun_history_maxcv_history
_x_history)r   objr   rJ   linearZ	nonlinearcallbackZfeasibility_tolscaleZstore_historyZhistory_sizeZfilter_sizer   rX   Ztolrd   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#   rA   rU   
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#   rL   r%   build_xr   r   rO   r   r   r   r   r   r{   r   poprA   r   rC   zipr   r   ranger   r   r   	best_evalset
parametersr   StopIterationr   r   rt   minmaximumminimum)r   r)   penaltyx_fullr   r   Zinclude_pointkZremove_pointsigZx_bestZfun_best_r   excr   r   r   r+   
  s   




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

        Returns
        -------
        int
            Number of variables.
        )r   rH   r/   r   r   r   rX     rn   z	Problem.nc                 C   rk   )z
        Number of variables in the original problem (with fixed variables).

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

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

        Returns
        -------
        BoundConstraints
            Bound constraints.
        )r   r/   r   r   r   rJ     r1   zProblem.boundsc                 C   r,   )z
        Linear constraints.

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

        Returns
        -------
        int
            Number of bound constraints.
        )rJ   rF   r/   r   r   r   m_bounds  rn   zProblem.m_boundsc                 C   rk   rl   )r   rm   r/   r   r   r   m_linear_ub  rn   zProblem.m_linear_ubc                 C   rk   ro   )r   rp   r/   r   r   r   m_linear_eq  rn   zProblem.m_linear_eqc                 C   rk   )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   rm   r/   r   r   r   m_nonlinear_ub     zProblem.m_nonlinear_ubc                 C   rk   )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   rp   r/   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%   r/   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%   r/   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-constrainedZunconstrained)r   r   r   r   r   r   r/   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.
        r3   )r   r/   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   rQ   )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   )rM   r#   rE   rt   )r   r)   r   r   rM   r   r   r   rO   ~  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   )
rJ   rD   rM   r   r{   r   rI   r   r#   rc   )r   r)   r   r   rM   blcZnlcr   r   r   rM     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   ra   r   rC   rA   ZnanminrE   r   ZflatnonzeroZ	full_likenanrJ   rQ   )r   r   r   r   Zx_filterZ
finite_idxZfeasible_idxZfun_min_idxr   Zmerit_filterZmin_maxcv_idxZmerit_min_idxr   r   r   r     sZ   




	zProblem.best_eval)r    r   )r4   r6   r7   r8   r   r+   r9   rX   r   r   r0   r   rJ   r   r   r   r   r   r   r   r   r   r   r   rO   rM   r   r   r   r   r   r   Z  sT     
, 

















r   )
contextlibr   inspectr   r   numpyr#   Zscipy.optimizer   r   r   r   Zscipy.optimize._constraintsr   settingsr
   r   utilsr   r   r   r   r:   rR   r|   r   r   r   r   r   <module>   s     Z` ( f