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_infeasible_initial(self):
      # Check SLSQP behavior with infeasible initial point
      def f(x):
          (x,) = x
          return x * x - 2 * x + 1
  
      cons_u = [{"type": "ineq", "fun": lambda x: 0 - x}]
      cons_l = [{"type": "ineq", "fun": lambda x: x - 2}]
      cons_ul = [
          {"type": "ineq", "fun": lambda x: 0 - x},
          {"type": "ineq", "fun": lambda x: x + 1},
      ]
  
      sol = minimize(f, [10], method="slsqp", constraints=cons_u)
      assert_(sol.success)
      assert_allclose(sol.x, 0, atol=1e-10)
  
      sol = minimize(f, [-10], method="slsqp", constraints=cons_l)
      assert_(sol.success)
      assert_allclose(sol.x, 2, atol=1e-10)
  
      sol = minimize(f, [-10], method="slsqp", constraints=cons_u)
      assert_(sol.success)
      assert_allclose(sol.x, 0, atol=1e-10)
  
      sol = minimize(f, [10], method="slsqp", constraints=cons_l)
      assert_(sol.success)
      assert_allclose(sol.x, 2, atol=1e-10)
  
      sol = minimize(f, [-0.5], method="slsqp", constraints=cons_ul)
      assert_(sol.success)
      assert_allclose(sol.x, 0, atol=1e-10)
  
      sol = minimize(f, [10], method="slsqp", constraints=cons_ul)
      assert_(sol.success)
      assert_allclose(sol.x, 0, atol=1e-10)
  
imports: from __future__ import division, print_function, absolute_import
  import pytest
  from numpy.testing import assert_, assert_array_almost_equal, assert_allclose, assert_equal
  from pytest import raises
  import numpy
  from scipy.optimize import fmin_slsqp, minimize, NonlinearConstraint, Bounds
label_desc: Use image node_id 41 for calling the TestSLSQP obj's underlying member method code with example usage: obj.test_infeasible_initial() and returns: unknown