# FMIN_SLSQP

Utility/Data Access SubroutineSLSQP optimizer is a sequential least squares programming algorithm for nonlinear, constrained gradient-based optimization. It supports both inequality and equality constraints.

## Definition

This function is also documented in Scipy at scipy.optimize.fmin_slsqp.

## Use

The utility can be called by any user-defined subroutine written in Python.

## Format

`fmin_slsqp(func, x0, eqcons=[], f_eqcons=None, ieqcons=[], f_ieqcons=None, bounds=[], fprime=None, fprime_eqcons=None, fprime_ieqcons=None, args=(), iter=100, acc=1e-06, iprint=1, disp=None, full_output=0, epsilon=1.4901161193847656e-08)`

## Attributes

`func`- A function that can be called by Python that evaluates the objective function that is to be minimized.
`X0`- The initial guess for the independent variables.
`eqcons`- A list of functions of length N that specify all the equality constraints that FMIN_SLSQP must maintain. In a successfully optimized problem, FMIN_SLSQP will ensure that eqcons[i](x,*args) == 0, i=1…M, where M=len(eqcons)
`f_eqcons``f_eqcons`is a function that can be called by Python. This function returns a 1-D array of floats that must equal 0.0 in a successfully optimized problem.`f_eqcons`has the form: f(x, *args)`ieqcons`- A list of functions of length N that specify all the inequality constraints that FMIN_SLSQP must satisfy. In a successfully optimized problem, FMIN_SLSQP will ensure that ieqcons[i](x,*args) >= 0, i=1…M', where M'=len(ieqcons)
`f_ieqcons``f_ieqcons`is a function that can be called by Python. This function returns a 1-D array of floats that must be greater than or equal 0.0 in a successfully optimized problem.`bounds`- A list of types specifying the lower and upper bound for each independent variable. It has the
form: [ (xl
_{0},xu_{0}), (xl_{1},xu_{1}), ... (xl_{N},xu_{N})] `fprime`- A function that evaluates the partial derivatives of
`func`with respect to the independent variables. `fprime_eqcons`- A function that can be called by Python. This function returns the Jacobian matrix of the equality constraints in an M x N array of floats.
`fprime_ieqcons`- A function that can be called by Python. This function returns the Jacobian matrix of the equality constraints in an M' x N array of floats.
`args`- These are the additional arguments that are passed to
`func`,`fprime`,`fprime_eqcons`and`fprime_ieqcons`. `iter`- This specifies the maximum number of iterations available to FMIN_SLSQP to obtain a minimum.
`acc`- This is the accuracy to which a solution is desired.
`iprint`- This defines the verbosity of the diagnostics generated by FMIN_SLSQP.
`iprint`<= 0 : Silent operation.`iprint`== 1 : Print summary upon completion (default).`iprint`>= 2 : Print status of each iteration and summary.

`disp`- This defines the verbosity of the diagnostics generated by FMIN_SLSQP. When
specified,
`disp`overrides the`iprint`interface. `full_output`- If
`false`, it returns only the minimizer of`func`(default). Otherwise, it returns the output final objective function and summary information. `epsilon`- The step size for finite-difference derivative estimates.

## Output

- out
- The final minimizer of func.
- fx
- If
`full_output`is true, fx will contain the final value of the objective function. - its
- If
`full_output`is true, this will contain the number of iterations taken. - imode
- If
`full_output`is true, this will contain the exit mode from the optimizer. The values of`imode`have the following significance:- -1
- Gradient evaluation required.
- 0
- Optimization terminated successfully.
- 1
- Function evaluation required.
- 2
- More equality constraints than independent variables.
- 3
- More than 3*n iterations in LSQ subproblem.
- 4
- Inequality constraints incompatible.
- 5
- Singular matrix E in LSQ subproblem.
- 6
- Singular matrix C in LSQ subproblem.
- 7
- Rank-deficient equality constraint subproblem HFTI.
- 8
- Positive directional derivative for linesearch.
- 9
- Iteration limit exceeded.

`smode`- If
`full_output`is true, this will contain a message describing the exit mode from the optimizer.

## Comments

- FMIN_SLSQP is the interface function for the SLSQP optimization function originally implemented by Dieter Kraft. SLSQP is a Sequential, Least SQuares Programming algorithm.
- Optimization can be done in MotionSolve through the use of a CONSUB user subroutine together with FMIN_SLSQP. This can be used for model identification or mechanism optimization. The CONSUB may be written in Fortran/C/C++ or Python/MATLAB scripts.