Skip to content

Commit bdddf6a

Browse files
MaxenceGollierdpo
andauthored
documentation: apply suggestions from code review
Co-authored-by: Dominique <[email protected]>
1 parent eaa3a1c commit bdddf6a

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

docs/src/algorithms.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Suppose we are given the general regularized problem
77
\underset{x \in \mathbb{R}^n}{\text{minimize}} \quad f(x) + h(x),
88
```
99
where $f : \mathbb{R}^n \mapsto \mathbb{R}$ is continuously differentiable and $h : \mathbb{R}^n \mapsto \mathbb{R} \cup \{\infty\}$ is lower semi-continuous.
10-
Instead of solving the above directly, which is often impossible, we will solve a simplified version of it repeatedly until we reach a minimizer of the problem above.
10+
Instead of solving the above directly, which is often impossible, we will solve a simplified version of it repeatedly until we reach a stationary point of the problem above.
1111
To do so, suppose we are given an iterate $x_0 \in \mathbb{R}^n$, we wish to compute a step, $s_0 \in \mathbb{R}^n$ and improve our iterate with $x_1 := x_0 + s_0$.
1212
Now, we are going to approximate the functions $f$ and $h$ around $x_0$ with simpler functions (models), which we denote respectively $\varphi(\cdot; x_0)$ and $\psi(\cdot; x_0)$ so that
1313
```math
@@ -17,19 +17,19 @@ We then wish to compute the step as
1717
```math
1818
s_0 \in \underset{s \in \mathbb{R}^n}{\argmin} \ \varphi(s; x_0) + \psi(s; x_0).
1919
```
20-
In order to ensure convergence and to handle the potential nonconvexity of the objective function, we either add a trust-region,
20+
In order to ensure convergence and to handle the potential nonconvexity of the objective function, we either add a trust-region constraint,
2121
```math
2222
s_0 \in \underset{s \in \mathbb{R}^n}{\argmin} \ \varphi(s; x_0) + \psi(s; x_0) \quad \text{subject to} \ \|s\| \leq \Delta,
2323
```
2424
or a quadratic regularization
2525
```math
26-
s_0 \in \underset{s \in \mathbb{R}^n}{\argmin} \ \varphi(s; x_0) + \psi(s; x_0) + \sigma \|s\|^2_2.
26+
s_0 \in \underset{s \in \mathbb{R}^n}{\argmin} \ \varphi(s; x_0) + \psi(s; x_0) + \tfrac{1}{2} \sigma \|s\|^2_2.
2727
```
2828
Algorithms that work with a trust-region are [`TR`](@ref TR) and [`TRDH`](@ref TRDH) and the ones working with a quadratic regularization are [`R2`](@ref R2), [`R2N`](@ref R2N) and [`R2DH`](@ref R2DH)
2929

3030
The models for the smooth part `f` in this package are always quadratic models of the form
3131
```math
32-
\varphi(s; x_0) = f(x_0) + \nabla f(x_0)^T s + \frac{1}{2} s^T H(x_0) s,
32+
\varphi(s; x_0) = f(x_0) + \nabla f(x_0)^T s + \tfrac{1}{2} s^T H(x_0) s,
3333
```
3434
where $H(x_0)$ is a symmetric matrix that can be either $0$, the Hessian of $f$ (if it exists) or a quasi-Newton approximation.
3535
Some algorithms require a specific structure for $H$, for an overview, refer to the table below.
@@ -45,15 +45,14 @@ Algorithm | Quadratic Regularization | Trust Region | Quadratic term for $\varph
4545
[`TRDH`](@ref TRDH) | No | Yes | Any Diagonal | [leconte-orban-2025; Algorithm 5.1](@cite)
4646

4747
## Nonlinear least-squares
48-
This package provides two algorithms, [`LM`](@ref LM) and [`LMTR`](@ref LMTR), specialized for regularized, nonlinear least-squares.
49-
That is, problems of the form
48+
This package provides two algorithms, [`LM`](@ref LM) and [`LMTR`](@ref LMTR), specialized for regularized, nonlinear least-squares, i.e., problems of the form
5049
```math
51-
\underset{x \in \mathbb{R}^n}{\text{minimize}} \quad \frac{1}{2}\|F(x)\|_2^2 + h(x),
50+
\underset{x \in \mathbb{R}^n}{\text{minimize}} \quad \tfrac{1}{2}\|F(x)\|_2^2 + h(x),
5251
```
5352
where $F : \mathbb{R}^n \mapsto \mathbb{R}^m$ is continuously differentiable and $h : \mathbb{R}^n \mapsto \mathbb{R} \cup \{\infty\}$ is lower semi-continuous.
5453
In that case, the model $\varphi$ is defined as
5554
```math
56-
\varphi(s; x) = \frac{1}{2}\|F(x) + J(x)s\|_2^2,
55+
\varphi(s; x) = \tfrac{1}{2}\|F(x) + J(x)s\|_2^2,
5756
```
5857
where $J(x)$ is the Jacobian of $F$ at $x$.
5958
Similar to the algorithms in the previous section, we either add a quadratic regularization to the model ([`LM`](@ref LM)) or a trust-region ([`LMTR`](@ref LMTR)).

docs/src/examples/basic.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ regularized_pb = RegularizedNLPModel(f_model, h)
6161
6262
using RegularizedOptimization
6363
64-
# Suppose for example that we don't want to use a quasi-Newton approach and/or that we don't have access to the Hessian of f.
64+
# Suppose for example that we don't want to use a quasi-Newton approach
65+
# and that we don't have access to the Hessian of f, or that we don't want to incur the cost of computing it
6566
# In this case, the most appropriate solver would be R2.
6667
# For this example, we also choose a relatively small tolerance by specifying the keyword argument atol across all solvers.
6768
out = R2(regularized_pb, verbose = 10, atol = 1e-3)
@@ -76,7 +77,7 @@ println("-----------------------------------------------------------------------
7677
7778
# Suppose for some reason we can not compute the Hessian.
7879
# In this case, we can try to switch to a quasi-Newton approximation, this can be done with NLPModelsModifiers.jl
79-
# We could choose to TR again but for the sake of this tutorial we are going to try to run it with R2N
80+
# We could choose to use TR again but for the sake of this tutorial we run it with R2N
8081
8182
using NLPModelsModifiers
8283
@@ -89,8 +90,8 @@ out = R2N(regularized_pb_lsr1, verbose = 10, atol = 1e-3)
8990
println("R2N converged after $(out.iter) iterations to the solution x = $(out.solution)")
9091
println("--------------------------------------------------------------------------------------")
9192
92-
# Finally, in the case where the quasi-Newton approximation is diagonal, TRDH and R2DH are specialized solvers to this case
93-
# and should be used in favour of TR and R2N respectively.
93+
# Finally, TRDH and R2DH are specialized for diagonal quasi-Newton approximations,
94+
# and should be used instead of TR and R2N, respectively.
9495
f_model_sg = SpectralGradientModel(f_model)
9596
regularized_pb_sg = RegularizedNLPModel(f_model_sg, h)
9697

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ A [`RegularizedNLPModel`](https://jso.dev/RegularizedProblems.jl/stable/referenc
1717
- a smooth component `f` represented as an [`AbstractNLPModel`](https://github.com/JuliaSmoothOptimizers/NLPModels.jl),
1818
- a nonsmooth regularizer `h`.
1919

20-
For the smooth component `f`, we refer to [jso.dev](https://jso.dev) for tutorials on the `NLPModel` API. This framework allows the usage of models from
20+
For the smooth component `f`, we refer to [jso.dev](https://jso.dev) for tutorials on the `NLPModels` API. This framework allows the usage of models from
2121
- AMPL ([AmplNLReader.jl](https://github.com/JuliaSmoothOptimizers/AmplNLReader.jl)),
2222
- CUTEst ([CUTEst.jl](https://github.com/JuliaSmoothOptimizers/CUTEst.jl)),
2323
- JuMP ([NLPModelsJuMP.jl](https://github.com/JuliaSmoothOptimizers/NLPModelsJuMP.jl)),

0 commit comments

Comments
 (0)