# Models

The following is a list of packages implement the NLPModels API.

If you want your package listed here, open a Pull Request.

If you want to create your own interface, check these Guidelines.

## Packages

- NLPModelsModifiers.jl: Models that modify existing models. For instance, creating slack variables, or moving constraints into the objective functions, or using Quasi-Newton LBFSG approximations to the Hessian.
- ADNLPModels.jl: Models with automatic differentiation. It has a very simple interface, although it isn't very efficient for larger problems.
- CUTEst.jl: For problems from CUTEst.
- AmplNLReader.jl: For problems modeled using AMPL
- NLPModelsJuMP.jl: For problems modeled using JuMP.jl.
- QuadraticModels.jl: For problems with quadratic and linear structure.
- LLSModels.jl: Creates a linear least squares model.
- PDENLPModels.jl: For PDE-constrained problems.

## Model internals

`NLPModels.AbstractNLPModel`

— Type`AbstractNLPModel`

Base type for an optimization model.

`NLPModels.AbstractNLSModel`

— Type`AbstractNLSModel <: AbstractNLPModel`

Base type for a nonlinear least-squares model.

`NLPModels.AbstractNLPModelMeta`

— Type`AbstractNLPModelMeta`

Base type for metadata related to an optimization model.

`NLPModels.NLPModelMeta`

— Type`NLPModelMeta <: AbstractNLPModelMeta`

A composite type that represents the main features of the optimization problem

```
optimize obj(x)
subject to lvar ≤ x ≤ uvar
lcon ≤ cons(x) ≤ ucon
```

where `x`

is an `nvar`

-dimensional vector, `obj`

is the real-valued objective function, `cons`

is the vector-valued constraint function, `optimize`

is either "minimize" or "maximize".

Here, `lvar`

, `uvar`

, `lcon`

and `ucon`

are vectors. Some of their components may be infinite to indicate that the corresponding bound or general constraint is not present.

`NLPModelMeta(nvar; kwargs...)`

Create an `NLPModelMeta`

with `nvar`

variables. The following keyword arguments are accepted:

`x0`

: initial guess`lvar`

: vector of lower bounds`uvar`

: vector of upper bounds`nlvb`

: number of nonlinear variables in both objectives and constraints`nlvo`

: number of nonlinear variables in objectives (includes nlvb)`nlvc`

: number of nonlinear variables in constraints (includes nlvb)`ncon`

: number of general constraints`y0`

: initial Lagrange multipliers`lcon`

: vector of constraint lower bounds`ucon`

: vector of constraint upper bounds`nnzo`

: number of nonzeros in the gradient`nnzj`

: number of elements needed to store the nonzeros in the sparse Jacobian`lin_nnzj`

: number of elements needed to store the nonzeros in the sparse Jacobian of linear constraints`nln_nnzj`

: number of elements needed to store the nonzeros in the sparse Jacobian of nonlinear constraints`nnzh`

: number of elements needed to store the nonzeros in the sparse Hessian`lin`

: indices of linear constraints`minimize`

: true if optimize == minimize`islp`

: true if the problem is a linear program`name`

: problem name

`NLPModelMeta`

also contains the following attributes:

`nvar`

: number of variables`ifix`

: indices of fixed variables`ilow`

: indices of variables with lower bound only`iupp`

: indices of variables with upper bound only`irng`

: indices of variables with lower and upper bound (range)`ifree`

: indices of free variables`iinf`

: indices of visibly infeasible bounds`jfix`

: indices of equality constraints`jlow`

: indices of constraints of the form c(x) ≥ cl`jupp`

: indices of constraints of the form c(x) ≤ cu`jrng`

: indices of constraints of the form cl ≤ c(x) ≤ cu`jfree`

: indices of "free" constraints (there shouldn't be any)`jinf`

: indices of the visibly infeasible constraints`nlin`

: number of linear constraints`nnln`

: number of nonlinear general constraints`nln`

: indices of nonlinear constraints

`NLPModels.NLSMeta`

— Type`NLSMeta`

Base type for metadata related to a nonlinear least-squares model.

`NLSMeta(nequ, nvar; kwargs...)`

Create a `NLSMeta`

with `nequ`

equations and `nvar`

variables. The following keyword arguments are accepted:

`x0`

: initial guess`nnzj`

: number of elements needed to store the nonzeros of the Jacobian of the residual`nnzh`

: number of elements needed to store the nonzeros of the sum of Hessians of the residuals`lin`

: indices of linear residuals

`NLSMeta`

also contains the following attributes:

`nequ`

: size of the residual`nvar`

: number of variables`nln`

: indices of nonlinear residuals`nnln`

: number of nonlinear general residuals`nlin`

: number of linear residuals

`NLPModels.nls_meta`

— Function`nls_meta(nls)`

Returns the `nls_meta`

structure of `nls`

. Use this instead of `nls.nls_meta`

to handle models that have internal models.

For basic models `nls_meta(nls)`

is defined as `nls.nls_meta`

, but composite models might not keep `nls_meta`

themselves, so they might specialize it to something like `nls.internal.nls_meta`

.