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_gh1758(self):
      # the test suggested in gh1758
      # https://nlopt.readthedocs.io/en/latest/NLopt_Tutorial/
      # implement two equality constraints, in R^2.
      def fun(x):
          return np.sqrt(x[1])
  
      def f_eqcon(x):
          """Equality constraint"""
          return x[1] - (2 * x[0]) ** 3
  
      def f_eqcon2(x):
          """Equality constraint"""
          return x[1] - (-x[0] + 1) ** 3
  
      c1 = {"type": "eq", "fun": f_eqcon}
      c2 = {"type": "eq", "fun": f_eqcon2}
  
      res = minimize(
          fun,
          [8, 0.25],
          method="SLSQP",
          constraints=[c1, c2],
          bounds=[(-0.5, 1), (0, 8)],
      )
  
      np.testing.assert_allclose(res.fun, 0.5443310539518)
      np.testing.assert_allclose(res.x, [0.33333333, 0.2962963])
      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 47 for calling the TestSLSQP obj's underlying member method code with example usage: obj.test_gh1758() and returns: np, unknown, unknown