# `optimize.tests.test_slsqp`¶

Unit test for SLSQP optimization.

## Module Contents¶

### Classes¶

 `MyCallBack`(self) pass a custom callback function `TestSLSQP`() Test SLSQP algorithm using Example 14.4 from Numerical Methods for
class `MyCallBack`

pass a custom callback function

This makes sure it’s being used.

`__init__`()
`__call__`(x)
class `TestSLSQP`

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.

`setup_method`()
`fun`(d, sign=1.0)

Arguments: d - A list of two elements, where d represents x and d 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

`jac`(d, sign=1.0)

This is the derivative of fun, returning a numpy array representing df/dx and df/dy.

`fun_and_jac`(d, sign=1.0)
`f_eqcon`(x, sign=1.0)

Equality constraint

`fprime_eqcon`(x, sign=1.0)

Equality constraint, derivative

`f_eqcon_scalar`(x, sign=1.0)

Scalar equality constraint

`fprime_eqcon_scalar`(x, sign=1.0)

Scalar equality constraint, derivative

`f_ieqcon`(x, sign=1.0)

Inequality constraint

`fprime_ieqcon`(x, sign=1.0)

Inequality constraint, derivative

`f_ieqcon2`(x)

Vector inequality constraint

`fprime_ieqcon2`(x)

Vector inequality constraint, derivative

`test_minimize_unbounded_approximated`()
`test_minimize_unbounded_given`()
`test_minimize_bounded_approximated`()
`test_minimize_unbounded_combined`()
`test_minimize_equality_approximated`()
`test_minimize_equality_given`()
`test_minimize_equality_given2`()
`test_minimize_equality_given_cons_scalar`()
`test_minimize_inequality_given`()
`test_minimize_inequality_given_vector_constraints`()
`test_minimize_bound_equality_given2`()
`test_unbounded_approximated`()
`test_unbounded_given`()
`test_equality_approximated`()
`test_equality_given`()
`test_equality_given2`()
`test_inequality_given`()
`test_bound_equality_given2`()
`test_scalar_constraints`()
`test_integer_bounds`()
`test_obj_must_return_scalar`()
`test_obj_returns_scalar_in_list`()
`test_callback`()
`test_inconsistent_linearization`()
`test_regression_5743`()
`test_gh_6676`()
`test_invalid_bounds`()
`test_bounds_clipping`()
`test_infeasible_initial`()