Skip to content

Commit 584bdcb

Browse files
timholytmigot
andauthored
Documentation tweaks (fixes #460) (#462)
* Documentation tweaks (fixes #460) This eliminates the inconsistency in `c_i = 0` vs `c_L <= c_i <= c_U` notes in #460. It also: - adds Manifest.toml to `.gitignore` - standardizes on `y` rather than `λ` for Lagrange multipliers - clarifies or polishes wording in various places - adds `NLPModels` to `docs/Project.toml` (this is standard and might allow simplification of your `workflow`s) * Update docs/src/models.md Co-authored-by: Tangi Migot <tangi.migot@gmail.com> * Use E instead of V and use caligraphic for indices --------- Co-authored-by: Tangi Migot <tangi.migot@gmail.com>
1 parent bfd4cea commit 584bdcb

File tree

9 files changed

+20
-18
lines changed

9 files changed

+20
-18
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
*.jl.mem
33
docs/build
44
docs/site
5+
Manifest.toml

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
ADNLPModels = "54578032-b7ea-4c30-94aa-7cbd1cce6c9a"
33
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
44
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
5+
NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
56

67
[compat]
78
ADNLPModels = "0.7"

docs/src/api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Namely,
1616
- ``\nabla f(x)``, the gradient of ``f`` at the point ``x``;
1717
- ``\nabla^2 f(x)``, the Hessian of ``f`` at the point ``x``;
1818
- ``J(x) = \nabla c(x)^T``, the Jacobian of ``c`` at the point ``x``;
19-
- ``\nabla^2 f(x) + \sum_{i=1}^m \lambda_i \nabla^2 c_i(x)``,
20-
the Hessian of the Lagrangian function at the point ``(x,\lambda)``.
19+
- ``\nabla^2 f(x) + \sum_{i=1}^m y_i \nabla^2 c_i(x)``,
20+
the Hessian of the Lagrangian function at the point ``(x,y)``.
2121

2222
There are many ways to access some of these values, so here is a little
2323
reference guide.

docs/src/guidelines.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ There are about 30 functions in the NLPModels API, and a few with more than one
4242
Luckily, many have a default implementation.
4343
We collect here the list of functions that should be implemented for a complete API.
4444

45-
Here, the following notation apply:
45+
Here, the following notation applies:
4646
- `nlp` is your instance of `MyModel <: AbstractNLPModel`
4747
- `x` is the point where the function is evaluated
4848
- `y` is the vector of Lagrange multipliers (for constrained problems only)
@@ -143,4 +143,4 @@ Furthermore, the `show` method has to be updated with the correct direction of `
143143
## [Advanced tests](@id advanced-tests)
144144

145145
We have created the package [NLPModelsTest.jl](https://github.com/JuliaSmoothOptimizers/NLPModelsTest.jl) which defines test functions and problems.
146-
To make sure that your model is robust, we recommend using that package.
146+
To make sure that your model is robust, we recommend using it in the test suite of your package.

docs/src/index.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ The general form of the optimization problem is
1111
```math
1212
\begin{aligned}
1313
\min \quad & f(x) \\
14-
& c_i(x) = 0, \quad i \in E, \\
15-
& c_{L_i} \leq c_i(x) \leq c_{U_i}, \quad i \in I, \\
14+
& c_i(x) = c_{E_i}, \quad i \in {\cal E}, \\
15+
& c_{L_i} \leq c_i(x) \leq c_{U_i}, \quad i \in {\cal I}, \\
1616
& \ell \leq x \leq u,
1717
\end{aligned}
1818
```
1919
where ``f:\mathbb{R}^n\rightarrow\mathbb{R}``,
2020
``c:\mathbb{R}^n\rightarrow\mathbb{R}^m``,
21-
``E\cup I = \{1,2,\dots,m\}``, ``E\cap I = \emptyset``,
21+
``{\cal E}\cup {\cal I} = \{1,2,\dots,m\}``, ``{\cal E}\cap {\cal I} = \emptyset``,
2222
and
23-
``c_{L_i}, c_{U_i}, \ell_j, u_j \in \mathbb{R}\cup\{\pm\infty\}``
23+
``c_{E_i}, c_{L_i}, c_{U_i}, \ell_j, u_j \in \mathbb{R}\cup\{\pm\infty\}``
2424
for ``i = 1,\dots,m`` and ``j = 1,\dots,n``.
2525

2626
For computational reasons, we write
@@ -31,13 +31,13 @@ For computational reasons, we write
3131
& \ell \leq x \leq u,
3232
\end{aligned}
3333
```
34-
defining ``c_{L_i} = c_{U_i}`` for all ``i \in E``.
34+
defining ``c_{L_i} = c_{U_i} = c_{E_i}`` for all ``i \in {\cal E}``.
3535
The Lagrangian of this problem is defined as
3636
```math
37-
L(x,\lambda,z^L,z^U;\sigma) = \sigma f(x) + c(x)^T\lambda + \sum_{i=1}^n z_i^L(x_i-l_i) + \sum_{i=1}^nz_i^U(u_i-x_i),
37+
L(x,y,z^L,z^U;\sigma) = \sigma f(x) + c(x)^T y + \sum_{i=1}^n z_{L_i}(x_i-l_i) + \sum_{i=1}^n z_{U_i}(u_i-x_i),
3838
```
3939
where ``\sigma`` is a scaling parameter included for computational reasons.
40-
Notice that, for the Hessian, the variables ``z^L`` and ``z^U`` are not used.
40+
Since the final two sums are linear in ``x``, the variables ``z_L`` and ``z_U`` do not appear in the Hessian ``\nabla^2 L(x,y)``.
4141

4242
Optimization problems are represented by an instance/subtype of `AbstractNLPModel`.
4343
Such instances are composed of
@@ -48,7 +48,7 @@ Such instances are composed of
4848

4949
## Nonlinear Least Squares
5050

51-
A special type of `NLPModels` are the `NLSModels`, i.e., Nonlinear Least
51+
A special subtype of `AbstractNLPModel` is `AbstractNLSModel`, i.e., Nonlinear Least
5252
Squares models. In these problems, the function ``f(x)`` is given by
5353
``\tfrac{1}{2}\Vert F(x)\Vert^2``, where ``F`` is referred as the residual function.
5454
The individual value of ``F``, as well as of its derivatives, is also

docs/src/models.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Models
22

3-
The following is a list of packages implement the NLPModels API.
3+
The following is a list of packages implementing the NLPModels API.
44

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

@@ -19,7 +19,7 @@ If you want to create your own interface, check these [Guidelines](@ref).
1919
- [NLPModelsJuMP.jl](https://github.com/JuliaSmoothOptimizers/NLPModelsJuMP.jl):
2020
For problems modeled using [JuMP.jl](https://github.com/jump-dev/JuMP.jl).
2121
- [QuadraticModels.jl](https://github.com/JuliaSmoothOptimizers/QuadraticModels.jl):
22-
For problems with quadratic and linear structure.
22+
For problems with linear constraints and a quadratic objective (LCQP).
2323
- [LLSModels.jl](https://github.com/JuliaSmoothOptimizers/LLSModels.jl):
2424
Creates a linear least squares model.
2525
- [PDENLPModels.jl](https://github.com/JuliaSmoothOptimizers/PDENLPModels.jl):

docs/src/tools.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ neval_obj(nlp)
1717

1818
Some counters are available for all models, some are specific. In
1919
particular, there are additional specific counters for the nonlinear
20-
least squares models.
20+
least squares models (the ones with `residual` below).
2121

2222
| Counter | Description |
2323
|---|---|
@@ -62,7 +62,7 @@ sum_counters(nlp)
6262

6363
## Querying problem type
6464

65-
There are some variable for querying the problem type:
65+
There are some utility functions for querying the problem type:
6666

6767
- [`has_bounds`](@ref): True when not all variables are free.
6868
- [`bound_constrained`](@ref): True for problems with bounded variables

src/nlp/meta.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The following keyword arguments are accepted:
5050
- `islp`: true if the problem is a linear program
5151
- `name`: problem name
5252
53-
`NLPModelMeta` also contains the following attributes:
53+
`NLPModelMeta` also contains the following attributes, which are computed from the variables above:
5454
- `nvar`: number of variables
5555
- `ifix`: indices of fixed variables
5656
- `ilow`: indices of variables with lower bound only

src/nls/meta.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The following keyword arguments are accepted:
1616
- `nnzh`: number of elements needed to store the nonzeros of the sum of Hessians of the residuals
1717
- `lin`: indices of linear residuals
1818
19-
`NLSMeta` also contains the following attributes:
19+
`NLSMeta` also contains the following attributes, which are computed from the variables above:
2020
- `nequ`: size of the residual
2121
- `nvar`: number of variables
2222
- `nln`: indices of nonlinear residuals

0 commit comments

Comments
 (0)