Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 40 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,40 +84,46 @@ The complete list of methods that an interface may implement can be found in the

`NLPModelMeta` objects have the following attributes (with `S <: AbstractVector`):

Attribute | Type | Notes
------------|--------------------|------------------------------------
`nvar` | `Int ` | number of variables
`x0 ` | `S` | initial guess
`lvar` | `S` | vector of lower bounds
`uvar` | `S` | vector of upper bounds
`ifix` | `Vector{Int}` | indices of fixed variables
`ilow` | `Vector{Int}` | indices of variables with lower bound only
`iupp` | `Vector{Int}` | indices of variables with upper bound only
`irng` | `Vector{Int}` | indices of variables with lower and upper bound (range)
`ifree` | `Vector{Int}` | indices of free variables
`iinf` | `Vector{Int}` | indices of visibly infeasible bounds
`ncon` | `Int ` | total number of general constraints
`nlin ` | `Int ` | number of linear constraints
`nnln` | `Int ` | number of nonlinear general constraints
`y0 ` | `S` | initial Lagrange multipliers
`lcon` | `S` | vector of constraint lower bounds
`ucon` | `S` | vector of constraint upper bounds
`lin ` | `Vector{Int}` | indices of linear constraints
`nln` | `Vector{Int}` | indices of nonlinear constraints
`jfix` | `Vector{Int}` | indices of equality constraints
`jlow` | `Vector{Int}` | indices of constraints of the form c(x) ≥ cl
`jupp` | `Vector{Int}` | indices of constraints of the form c(x) ≤ cu
`jrng` | `Vector{Int}` | indices of constraints of the form cl ≤ c(x) ≤ cu
`jfree` | `Vector{Int}` | indices of "free" constraints (there shouldn't be any)
`jinf` | `Vector{Int}` | indices of the visibly infeasible constraints
`nnzo` | `Int ` | number of nonzeros in the gradient
`nnzh` | `Int ` | number of nonzeros in the sparse Hessian
`nnzj` | `Int ` | number of nonzeros in the sparse Jacobian
`lin_nnzj` | `Int ` | number of nonzeros in the linear part of sparse Jacobian
`nln_nnzj` | `Int ` | number of nonzeros in the nonlinear part of sparse Jacobian
`minimize` | `Bool ` | true if `optimize == minimize`
`islp` | `Bool ` | true if the problem is a linear program
`name` | `String` | problem name
Attribute | Type | Notes
-------------------|---------------|------------------------------------
`nvar` | `Int` | number of variables
`x0 ` | `S` | initial guess
`lvar` | `S` | vector of lower bounds
`uvar` | `S` | vector of upper bounds
`ifix` | `Vector{Int}` | indices of fixed variables
`ilow` | `Vector{Int}` | indices of variables with lower bound only
`iupp` | `Vector{Int}` | indices of variables with upper bound only
`irng` | `Vector{Int}` | indices of variables with lower and upper bound (range)
`ifree` | `Vector{Int}` | indices of free variables
`iinf` | `Vector{Int}` | indices of visibly infeasible bounds
`ncon` | `Int` | total number of general constraints
`nlin ` | `Int` | number of linear constraints
`nnln` | `Int` | number of nonlinear general constraints
`y0 ` | `S` | initial Lagrange multipliers
`lcon` | `S` | vector of constraint lower bounds
`ucon` | `S` | vector of constraint upper bounds
`lin ` | `Vector{Int}` | indices of linear constraints
`nln` | `Vector{Int}` | indices of nonlinear constraints
`jfix` | `Vector{Int}` | indices of equality constraints
`jlow` | `Vector{Int}` | indices of constraints of the form c(x) ≥ cl
`jupp` | `Vector{Int}` | indices of constraints of the form c(x) ≤ cu
`jrng` | `Vector{Int}` | indices of constraints of the form cl ≤ c(x) ≤ cu
`jfree` | `Vector{Int}` | indices of "free" constraints (there shouldn't be any)
`jinf` | `Vector{Int}` | indices of the visibly infeasible constraints
`nnzo` | `Int` | number of nonzeros in the gradient
`nnzj` | `Int` | number of nonzeros in the sparse Jacobian
`lin_nnzj` | `Int` | number of nonzeros in the sparse linear constraints Jacobian
`nln_nnzj` | `Int` | number of nonzeros in the sparse nonlinear constraints Jacobian
`nnzh` | `Int` | number of nonzeros in the lower triangular part of the sparse Hessian of the Lagrangian
`minimize` | `Bool` | true if `optimize == minimize`
`islp` | `Bool` | true if the problem is a linear program
`name` | `String` | problem name
`grad_available` | `Bool` | true if the gradient of the objective is available
`jac_available` | `Bool` | true if the sparse Jacobian of the constraints is available
`hess_available` | `Bool` | true if the sparse Hessian of the Lagrangian is available
`jprod_available` | `Bool` | true if the Jacobian-vector product `J * v` is available
`jtprod_available` | `Bool` | true if the transpose Jacobian-vector product `J' * v` is available
`hprod_available` | `Bool` | true if the Hessian-vector product of the Lagrangian `H * v` is available

# Bug reports and discussions

Expand Down
5 changes: 5 additions & 0 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ NLPModels instances.
| ``J(x)`` | [`jac_lin`](@ref), [`jac_nln`](@ref), [`jac`](@ref), [`jac_lin_op`](@ref), [`jac_lin_op!`](@ref), [`jac_nln_op`](@ref), [`jac_nln_op!`](@ref),[`jac_op`](@ref), [`jac_op!`](@ref), [`jac_lin_coord`](@ref), [`jac_lin_coord!`](@ref), [`jac_nln_coord`](@ref), [`jac_nln_coord!`](@ref), [`jac_coord`](@ref), [`jac_coord!`](@ref), [`jac_lin_structure`](@ref), [`jac_lin_structure!`](@ref), [`jac_nln_structure`](@ref), [`jac_nln_structure!`](@ref), [`jac_structure`](@ref), [`jprod_lin`](@ref), [`jprod_lin!`](@ref), [`jprod_nln`](@ref), [`jprod_nln!`](@ref), [`jprod`](@ref), [`jprod!`](@ref), [`jtprod_lin`](@ref), [`jtprod_lin!`](@ref), [`jtprod_nln`](@ref), [`jtprod_nln!`](@ref), [`jtprod`](@ref), [`jtprod!`](@ref) |
| ``\nabla^2 L(x,y)`` | [`hess`](@ref), [`hess_op`](@ref), [`hess_coord`](@ref), [`hess_coord!`](@ref), [`hess_structure`](@ref), [`hess_structure!`](@ref), [`hprod`](@ref), [`hprod!`](@ref), [`jth_hprod`](@ref), [`jth_hprod!`](@ref), [`jth_hess`](@ref), [`jth_hess_coord`](@ref), [`jth_hess_coord!`](@ref), [`ghjvprod`](@ref), [`ghjvprod!`](@ref) |

If only a subset of the functions listed above is implemented, you can indicate which ones are not available when creating the [`NLPModelMeta`](@ref), using the keyword arguments
`grad_available`, `jac_available`, `hess_available`, `jprod_available`, `jtprod_available`, and `hprod_available`.

## [API for NLSModels](@id nls-api)

For the Nonlinear Least Squares models, ``f(x) = \tfrac{1}{2} \Vert F(x)\Vert^2``,
Expand All @@ -59,3 +62,5 @@ and its derivatives. Namely,
| ``F(x)`` | [`residual`](@ref), [`residual!`](@ref) |
| ``J_F(x)`` | [`jac_residual`](@ref), [`jac_coord_residual`](@ref), [`jac_coord_residual!`](@ref), [`jac_structure_residual`](@ref), [`jac_structure_residual!`](@ref), [`jprod_residual`](@ref), [`jprod_residual!`](@ref), [`jtprod_residual`](@ref), [`jtprod_residual!`](@ref), [`jac_op_residual`](@ref), [`jac_op_residual!`](@ref) |
| ``\nabla^2 F_i(x)`` | [`hess_residual`](@ref), [`hess_coord_residual`](@ref), [`hess_coord_residual!`](@ref), [`hess_structure_residual`](@ref), [`hess_structure_residual!`](@ref), [`jth_hess_residual`](@ref), [`jth_hess_residual_coord`](@ref), [`jth_hess_residual_coord!`](@ref), [`hprod_residual`](@ref), [`hprod_residual!`](@ref), [`hess_op_residual`](@ref), [`hess_op_residual!`](@ref) |

If only a subset of the functions listed above is implemented, you can indicate which ones are not available when creating the [`NLSMeta`](@ref), using the keyword arguments `jac_residual_available`, `hess_residual_available`, `jprod_residual_available`, `jtprod_residual_available`, and `hprod_residual_available`.
9 changes: 9 additions & 0 deletions docs/src/guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ The indices of linear and nonlinear constraints are respectively available in `n
If your model uses only linear (resp. nonlinear) constraints, then it suffices to implement the `*_lin` (resp. `*_nln`) functions.
Alternatively, one could implement only the functions without the suffixes `_nln!` (e.g., only `cons!`), but this might run into errors with tools differentiating linear and nonlinear constraints.

## [Availability of the API](@id availability-api)

If only a subset of the functions listed above is implemented, you can indicate which ones are not available when creating the [`NLPModelMeta`](@ref), using the keyword arguments
`grad_available`, `jac_available`, `hess_available`, `jprod_available`, `jtprod_available`, and `hprod_available`.

By default, `grad_available`, `hess_available`, and `hprod_available` are set to `true`.
For constrained problems (`ncon > 0`), the fields `jac_available`, `jprod_available`, and `jtprod_available` are also set to `true`.
For unconstrained problems (`ncon == 0`), they default to `false`.

## [Expected behaviour](@id expected-behaviour)

The following is a non-exhaustive list of expected behaviour for methods.
Expand Down
74 changes: 40 additions & 34 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,40 +79,46 @@ See the [Models](@ref), the [Tools](@ref tools-section), or the [API](@ref).

`NLPModelMeta` objects have the following attributes (with `S <: AbstractVector`):

Attribute | Type | Notes
------------|--------------------|------------------------------------
`nvar` | `Int ` | number of variables
`x0 ` | `S` | initial guess
`lvar` | `S` | vector of lower bounds
`uvar` | `S` | vector of upper bounds
`ifix` | `Vector{Int}` | indices of fixed variables
`ilow` | `Vector{Int}` | indices of variables with lower bound only
`iupp` | `Vector{Int}` | indices of variables with upper bound only
`irng` | `Vector{Int}` | indices of variables with lower and upper bound (range)
`ifree` | `Vector{Int}` | indices of free variables
`iinf` | `Vector{Int}` | indices of visibly infeasible bounds
`ncon` | `Int ` | total number of general constraints
`nlin ` | `Int ` | number of linear constraints
`nnln` | `Int ` | number of nonlinear general constraints
`y0 ` | `S` | initial Lagrange multipliers
`lcon` | `S` | vector of constraint lower bounds
`ucon` | `S` | vector of constraint upper bounds
`lin ` | `Vector{Int}` | indices of linear constraints
`nln` | `Vector{Int}` | indices of nonlinear constraints
`jfix` | `Vector{Int}` | indices of equality constraints
`jlow` | `Vector{Int}` | indices of constraints of the form c(x) ≥ cl
`jupp` | `Vector{Int}` | indices of constraints of the form c(x) ≤ cu
`jrng` | `Vector{Int}` | indices of constraints of the form cl ≤ c(x) ≤ cu
`jfree` | `Vector{Int}` | indices of "free" constraints (there shouldn't be any)
`jinf` | `Vector{Int}` | indices of the visibly infeasible constraints
`nnzo` | `Int ` | number of nonzeros in the gradient
`nnzj` | `Int ` | number of nonzeros in the sparse Jacobian
`lin_nnzj` | `Int ` | number of nonzeros in the sparse linear constraints Jacobian
`nln_nnzj` | `Int ` | number of nonzeros in the sparse nonlinear constraints Jacobian
`nnzh` | `Int ` | number of nonzeros in the lower triangular part of the sparse Hessian of the Lagrangian
`minimize` | `Bool ` | true if `optimize == minimize`
`islp` | `Bool ` | true if the problem is a linear program
`name` | `String` | problem name
Attribute | Type | Notes
-------------------|---------------|------------------------------------
`nvar` | `Int` | number of variables
`x0 ` | `S` | initial guess
`lvar` | `S` | vector of lower bounds
`uvar` | `S` | vector of upper bounds
`ifix` | `Vector{Int}` | indices of fixed variables
`ilow` | `Vector{Int}` | indices of variables with lower bound only
`iupp` | `Vector{Int}` | indices of variables with upper bound only
`irng` | `Vector{Int}` | indices of variables with lower and upper bound (range)
`ifree` | `Vector{Int}` | indices of free variables
`iinf` | `Vector{Int}` | indices of visibly infeasible bounds
`ncon` | `Int` | total number of general constraints
`nlin ` | `Int` | number of linear constraints
`nnln` | `Int` | number of nonlinear general constraints
`y0 ` | `S` | initial Lagrange multipliers
`lcon` | `S` | vector of constraint lower bounds
`ucon` | `S` | vector of constraint upper bounds
`lin ` | `Vector{Int}` | indices of linear constraints
`nln` | `Vector{Int}` | indices of nonlinear constraints
`jfix` | `Vector{Int}` | indices of equality constraints
`jlow` | `Vector{Int}` | indices of constraints of the form c(x) ≥ cl
`jupp` | `Vector{Int}` | indices of constraints of the form c(x) ≤ cu
`jrng` | `Vector{Int}` | indices of constraints of the form cl ≤ c(x) ≤ cu
`jfree` | `Vector{Int}` | indices of "free" constraints (there shouldn't be any)
`jinf` | `Vector{Int}` | indices of the visibly infeasible constraints
`nnzo` | `Int` | number of nonzeros in the gradient
`nnzj` | `Int` | number of nonzeros in the sparse Jacobian
`lin_nnzj` | `Int` | number of nonzeros in the sparse linear constraints Jacobian
`nln_nnzj` | `Int` | number of nonzeros in the sparse nonlinear constraints Jacobian
`nnzh` | `Int` | number of nonzeros in the lower triangular part of the sparse Hessian of the Lagrangian
`minimize` | `Bool` | true if `optimize == minimize`
`islp` | `Bool` | true if the problem is a linear program
`name` | `String` | problem name
`grad_available` | `Bool` | true if the gradient of the objective is available
`jac_available` | `Bool` | true if the sparse Jacobian of the constraints is available
`hess_available` | `Bool` | true if the sparse Hessian of the Lagrangian is available
`jprod_available` | `Bool` | true if the Jacobian-vector product `J * v` is available
`jtprod_available` | `Bool` | true if the transpose Jacobian-vector product `J' * v` is available
`hprod_available` | `Bool` | true if the Hessian-vector product of the Lagrangian `H * v` is available

## License

Expand Down
Loading
Loading