class_docstr: Test SLSQP algorithm using Example 14.4 from Numerical Methods for
  Engineers by Steven Chapra and Raymond Canale.
  This example maximizes the function f(x) = 2*x*y + 2*x - x**2 - 2*y**2,
  which has a maximum at x=2, y=1.
class_docstr_tok: ["Test","SLSQP","algorithm","using","Example","14.4","from","Numerical","Methods","for","Engineers","by","Steven","Chapra","and","Raymond","Canale",".","This","example","maximizes","the","function","f","(","x",")","=","2","*","x","*","y","+","2","*","x","-","x","*","*","2","-","2","*","y","*","*","2",",","which","has","a","maximum","at","x=2",",","y=1","."]
code: def test_parameters_stay_within_bounds(self):
      # gh11403. For some problems the SLSQP Fortran code suggests a step
      # outside one of the lower/upper bounds. When this happens
      # approx_derivative complains because it's being asked to evaluate
      # a gradient outside its domain.
      np.random.seed(1)
      bounds = Bounds(np.array([0.1]), np.array([1.0]))
      n_inputs = len(bounds.lb)
      x0 = np.array(
          bounds.lb
          + (bounds.ub - bounds.lb) * np.random.random(n_inputs)
      )
  
      def f(x):
          assert (x >= bounds.lb).all()
          return np.linalg.norm(x)
  
      with pytest.warns(RuntimeWarning, match="x were outside bounds"):
          res = minimize(f, x0, method="SLSQP", bounds=bounds)
          assert res.success
  
imports: from numpy.testing import assert_, assert_array_almost_equal, assert_allclose, assert_equal
  from pytest import raises
  import pytest
  import numpy
  from scipy.optimize import fmin_slsqp, minimize, Bounds, NonlinearConstraint
label_desc: Use image node_id 49 for calling the TestSLSQP obj's underlying member method code with example usage: obj.test_parameters_stay_within_bounds() and returns: np