code: def find_active_constraints(x, lb, ub, rtol=1e-10):
      """Determine which constraints are active in a given point.
  
      The threshold is computed using `rtol` and the absolute value of the
      closest bound.
  
      Returns
      -------
      active : ndarray of int with shape of x
          Each component shows whether the corresponding constraint is active:
  
               *  0 - a constraint is not active.
               * -1 - a lower bound is active.
               *  1 - a upper bound is active.
      """
      active = np.zeros_like(x, dtype=int)
  
      if rtol == 0:
          active[x <= lb] = -1
          active[x >= ub] = 1
          return active
  
      lower_dist = x - lb
      upper_dist = ub - x
  
      lower_threshold = rtol * np.maximum(1, np.abs(lb))
      upper_threshold = rtol * np.maximum(1, np.abs(ub))
  
      lower_active = np.isfinite(lb) & (
          lower_dist <= np.minimum(upper_dist, lower_threshold)
      )
      active[lower_active] = -1
  
      upper_active = np.isfinite(ub) & (
          upper_dist <= np.minimum(lower_dist, upper_threshold)
      )
      active[upper_active] = 1
  
      return active
  
imports: from __future__ import division, print_function, absolute_import
  from math import copysign
  import numpy
  from numpy.linalg import norm
  from scipy.linalg import cho_factor, cho_solve, LinAlgError
  from scipy.sparse import issparse
  from scipy.sparse.linalg import LinearOperator, aslinearoperator
label_desc: Use image node_id 10 for calling a global function with example usage: find_active_constraints(x, lb, ub, rtol) and returns: active, active