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","."]
docstr: Arguments:
  d     - A list of two elements, where d[0] represents x and d[1] represents y
           in the following equation.
  sign - A multiplier for f. Since we want to optimize it, and the SciPy
         optimizers can only minimize functions, we need to multiply it by
         -1 to achieve the desired solution
  Returns:
  2*x*y + 2*x - x**2 - 2*y**2
docstr_tok: ["Arguments",":","d","-","A","list","of","two","elements",",","where","d","[","0","]","represents","x","and","d","[","1","]","represents","y","in","the","following","equation",".","sign","-","A","multiplier","for","f.","Since","we","want","to","optimize","it",",","and","the","SciPy","optimizers","can","only","minimize","functions",",","we","need","to","multiply","it","by","-1","to","achieve","the","desired","solution","Returns",":","2","*","x","*","y","+","2","*","x","-","x","*","*","2","-","2","*","y","*","*","2"]
code: def fun(self, d, sign=1.0):
      """
      Arguments:
      d     - A list of two elements, where d[0] represents x and d[1] represents y
               in the following equation.
      sign - A multiplier for f. Since we want to optimize it, and the SciPy
             optimizers can only minimize functions, we need to multiply it by
             -1 to achieve the desired solution
      Returns:
      2*x*y + 2*x - x**2 - 2*y**2
  
      """
      x = d[0]
      y = d[1]
      return sign * (2 * x * y + 2 * x - x**2 - 2 * y**2)
  
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 2 for calling the TestSLSQP obj's underlying member method code with example usage: obj.fun(d, sign) and returns: unknown