
    ^MhO                         d Z ddlZddlmZ ddlmZ ddlm	Z	 ddl
mZmZmZmZ ddlmZ  edd	          Zd
ej        _        de_         d ZddZd Zd ZddZd Zd Zd Zd Zd Zd ZddZd Z dS )z:
Method agnostic utility functions for linear programming
    N)warn   )OptimizeWarning)_remove_redundancy_svd_remove_redundancy_pivot_sparse_remove_redundancy_pivot_dense_remove_redundancy_id)
namedtuple
_LPProblemz+c A_ub b_ub A_eq b_eq bounds x0 integrality)NNNNNNNa   Represents a linear-programming problem.

    Attributes
    ----------
    c : 1D array
        The coefficients of the linear objective function to be minimized.
    A_ub : 2D array, optional
        The inequality constraint matrix. Each row of ``A_ub`` specifies the
        coefficients of a linear inequality constraint on ``x``.
    b_ub : 1D array, optional
        The inequality constraint vector. Each element represents an
        upper bound on the corresponding value of ``A_ub @ x``.
    A_eq : 2D array, optional
        The equality constraint matrix. Each row of ``A_eq`` specifies the
        coefficients of a linear equality constraint on ``x``.
    b_eq : 1D array, optional
        The equality constraint vector. Each element of ``A_eq @ x`` must equal
        the corresponding element of ``b_eq``.
    bounds : various valid formats, optional
        The bounds of ``x``, as ``min`` and ``max`` pairs.
        If bounds are specified for all N variables separately, valid formats
        are:
        * a 2D array (N x 2);
        * a sequence of N sequences, each with 2 values.
        If all variables have the same bounds, the bounds can be specified as
        a 1-D or 2-D array or sequence with 2 scalar values.
        If all variables have a lower bound of 0 and no upper bound, the bounds
        parameter can be omitted (or given as None).
        Absent lower and/or upper bounds can be specified as -numpy.inf (no
        lower bound), numpy.inf (no upper bound) or None (both).
    x0 : 1D array, optional
        Guess values of the decision variables, which will be refined by
        the optimization algorithm. This argument is currently used only by the
        'revised simplex' method, and can only be used if `x0` represents a
        basic feasible solution.
    integrality : 1-D array or int, optional
        Indicates the type of integrality constraint on each decision variable.

        ``0`` : Continuous variable; no integrality constraint.

        ``1`` : Integer variable; decision variable must be an integer
        within `bounds`.

        ``2`` : Semi-continuous variable; decision variable must be within
        `bounds` or take value ``0``.

        ``3`` : Semi-integer variable; decision variable must be an integer
        within `bounds` or take value ``0``.

        By default, all variables are continuous.

        For mixed integrality constraints, supply an array of shape `c.shape`.
        To infer a constraint on each decision variable from shorter inputs,
        the argument will be broadcast to `c.shape` using `np.broadcast_to`.

        This argument is currently used only by the ``'highs'`` method and
        ignored otherwise.

    Notes
    -----
    This namedtuple supports 2 ways of initialization:
    >>> lp1 = _LPProblem(c=[-1, 4], A_ub=[[-3, 1], [1, 2]], b_ub=[6, 4])
    >>> lp2 = _LPProblem([-1, 4], [[-3, 1], [1, 2]], [6, 4])

    Note that only ``c`` is a required argument here, whereas all other arguments
    ``A_ub``, ``b_ub``, ``A_eq``, ``b_eq``, ``bounds``, ``x0`` are optional with
    default values of None.
    For example, ``A_eq`` and ``b_eq`` can be set without ``A_ub`` or ``b_ub``:
    >>> lp3 = _LPProblem(c=[-1, 4], A_eq=[[2, 1]], b_eq=[10])
    c                    |                      dd          }|r|t          j        |          }|r|t          j        |          }t          j        |          pt          j        |          }h d}ddh}||v r|rt	          d| d| d	          |                     d
d          }|s$|r"|dk    rd| d
<   t          dt          d           | ||fS )a  
    Check the provided ``A_ub`` and ``A_eq`` matrices conform to the specified
    optional sparsity variables.

    Parameters
    ----------
    A_ub : 2-D array, optional
        2-D array such that ``A_ub @ x`` gives the values of the upper-bound
        inequality constraints at ``x``.
    A_eq : 2-D array, optional
        2-D array such that ``A_eq @ x`` gives the values of the equality
        constraints at ``x``.
    options : dict
        A dictionary of solver options. All methods accept the following
        generic options:

            maxiter : int
                Maximum number of iterations to perform.
            disp : bool
                Set to True to print convergence messages.

        For method-specific options, see :func:`show_options('linprog')`.
    method : str, optional
        The algorithm used to solve the standard form problem.

    Returns
    -------
    A_ub : 2-D array, optional
        2-D array such that ``A_ub @ x`` gives the values of the upper-bound
        inequality constraints at ``x``.
    A_eq : 2-D array, optional
        2-D array such that ``A_eq @ x`` gives the values of the equality
        constraints at ``x``.
    options : dict
        A dictionary of solver options. All methods accept the following
        generic options:

            maxiter : int
                Maximum number of iterations to perform.
            disp : bool
                Set to True to print convergence messages.

        For method-specific options, see :func:`show_options('linprog')`.
    _sparse_presolveFN>   highs-ds	highs-ipmhighssimplexzrevised simplexzMethod 'zL' does not support sparse constraint matrices. Please consider using one of .sparsezinterior-pointTz9Sparse constraint matrix detected; setting 'sparse':True.   
stacklevel)popsps
coo_matrixissparse
ValueErrorgetr   r   )	optionsmethA_ubA_eqr   sparse_constraintpreferred_methodsdense_methodsr   s	            \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/scipy/optimize/_linprog_util.py_check_sparse_inputsr%   [   s4   \ {{#5u== $D,~d## $D,~d##T**@cl4.@.@::: 12M}!2 1D 1 1-1 1 1 2 2 	2 [[5))F ,' ,D4D,D,D H	, 	, 	, 	,D$    Fc                     |r"t          j        | d|fn| t          d          S | t          j        d|ft                    S t          j        | t          d          S )au  Format the left hand side of the constraints to a 2-D array

    Parameters
    ----------
    A : 2-D array
        2-D array such that ``A @ x`` gives the values of the upper-bound
        (in)equality constraints at ``x``.
    n_x : int
        The number of variables in the linear programming problem.
    sparse_lhs : bool
        Whether either of `A_ub` or `A_eq` are sparse. If true return a
        coo_matrix instead of a numpy array.

    Returns
    -------
    np.ndarray or sparse.coo_matrix
        2-D array such that ``A @ x`` gives the values of the upper-bound
        (in)equality constraints at ``x``.

    Nr   Tdtypecopyr)   )r   r   floatnpzerosarray)An_x
sparse_lhss      r$   _format_A_constraintsr3      so    *  3~	QHHqD
 
 
 	
 
xC....xT2222r&   c                     | t          j        g t                    S t          j        | t          d                                          } | j        dk    r| n|                     d          S )a|  Format the upper bounds of the constraints to a 1-D array

    Parameters
    ----------
    b : 1-D array
        1-D array of values representing the upper-bound of each (in)equality
        constraint (row) in ``A``.

    Returns
    -------
    1-D np.array
        1-D array of values representing the upper-bound of each (in)equality
        constraint (row) in ``A``.

    Nr+   Tr(   r   )r-   r/   r,   squeezesizereshape)bs    r$   _format_b_constraintsr:      s^      	yx%((((
%d+++3355A!112.r&   c           
         | \  }}}}}}}}|t           	 t          j        |t          j        d                                          }|j        dk    r|                    d          }t          |          }	|	dk    st          |j                  dk    rt          d          t          j
        |                                          st          d          n"# t          $ r}
t          d	          |
d}
~
ww xY wt          j        |          pt          j        |          }	 t          ||	|
          }|j        d         }t          |j                  dk    s|j        d         |	k    rt          d          t          j        |          r+t          j
        |j                                                  r:t          j        |          s5t          j
        |                                          st          d          n"# t          $ r}
t          d          |
d}
~
ww xY w	 t!          |          }|j        |fk    rt          d          t          j
        |                                          st          d          n"# t          $ r}
t          d          |
d}
~
ww xY w	 t          ||	|
          }|j        d         }t          |j                  dk    s|j        d         |	k    rt          d          t          j        |          r+t          j
        |j                                                  r:t          j        |          s5t          j
        |                                          st          d          n"# t          $ r}
t          d          |
d}
~
ww xY w	 t!          |          }|j        |fk    rt          d          t          j
        |                                          st          d          n"# t          $ r}
t          d          |
d}
~
ww xY w|	 t          j        |t"          d                                          }n"# t          $ r}
t          d          |
d}
~
ww xY w|j        dk    r|                    d          }t          |          dk    s|j        dk    rt          d          |j        |j        k    st          d          t          j
        |                                          st          d          t          j        |	dft"                    }|+t          j        |g           st          j        |g g          rdt          j        f}	 t          j        t          j        |t"                              }n[# t          $ r#}
t          d|
j        d         z             |
d}
~
wt           $ r#}
t          d|
j        d         z             |
d}
~
ww xY w|j        }t          |          dk    r!t          dt          |          dd           t          j        ||	dfk              r|}nt          j        |d!k              st          j        |d"k              r3|                                }|d         |dddf<   |d         |dddf<   nEt          j        |d|	fk              rt          d#|	dd$|	dd%          t          d&| d'          t          j        |dddf                   }t          j         ||df<   t          j        |dddf                   }t          j        ||df<   t5          ||||||||          S )(aZ  
    Given user inputs for a linear programming problem, return the
    objective vector, upper bound constraints, equality constraints,
    and simple bounds in a preferred format.

    Parameters
    ----------
    lp : A `scipy.optimize._linprog_util._LPProblem` consisting of the following fields:

        c : 1D array
            The coefficients of the linear objective function to be minimized.
        A_ub : 2D array, optional
            The inequality constraint matrix. Each row of ``A_ub`` specifies the
            coefficients of a linear inequality constraint on ``x``.
        b_ub : 1D array, optional
            The inequality constraint vector. Each element represents an
            upper bound on the corresponding value of ``A_ub @ x``.
        A_eq : 2D array, optional
            The equality constraint matrix. Each row of ``A_eq`` specifies the
            coefficients of a linear equality constraint on ``x``.
        b_eq : 1D array, optional
            The equality constraint vector. Each element of ``A_eq @ x`` must equal
            the corresponding element of ``b_eq``.
        bounds : various valid formats, optional
            The bounds of ``x``, as ``min`` and ``max`` pairs.
            If bounds are specified for all N variables separately, valid formats are:
            * a 2D array (2 x N or N x 2);
            * a sequence of N sequences, each with 2 values.
            If all variables have the same bounds, a single pair of values can
            be specified. Valid formats are:
            * a sequence with 2 scalar values;
            * a sequence with a single element containing 2 scalar values.
            If all variables have a lower bound of 0 and no upper bound, the bounds
            parameter can be omitted (or given as None).
        x0 : 1D array, optional
            Guess values of the decision variables, which will be refined by
            the optimization algorithm. This argument is currently used only by the
            'revised simplex' method, and can only be used if `x0` represents a
            basic feasible solution.

    Returns
    -------
    lp : A `scipy.optimize._linprog_util._LPProblem` consisting of the following fields:

        c : 1D array
            The coefficients of the linear objective function to be minimized.
        A_ub : 2D array, optional
            The inequality constraint matrix. Each row of ``A_ub`` specifies the
            coefficients of a linear inequality constraint on ``x``.
        b_ub : 1D array, optional
            The inequality constraint vector. Each element represents an
            upper bound on the corresponding value of ``A_ub @ x``.
        A_eq : 2D array, optional
            The equality constraint matrix. Each row of ``A_eq`` specifies the
            coefficients of a linear equality constraint on ``x``.
        b_eq : 1D array, optional
            The equality constraint vector. Each element of ``A_eq @ x`` must equal
            the corresponding element of ``b_eq``.
        bounds : 2D array
            The bounds of ``x``, as ``min`` and ``max`` pairs, one for each of the N
            elements of ``x``. The N x 2 array contains lower bounds in the first
            column and upper bounds in the 2nd. Unbounded variables have lower
            bound -np.inf and/or upper bound np.inf.
        x0 : 1D array, optional
            Guess values of the decision variables, which will be refined by
            the optimization algorithm. This argument is currently used only by the
            'revised simplex' method, and can only be used if `x0` represents a
            basic feasible solution.

    NTr(   r   r5   r   zhInvalid input for linprog: c must be a 1-D array and must not have more than one non-singleton dimensionzFInvalid input for linprog: c must not contain values inf, nan, or NonezJInvalid input for linprog: c must be a 1-D array of numerical coefficients)r2      zInvalid input for linprog: A_ub must have exactly two dimensions, and the number of columns in A_ub must be equal to the size of czIInvalid input for linprog: A_ub must not contain values inf, nan, or NonezGInvalid input for linprog: A_ub must be a 2-D array of numerical valueszInvalid input for linprog: b_ub must be a 1-D array; b_ub must not have more than one non-singleton dimension and the number of rows in A_ub must equal the number of values in b_ubzIInvalid input for linprog: b_ub must not contain values inf, nan, or NonezInvalid input for linprog: b_ub must be a 1-D array of numerical values, each representing the upper bound of an inequality constraint (row) in A_ubzInvalid input for linprog: A_eq must have exactly two dimensions, and the number of columns in A_eq must be equal to the size of czIInvalid input for linprog: A_eq must not contain values inf, nan, or NonezGInvalid input for linprog: A_eq must be a 2-D array of numerical valueszInvalid input for linprog: b_eq must be a 1-D array; b_eq must not have more than one non-singleton dimension and the number of rows in A_eq must equal the number of values in b_eqzIInvalid input for linprog: b_eq must not contain values inf, nan, or NonezInvalid input for linprog: b_eq must be a dense, 1-D array of numerical values, each representing the right hand side of an equality constraint (row) in A_eqzKInvalid input for linprog: x0 must be a 1-D array of numerical coefficientszkInvalid input for linprog: x0 should be a 1-D array; it must not have more than one non-singleton dimensionzNInvalid input for linprog: x0 and c should contain the same number of elementszGInvalid input for linprog: x0 must not contain values inf, nan, or Noner+   zTInvalid input for linprog: unable to interpret bounds, check values and dimensions: zAInvalid input for linprog: provide a 2-D array for bounds, not a dz	-D array.)r<   r   )r   r<   z%Invalid input for linprog: provide a z! x 2 array for bounds, not a 2 x z array.zQInvalid input for linprog: unable to interpret bounds with this dimension tuple: r   )	TypeErrorr-   r/   float64r6   r7   r8   lenshaper   isfiniteallr   r   r3   datar:   r,   ndimr.   array_equalinf
atleast_2dargsflattenisnanr   )lpcr   b_ubr    b_eqboundsx0integralityr1   er2   n_ubn_eqbounds_cleanbounds_convbshbounds_flati_nones                      r$   _clean_inputsr[      s   N :<6AtT4vr;y%HQbjt444<<>> 6Q;;		"A!ff!88s17||q((AB B B {1~~!!## 	%$% % %	%  # # # !"	##& d##9s|D'9'9J%$T3:FFF z!}tz??a4:a=C#7#7)* * * L 	%r{49'='='A'A'C'C 	%|D))	%24+d2C2C2G2G2I2I	%$% % %  * * *"# #()	**"%$T** :$    
 {4  $$&& 	%$% % %	%  : : :23 3 9:	::"%$T3:FFF z!}tz??a4:a=C#7#7)* * *
 L 	%r{49'='='A'A'C'C 	%|D))	%24+d2C2C2G2G2I2I	%$% % %  * * *"# #()	**$%$T** :$    
 {4  $$&& 	%$% % %	%  8 8 801 1 78	88& 
~	1"E555==??BB 	1 	1 	1)* */01	1 7a<<BBr77a<<27a<<FG G G w!&  *+ + + {2""$$ 	%$% % % 8S!HE222L ~33~r~frd7S7S~RV	@mBHV5$A$A$ABB @ @ @,./fQi89 9>?	@  @ @ @,./fQi89 9>?	@@ 
C
3xx!||+XX*+ + +, , 	, 
Qx	 	  ("
&

 (26#-#8#8 (!))++(^QQQT(^QQQT	3x	 	  ((CR ( ('( ( () ) 	) ' #' ' '( ( 	( Xl111a4())F!vgLXl111a4())F fLatT4r;OOOs   3C 
C:%C55C:&H 
H%H  H%)J	 	
J(J##J(,N 
N+N&&N+/P 
P.P))P.4.Q# #
R-Q==R?-V- -
X7WX"X  X&.>c           
        /0 | \  }}}}}}	}
}g }d}d}t          j        |j                  }d}d}|	dddf                                         }|	dddf                                         }|j        \  }}|j        \  }}|:|                                dvr$dt          |          z   dz   }t          |          t          j        |          r8|	                                }|	                                }d	 }t          j
        }nt           j        }t           j
        }t          j        ||k               sEt          j        |t           j        k              s#t          j        |t           j         k              r"d
}d}d}t          ||||||	|
          ||||||fS t          j        t          j        |dk    d          dk                                              }t          j        |          rt          j        t          j        |t          j        |          |k                        r"d
}d}d}t          ||||||	|
          ||||||fS |t          j        |          ddf         }|t          j        |                   }t          j        t          j        |dk    d          dk                                              }t          j        |          rt          j        t          j        ||| k                         r"d
}d}d}t          ||||||	|
          ||||||fS |t          j        |          ddf         }|t          j        |                   } |||f          }|j        d         dk    rnt          j        t          j        |dk    d          dk                                              }|t          j        ||dk                        |t          j        ||dk               <   |t          j        ||dk                       |t          j        ||dk              <   t          j        t          j        |                    r"d}d}d}t          ||||||	|
          ||||||fS |t          j        ||dk                        |t          j        ||dk               <   |t          j        ||dk                       |t          j        ||dk              <   t          j        t          j        |dk    d          dk                                              } ||          d         } |||ddf                   d         }t-          |          dk    rt/          ||          D ]g\  }} ||         ||| f         z  }!||          |z
  |!cxk    r||          |z   k    s&n d
}d}d}t          ||||||	|
          ||||||fc S |!|| <   |!|| <   h|t          j        |          ddf         }|t          j        |                   }t          j        t          j        |dk    d          dk                                              } |||ddf                   d         } ||          d         }t-          |          dk    rt/          ||          D ]\  }} ||         ||| f         z  }!||| f         dk    r$|!||          |z
  k     rd}n5|!||          k     r|!|| <   n#|!||          |z   k    rd}n|!||          k    r|!|| <   |r"d
}d}t          ||||||	|
          ||||||fc S |t          j        |          ddf         }|t          j        |                   }t          j        ||z
            |k     /t          j        /          }"t          j        /          r||                    |          z
  }#||                    |          z
  }$|j        dk    rt          j        |$dk               s |j        dk    r7t          j        |#d          s"d
}d}d}t          ||||||	|
          ||||||fS |}%|}&t          j        /          r||/                             |/                   z  }||dd/f                             |/                   z
  }||dd/f                             |/                   z
  }||"         }|/         0||"         }|
|
|"         }
|dd|"f         }|dd|"f         }||"         }&||"         }%/0fd}'|                    |'           |j        dk    rM|j        dk    rAt          j        g           }t          j        g           }|j        dk    rd}d}n|t          j        t          j        |dk     |%t           j        k                        s:t          j        t          j        |dk    |&t           j         k                        rd}d}nd}d}d}|%|dk              ||dk     <   |&|dk             ||dk    <   |%|dk             }(|%|dk             t          j        |(                   |(t          j        |(          <   d|(t          j        |(          <   |(||dk    <   t          j        |&ddt           j        f         |%ddt           j        f         f          }	|j        d         })d}*t          j        |          rp|rR|j        dk    rGt?          ||          }+|+\  }}}}|j        d         |)k     rtA          |*tB          d           |dk    rd}t          ||||||	|
          ||||||fS d},|r>|j        dk    r3	 t           j"        #                    |          }-n# tH          $ r d}-Y nw xY w|r|j        dk    r|-|j        d         k     rtA          |*tB          d           |j        d         |-z
  }.|A|.|,k    rtK          ||          }+|+\  }}}}|.|,k    s|dk    rtM          ||          }+|+\  }}}}np|                                }|dk    rtK          ||          }+|+\  }}}}n>|dk    rtM          ||          }+|+\  }}}}n |dk    rtO          |||-          }+|+\  }}}}n	 |j        d         |-k     rd}d}|dk    rd}t          ||||||	|
          ||||||fS ) aM  
    Given inputs for a linear programming problem in preferred format,
    presolve the problem: identify trivial infeasibilities, redundancies,
    and unboundedness, tighten bounds where possible, and eliminate fixed
    variables.

    Parameters
    ----------
    lp : A `scipy.optimize._linprog_util._LPProblem` consisting of the following fields:

        c : 1D array
            The coefficients of the linear objective function to be minimized.
        A_ub : 2D array, optional
            The inequality constraint matrix. Each row of ``A_ub`` specifies the
            coefficients of a linear inequality constraint on ``x``.
        b_ub : 1D array, optional
            The inequality constraint vector. Each element represents an
            upper bound on the corresponding value of ``A_ub @ x``.
        A_eq : 2D array, optional
            The equality constraint matrix. Each row of ``A_eq`` specifies the
            coefficients of a linear equality constraint on ``x``.
        b_eq : 1D array, optional
            The equality constraint vector. Each element of ``A_eq @ x`` must equal
            the corresponding element of ``b_eq``.
        bounds : 2D array
            The bounds of ``x``, as ``min`` and ``max`` pairs, one for each of the N
            elements of ``x``. The N x 2 array contains lower bounds in the first
            column and upper bounds in the 2nd. Unbounded variables have lower
            bound -np.inf and/or upper bound np.inf.
        x0 : 1D array, optional
            Guess values of the decision variables, which will be refined by
            the optimization algorithm. This argument is currently used only by the
            'revised simplex' method, and can only be used if `x0` represents a
            basic feasible solution.

    rr : bool
        If ``True`` attempts to eliminate any redundant rows in ``A_eq``.
        Set False if ``A_eq`` is known to be of full row rank, or if you are
        looking for a potential speedup (at the expense of reliability).
    rr_method : string
        Method used to identify and remove redundant rows from the
        equality constraint matrix after presolve.
    tol : float
        The tolerance which determines when a solution is "close enough" to
        zero in Phase 1 to be considered a basic feasible solution or close
        enough to positive to serve as an optimal solution.

    Returns
    -------
    lp : A `scipy.optimize._linprog_util._LPProblem` consisting of the following fields:

        c : 1D array
            The coefficients of the linear objective function to be minimized.
        A_ub : 2D array, optional
            The inequality constraint matrix. Each row of ``A_ub`` specifies the
            coefficients of a linear inequality constraint on ``x``.
        b_ub : 1D array, optional
            The inequality constraint vector. Each element represents an
            upper bound on the corresponding value of ``A_ub @ x``.
        A_eq : 2D array, optional
            The equality constraint matrix. Each row of ``A_eq`` specifies the
            coefficients of a linear equality constraint on ``x``.
        b_eq : 1D array, optional
            The equality constraint vector. Each element of ``A_eq @ x`` must equal
            the corresponding element of ``b_eq``.
        bounds : 2D array
            The bounds of ``x``, as ``min`` and ``max`` pairs, possibly tightened.
        x0 : 1D array, optional
            Guess values of the decision variables, which will be refined by
            the optimization algorithm. This argument is currently used only by the
            'revised simplex' method, and can only be used if `x0` represents a
            basic feasible solution.

    c0 : 1D array
        Constant term in objective function due to fixed (and eliminated)
        variables.
    x : 1D array
        Solution vector (when the solution is trivial and can be determined
        in presolve)
    revstack: list of functions
        the functions in the list reverse the operations of _presolve()
        the function signature is x_org = f(x_mod), where x_mod is the result
        of a presolve step and x_org the value at the start of the step
        (currently, the revstack contains only one function)
    complete: bool
        Whether the solution is complete (solved or determined to be infeasible
        or unbounded in presolve)
    status : int
        An integer representing the exit status of the optimization::

         0 : Optimization terminated successfully
         1 : Iteration limit reached
         2 : Problem appears to be infeasible
         3 : Problem appears to be unbounded
         4 : Serious numerical difficulties encountered

    message : str
        A string descriptor of the exit status of the optimization.

    References
    ----------
    .. [5] Andersen, Erling D. "Finding all linearly dependent rows in
           large-scale linear programming." Optimization Methods and Software
           6.3 (1995): 219-227.
    .. [8] Andersen, Erling D., and Knud D. Andersen. "Presolving in linear
           programming." Mathematical Programming 71.2 (1995): 221-245.

    r   F Nr   >   idsvdpivot'z[' is not a valid option for redundancy removal. Valid options are 'SVD', 'pivot', and 'ID'.c                 *    |                                  S N)nonzero)r0   s    r$   wherez_presolve.<locals>.wheres  s    99;;r&   r<   zThe problem is (trivially) infeasible since one or more upper bounds are smaller than the corresponding lower bounds, a lower bound is np.inf or an upper bound is -np.inf.TaxiszThe problem is (trivially) infeasible due to a row of zeros in the equality constraint matrix with a nonzero corresponding constraint value.zThe problem is (trivially) infeasible due to a row of zeros in the equality constraint matrix with a nonzero corresponding  constraint value.   zIf feasible, the problem is (trivially) unbounded due  to a zero column in the constraint matrices. If you wish to check whether the problem is infeasible, turn presolve off.zzThe problem is (trivially) infeasible because a singleton row in the equality constraints is inconsistent with the bounds.z}The problem is (trivially) infeasible because a singleton row in the upper bound constraints is inconsistent with the bounds.zvThe problem is (trivially) infeasible because the bounds fix all variables to values inconsistent with the constraintsc                     t          j                  }t          |          }t          j        |          }||z
  }t          j        |                     t                    |          }|S rd   )r-   flatnonzeror@   arangeinsertastyper,   )x_modiNindex_offsetinsert_indicesx_revi_fx_undos         r$   revz_presolve.<locals>.rev   sZ    
 s##AAA9Q<<L-NIell511>6JJELr&   zPThe solution was determined in presolve as there are no non-trivial constraints.a  The problem is (trivially) unbounded because there are no non-trivial constraints and a) at least one decision variable is unbounded above and its corresponding cost is negative, or b) at least one decision variable is unbounded below and its corresponding cost is positive. zA_eq does not appear to be of full row rank. To improve performance, check the problem formulation for redundant equality constraints.r      r   r`   ra   r_   zDue to numerical issues, redundant equality constraints could not be removed automatically. Try providing your constraint matrices as sparse matrices to activate sparse presolve, try turning off redundancy removal, or try turning off presolve altogether.)(r-   r.   rA   r*   lowerstrr   r   r   tocsrvstackrf   anyrG   r   r/   sumrJ   logical_andabslogical_notisinfr@   ziprC   dotr7   allcloseappendhstacknewaxisr   r   r   linalgmatrix_rank	Exceptionr   r   r	   )1rL   rr	rr_methodtolrM   r   rN   r    rO   rP   rQ   _revstackc0completexstatusmessagelbubm_eqnm_ubrf   r|   zero_rowr0   zero_colsingleton_rowrowscolsrowcolvali_nfresidualslackub_modlb_modrw   x_zero_cn_rows_Aredundancy_warningrr_ressmall_nullspacerankdim_row_nullspaceru   rv   s1                                                  @@r$   	_presolver     sG   r 02,AtT4vr1H	
BH
AFG 
1				B	1				BjGD!jGD!!!)???Y' +( ( !!!
|D 
zz||zz||	 	 	  
vb2g <"&rv.. <"&w2G2G <! 1dD$fbAAAx67< 	< xtqyq111Q677??AAH	vh 26Nts"$ $% % 	2
 FAG Hq$dD&"EE8Xvw@ @ x00!!!34Dx001D xtqyq111Q677??AAH	vh 26".43$;7788 	2FBG Hq$dD&"EE8Xvw@ @ x00!!!34Dx001D 	d|AwqzA~~8BF16222a788@@BB-/N8QU++.-".1q5
)
)*-/N8QU++.-".1q5
)
)*6"(1++ 	@F,G Hq$dD&"EE8Xvw@ @ /1N8QU++/-2>(AE**+.0N8QU++/-2>(AE**+
 HRVDAIA666!;<<DDFFM5"D5dAAAg"D
4yy1}}D$ 	 	HCs)d38n,Cc7S=C88882c7S=8888;  "1dD$fbIIAx67D D D D
 33BN=1111145BN=112 HRVDAIA666!;<<DDFFM5mQQQ&'((+D5"D
4yy1}}D$ 	D 	DHCs)d38n,CCH~!!C3&&#HH2c7]]!BsGC3&&#HH2c7]]!BsG D; #1dD$fbIIAx67D D D DD BN=1111145BN=112 &b//C
C>#D 
vc{{ @$((2,,&txx||#Y]]rveai00]Qr{8Q'?'?F)G Hq$dD&"EE8Xvw@ @ FF	vc{{ 
afjjC!!!d111c6l&&r#w///d111c6l&&r#w///dGCdG>DBAAAtG}AAAtG}DD	 	 	 	 	 	 	 yA~~$)q..x||x||6Q;;F5GGfR^AE6RV+;<<== 	6fR^AE6bfW+<==>>	6
 FBGG F5G!a%=!a%!a%=!a%!q&>'-a1f~bhx6H6H'I(##$'((##$!q&	
 Yqqq"*}-vaaam/DEFFF z!}H@ 	T 	< 	 $)a--4T4@@F*0'D$z!}x'''QGGGG{{1dD$fbAAAx67< 	<
 O	 di!mm	9((..DD 	 	 	DDD		 !di!mmtz!} 4 4Q???? JqM$. O33/d;;.4+dFG ?22fkk7dCC.4+dFG "))IE!!/d;;.4+dFGGg%%7dCC.4+dFGGd"".tT4@@.4+dFGG:a=4%G FQ;;Hq$dD&"==8Xvw8 8s   n% %n43n4c                     |i }d |                                 D             }t          ||| j        | j                  \  }}}t	          |                     ||                    } | |fS )a  
    Parse the provided linear programming problem

    ``_parse_linprog`` employs two main steps ``_check_sparse_inputs`` and
    ``_clean_inputs``. ``_check_sparse_inputs`` checks for sparsity in the
    provided constraints (``A_ub`` and ``A_eq) and if these match the provided
    sparsity optional values.

    ``_clean inputs`` checks of the provided inputs. If no violations are
    identified the objective vector, upper bound constraints, equality
    constraints, and simple bounds are returned in the expected format.

    Parameters
    ----------
    lp : A `scipy.optimize._linprog_util._LPProblem` consisting of the following fields:

        c : 1D array
            The coefficients of the linear objective function to be minimized.
        A_ub : 2D array, optional
            The inequality constraint matrix. Each row of ``A_ub`` specifies the
            coefficients of a linear inequality constraint on ``x``.
        b_ub : 1D array, optional
            The inequality constraint vector. Each element represents an
            upper bound on the corresponding value of ``A_ub @ x``.
        A_eq : 2D array, optional
            The equality constraint matrix. Each row of ``A_eq`` specifies the
            coefficients of a linear equality constraint on ``x``.
        b_eq : 1D array, optional
            The equality constraint vector. Each element of ``A_eq @ x`` must equal
            the corresponding element of ``b_eq``.
        bounds : various valid formats, optional
            The bounds of ``x``, as ``min`` and ``max`` pairs.
            If bounds are specified for all N variables separately, valid formats are:
            * a 2D array (2 x N or N x 2);
            * a sequence of N sequences, each with 2 values.
            If all variables have the same bounds, a single pair of values can
            be specified. Valid formats are:
            * a sequence with 2 scalar values;
            * a sequence with a single element containing 2 scalar values.
            If all variables have a lower bound of 0 and no upper bound, the bounds
            parameter can be omitted (or given as None).
        x0 : 1D array, optional
            Guess values of the decision variables, which will be refined by
            the optimization algorithm. This argument is currently used only by the
            'revised simplex' method, and can only be used if `x0` represents a
            basic feasible solution.

    options : dict
        A dictionary of solver options. All methods accept the following
        generic options:

            maxiter : int
                Maximum number of iterations to perform.
            disp : bool
                Set to True to print convergence messages.

        For method-specific options, see :func:`show_options('linprog')`.

    Returns
    -------
    lp : A `scipy.optimize._linprog_util._LPProblem` consisting of the following fields:

        c : 1D array
            The coefficients of the linear objective function to be minimized.
        A_ub : 2D array, optional
            The inequality constraint matrix. Each row of ``A_ub`` specifies the
            coefficients of a linear inequality constraint on ``x``.
        b_ub : 1D array, optional
            The inequality constraint vector. Each element represents an
            upper bound on the corresponding value of ``A_ub @ x``.
        A_eq : 2D array, optional
            The equality constraint matrix. Each row of ``A_eq`` specifies the
            coefficients of a linear equality constraint on ``x``.
        b_eq : 1D array, optional
            The equality constraint vector. Each element of ``A_eq @ x`` must equal
            the corresponding element of ``b_eq``.
        bounds : 2D array
            The bounds of ``x``, as ``min`` and ``max`` pairs, one for each of the N
            elements of ``x``. The N x 2 array contains lower bounds in the first
            column and upper bounds in the 2nd. Unbounded variables have lower
            bound -np.inf and/or upper bound np.inf.
        x0 : 1D array, optional
            Guess values of the decision variables, which will be refined by
            the optimization algorithm. This argument is currently used only by the
            'revised simplex' method, and can only be used if `x0` represents a
            basic feasible solution.

    options : dict, optional
        A dictionary of solver options. All methods accept the following
        generic options:

            maxiter : int
                Maximum number of iterations to perform.
            disp : bool
                Set to True to print convergence messages.

        For method-specific options, see :func:`show_options('linprog')`.

    Nc                     i | ]\  }}||	S  r   ).0kvs      r$   
<dictcomp>z"_parse_linprog.<locals>.<dictcomp>  s    777tq!a777r&   )r   r    )itemsr%   r   r    r[   _replace)rL   r   r   solver_optionsr   r    s         r$   _parse_linprogr     sy    H 77w}}777N!5nd68grw"H "HND$ 
r{{4{88	9	9B~r&   c                    | \  }}}}}}}}	t          j        |          rId}
t          j        |          }t          j        |          }d }d }t           j        }t           j        }n2d}
t          j        }t          j        }t          j        }t          j        }t	          j        |d          }|dddf         }|dddf         }|j	        \  }}t	          j
        |t          j                   }t	          j
        |t          j                  }t	          j        |          }t	          j        |          }t	          j        ||          }t	          j        |          d         }||          ||          c||<   ||<   t	          j
        |t          j                   }t	          j
        |t          j                  }t	          j        |          }t	          j        |          }||xx         d	z  cc<   |||xx         d	z  cc<   t          |          dk    rJ|j	        d         dk    r|dd|fxx         d	z  cc<   |j	        d         dk    r|dd|fxx         d	z  cc<   |                                \  }||         }t          |          }|dk    r||j	        d         f}|
rLt	          j        |          |f} ||t          j        t	          j        |          |f|
          f          }nD ||t	          j        |          f          }d|t	          j        ||j	        d                   |f<   t	          j        |t	          j        |          f          }|||d<    |||f          }t	          j        ||f          }t	          j        |t	          j        |j	        d         f          f          }|4t	          j        |t	          j        |j	        d         f          f          }t	          j        ||          } t	          j        |           d         }!t          |!          }"t	          j        |t	          j        |"          f          }|(t	          j        |t	          j        |"          f          } ||ddd|f         |dd|!f          f          }||!          ||||"z   <   |M||!         dk     }#||!|#                   |t	          j        ||j	        d                   |#         <   d||!|#         <    | ||j	        d                    ||j	        d         |j	        d         f          g          }$ |||$g          }%t	          j        |          d         }&||                             t(                    }'|t	          j        |'||&         z            z  }|
rw|                    d	d          }|%                                }%||%dd|&f         t          j        |'          z                      d          z  }|                                }n&||%dd|&f         |'z                      d          z  }|||&xx         |'z  cc<   |%||||fS )a  
    Given a linear programming problem of the form:

    Minimize::

        c @ x

    Subject to::

        A_ub @ x <= b_ub
        A_eq @ x == b_eq
         lb <= x <= ub

    where ``lb = 0`` and ``ub = None`` unless set in ``bounds``.

    Return the problem in standard form:

    Minimize::

        c @ x

    Subject to::

        A @ x == b
            x >= 0

    by adding slack variables and making variable substitutions as necessary.

    Parameters
    ----------
    lp : A `scipy.optimize._linprog_util._LPProblem` consisting of the following fields:

        c : 1D array
            The coefficients of the linear objective function to be minimized.
        A_ub : 2D array, optional
            The inequality constraint matrix. Each row of ``A_ub`` specifies the
            coefficients of a linear inequality constraint on ``x``.
        b_ub : 1D array, optional
            The inequality constraint vector. Each element represents an
            upper bound on the corresponding value of ``A_ub @ x``.
        A_eq : 2D array, optional
            The equality constraint matrix. Each row of ``A_eq`` specifies the
            coefficients of a linear equality constraint on ``x``.
        b_eq : 1D array, optional
            The equality constraint vector. Each element of ``A_eq @ x`` must equal
            the corresponding element of ``b_eq``.
        bounds : 2D array
            The bounds of ``x``, lower bounds in the 1st column, upper
            bounds in the 2nd column. The bounds are possibly tightened
            by the presolve procedure.
        x0 : 1D array, optional
            Guess values of the decision variables, which will be refined by
            the optimization algorithm. This argument is currently used only by the
            'revised simplex' method, and can only be used if `x0` represents a
            basic feasible solution.

    c0 : float
        Constant term in objective function due to fixed (and eliminated)
        variables.

    Returns
    -------
    A : 2-D array
        2-D array such that ``A`` @ ``x``, gives the values of the equality
        constraints at ``x``.
    b : 1-D array
        1-D array of values representing the RHS of each equality constraint
        (row) in A (for standard form problem).
    c : 1-D array
        Coefficients of the linear objective function to be minimized (for
        standard form problem).
    c0 : float
        Constant term in objective function due to fixed (and eliminated)
        variables.
    x0 : 1-D array
        Starting values of the independent variables, which will be refined by
        the optimization algorithm

    References
    ----------
    .. [9] Bertsimas, Dimitris, and J. Tsitsiklis. "Introduction to linear
           programming." Athena Scientific 1 (1997): 997.

    Tc                 .    t          j        | d          S Ncsr)format)r   r   blockss    r$   r   z_get_Abc.<locals>.hstackb      :fU3333r&   c                 .    t          j        | d          S r   )r   r|   r   s    r$   r|   z_get_Abc.<locals>.vstacke  r   r&   F)r*   Nr   r   r5   )rA   rg   )r   r   
csr_matrixeyer-   r   r|   r.   r/   rA   equalrG   r   r   re   r@   rl   onesconcatenatern   r,   r~   r8   tocscdiagsravel)(rL   r   rM   r   rN   r    rO   rP   rQ   rR   r   r   r|   r.   r   lbsubsr   rT   lb_noneub_nonelb_someub_somel_nolb_someubi_nolbi_newubub_newubn_boundsrA   idxsA1r9   l_freei_freen_free
i_free_negA2r0   i_shiftlb_shifts(                                           r$   _get_Abcr     sK   j :<6AtT4vr;
|D ~d##~d##	4 	4 	4	4 	4 	4 gf Xf4(((F A,C
A,CJD$hsRVG$$GhsBF##GnW%%GnW%%G N7G44MZ&&q)F	]	c-00 +CM*hsRVG$$GhsBF##GnW%%GnW%%GfIIIOIII	~
6


b



6{{Q:a=1FOOOr!OOO:a=1FOOOr!OOO   HG7|H7||H!||4:a=) 	>Ih''1D641B1BD0I6;"= "= "= > ? ?DD 64%122D<=D4A//89~tRXh%7%7899TUU	t		B
d|$$A
28TZ]$455677A	~^R4:a=*:!;!;<==^GW--FZ"F[[F
28F++,--A	~^R&!1!1233	AAAuuH111f9~.	/	/BV9*Ad4;	~Z!^
8:6*;M8N7N29T28A;''
34!"6* 
TZ]##UUDJqM4:a=+I%J%JK	L	LBBxA j!!!$G7|""5))H"&AgJ&
'
''B 4IIb!GGII	a7
mci11166A6>>>GGII	a7
mh&+++333	~
7xaB?r&   c                 T    dt          j        t          j        |                     z  S )zB
    Round elements of the array to the nearest power of two.
    r<   )r-   aroundlog2)r   s    r$   _round_to_power_of_twor     s!     bi

####r&   c                    | j         \  }}d}d}| j        dk    rxt          j        t          j        |           d          }t          j        |           r&|                                                                }d||dk    <   dt          |          z  }t          j        |           rt          j
        |          | z  n| |                    |d          z  } ||z  }t          j        t          j        |           d          }t          j        |           r&|                                                                }d||dk    <   dt          |          z  }t          j        |           r| t          j
        |          z  n| |z  } ||z  }|j        dk    r&t          j        t          j        |                    nd}|dk    rd}||z  }|||z  d|z  z  }| |||||fS )z
    Scales the problem according to equilibration from [12].
    Also normalizes the right hand side vector by its maximum element.
    r   r   rg   g      ?)rA   r7   r-   maxr   r   r   toarrayrJ   r   r   r8   )	r0   r9   rM   rQ   mr   CRb_scales	            r$   
_autoscaler     s   
 7DAq	A	AvzzF26!991%%%<?? 	&		##%%A!q&	$Q'''!l1ooDCIaLLNN1QYYq!__3DaCF26!991%%%<?? 	&		##%%A!q&	$Q'''!l1oo6AcillNN1Q3aC#$6A::bfRVAYY1G!||	'	A	~Z1aB7""r&   c                     	 t          |          }n# t          $ r t          |           }Y nw xY w| d|         |z  |z  S )zR
    Converts solution to _autoscale problem -> solution to original problem.
    N)r@   r>   )r   r   r   r   s       r$   _unscaler     sX    
FF    FF RaR5=?s    ..c                 x    t          |            |dv rt          d|d           t          d|d           dS )a  
    Print the termination summary of the linear program

    Parameters
    ----------
    message : str
            A string descriptor of the exit status of the optimization.
    status : int
        An integer representing the exit status of the optimization::

                0 : Optimization terminated successfully
                1 : Iteration limit reached
                2 : Problem appears to be infeasible
                3 : Problem appears to be unbounded
                4 : Serious numerical difficulties encountered

    fun : float
        Value of the objective function.
    iteration : iteration
        The number of iterations performed.
    )r   r   z!         Current function value: z <12.6fz         Iterations: r=   N)print)r   r   fun	iterations       r$   _display_summaryr     sT    , 
'NNN?#???@@@	
/)
/
/
/00000r&   c                    |d         \  }}}}}}}	}
|dd         \  }}}t          | ||          } |j        d         }|s|d}t          |          D ]\  }}|d         }|d         }|t          j         k    r0|t          j        k    r |dz  }| |         | ||z   dz
           z
  | |<   V|t          j         k    r|| |         z
  | |<   v| |xx         |z  cc<   | d|         } t          |          D ]} ||           } |                     |          }t          j        d          5  ||                    |           z
  }||                    |           z
  }ddd           n# 1 swxY w Y   | |||fS )a
  
    Given solution x to presolved, standard form linear program x, add
    fixed variables back into the problem and undo the variable substitutions
    to get solution to original linear program. Also, calculate the objective
    function value, slack in original upper bound constraints, and residuals
    in original equality constraints.

    Parameters
    ----------
    x : 1-D array
        Solution vector to the standard-form problem.
    postsolve_args : tuple
        Data needed by _postsolve to convert the solution to the standard-form
        problem into the solution to the original problem, including:

    lp : A `scipy.optimize._linprog_util._LPProblem` consisting of the following fields:

        c : 1D array
            The coefficients of the linear objective function to be minimized.
        A_ub : 2D array, optional
            The inequality constraint matrix. Each row of ``A_ub`` specifies the
            coefficients of a linear inequality constraint on ``x``.
        b_ub : 1D array, optional
            The inequality constraint vector. Each element represents an
            upper bound on the corresponding value of ``A_ub @ x``.
        A_eq : 2D array, optional
            The equality constraint matrix. Each row of ``A_eq`` specifies the
            coefficients of a linear equality constraint on ``x``.
        b_eq : 1D array, optional
            The equality constraint vector. Each element of ``A_eq @ x`` must equal
            the corresponding element of ``b_eq``.
        bounds : 2D array
            The bounds of ``x``, lower bounds in the 1st column, upper
            bounds in the 2nd column. The bounds are possibly tightened
            by the presolve procedure.
        x0 : 1D array, optional
            Guess values of the decision variables, which will be refined by
            the optimization algorithm. This argument is currently used only by the
            'revised simplex' method, and can only be used if `x0` represents a
            basic feasible solution.

    revstack: list of functions
        the functions in the list reverse the operations of _presolve()
        the function signature is x_org = f(x_mod), where x_mod is the result
        of a presolve step and x_org the value at the start of the step
    complete : bool
        Whether the solution is was determined in presolve (``True`` if so)

    Returns
    -------
    x : 1-D array
        Solution vector to original linear programming problem
    fun: float
        optimal objective value for original problem
    slack : 1-D array
        The (non-negative) slack in the upper bound constraints, that is,
        ``b_ub - A_ub @ x``
    con : 1-D array
        The (nominally zero) residuals of the equality constraints, that is,
        ``b - A_eq @ x``
    r   r   Nignore)invalid)r   rA   	enumerater-   rG   reversedr   errstate)r   postsolve_argsr   rM   r   rN   r    rO   rP   rQ   rR   r   r   r   r1   n_unboundedrp   bilbiubirw   r   r   cons                           r$   
_postsolver   $  s   B :H9J6AtT4vr;)!""-HaAwA ,q/C  *v&& 
	  
	 EArQ%CQ%Crvg~~#--q tak 1A 566!26'>>1:AaDDaDDDCKDDDD	$3$A
 !!  CFF
%%((C	X	&	&	& ! !txx{{"TXXa[[ ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
 c5#s   +1E((E,/E,c	                    t          j        |          dz  }| |dk    rd}d}||fS t          j        |                                           p_t          j        |          pKt          j        |                                          p%t          j        |                                          }	|	rd}
n|d}| |dddf         |z
  k    | |dddf         |z   k    z  }||dk    t          j        | d|          z  z  }t          j        |           }|d	k    o|| k                                     }|d	k    o)t          j        |          |k                                    }|p|p| }
|dk    r|
sd}d
|dz   dz   }n|dk    r|
rd}d}||fS )a  
    Check the validity of the provided solution.

    A valid (optimal) solution satisfies all bounds, all slack variables are
    negative and all equality constraint residuals are strictly non-zero.
    Further, the lower-bounds, upper-bounds, slack and residuals contain
    no nan values.

    Parameters
    ----------
    x : 1-D array
        Solution vector to original linear programming problem
    fun: float
        optimal objective value for original problem
    status : int
        An integer representing the exit status of the optimization::

             0 : Optimization terminated successfully
             1 : Iteration limit reached
             2 : Problem appears to be infeasible
             3 : Problem appears to be unbounded
             4 : Serious numerical difficulties encountered

    slack : 1-D array
        The (non-negative) slack in the upper bound constraints, that is,
        ``b_ub - A_ub @ x``
    con : 1-D array
        The (nominally zero) residuals of the equality constraints, that is,
        ``b - A_eq @ x``
    bounds : 2D array
        The bounds on the original variables ``x``
    message : str
        A string descriptor of the exit status of the optimization.
    tol : float
        Termination tolerance; see [1]_ Section 4.5.

    Returns
    -------
    status : int
        An integer representing the exit status of the optimization::

             0 : Optimization terminated successfully
             1 : Iteration limit reached
             2 : Problem appears to be infeasible
             3 : Problem appears to be unbounded
             4 : Serious numerical difficulties encountered

    message : str
        A string descriptor of the exit status of the optimization.
    
   Nr   r   z^The solver did not provide a solution nor did it report a failure. Please submit a bug report.Fr   )atolri   zOThe solution does not satisfy the constraints within the required tolerance of z.2Ea,  , yet no errors were raised and there is no certificate of infeasibility or unboundedness. Check whether the slack and constraint residuals are acceptable; if not, consider enabling presolve, adjusting the tolerance option(s), and/or using a different method. Please consider submitting a bug report.r<   zuThe solution is feasible, but the solver did not report that the solution was optimal. Please try a different method.)r-   sqrtrK   r}   iscloserC   r   )r   r   r   r   r   rP   r   r   rR   contains_nansis_feasiblevalid_boundsinvalid_boundsinvalid_slackinvalid_cons                  r$   _check_resultr    s   j '#,,
CyQ;;FGGw 	 	8C==	8E??  	 8C==	   KKVAAAqD\C//A19K4KLqBJq!#,F,F,FFFVL111!<#(:(:(<(<k?rvc{{S'8&=&=&?&?)I]IkJ{{;{,14ll;>>> 
1  7?r&   )F)r\   )!__doc__numpyr-   scipy.sparser   r   warningsr   	_optimizer   !scipy.optimize._remove_redundancyr   r   r   r	   collectionsr
   r   __new____defaults__r%   r3   r:   r[   r   r   r   r   r   r   r   r   r  r   r&   r$   <module>r     s                    & & & & & &            # " " " " "ZEG G
"-
  E  RB B BJ3 3 3 3>/ / /,EP EP EPPw8 w8 w8 w8tl l l^C C CL$ $ $## ## ##L  1 1 18e e e ePg g g g gr&   