Skip to content

Commit 964332a

Browse files
rework documentation
1 parent 3deed71 commit 964332a

File tree

5 files changed

+59
-44
lines changed

5 files changed

+59
-44
lines changed

docs/make.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ makedocs(
1616
sitename = "RegularizedOptimization.jl",
1717
pages = [
1818
"Home" => "index.md",
19-
"User guide" => [
20-
joinpath("guide", "introduction.md"),
21-
joinpath("guide", "algorithms.md"),
22-
joinpath("guide", "custom.md")
23-
],
19+
"Algorithms" => "algorithms.md",
2420
"Examples" => [
2521
joinpath("examples", "bpdn.md"),
2622
joinpath("examples", "fh.md")
Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Algorithms
1+
# [Algorithms](@id algorithms)
22

33
## General case
44
The algorithms in this package are based upon the approach of [aravkin-baraldi-orban-2022](@cite).
@@ -34,30 +34,6 @@ The models for the smooth part `f` in this package are always quadratic models o
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.
3636

37-
For the model of the regularizer $h$, it is less straightforward.
38-
First, we require the model to locally approximate $h$ sufficiently well, see [aravkin-baraldi-orban-2022; Model Assumption 3.2.](@cite)
39-
Then, the model $\psi$ should be such that the shifted proximal mapping
40-
```math
41-
\text{prox}_{\sigma^{-1}\psi} (q) := \underset{s \in \mathbb{R}^n}{\argmin} \psi(s;x_0) + \frac{\sigma}{2} \| s - q \|_2^2
42-
```
43-
can be computed efficiently.
44-
45-
!!! note
46-
While the user can choose whichever regularizer he wants and then choose an appropriate model for it, he also needs to implement the function `prox!(y, ψ, q, σ)` which computes the proximal mapping in place.
47-
48-
For example, if the regularizer is the Euclidean norm, $h = \|cdot\|_2$, then we can simply choose the model as the function itself, $\psi(s ;x) := h(x + s)$ because
49-
```math
50-
\underset{s \in \mathbb{R}^n}{\argmin} \ \|x + s\|_2 + \frac{\sigma}{2} \| s - q \|_2^2 = (1 - \frac{1}{\sigma\|x + q\|})_+ (x + q) - x.
51-
```
52-
where $(\cdot)_+ := \max \{0, \cdot \}$.
53-
54-
Another example is when the regularizer is the Euclidean norm composed with a function, $h = \|c(\cdot)\|_2$.
55-
In that case, taking the model as the function itself would make the proximal mapping intractable.
56-
Instead, one can choose the model $\psi(s ;x) := \|c(x) + J(x)s\|_2$, which is a composition of an affine function with the Euclidean norm.
57-
This approach was used in [diouane-gollier-orban-2024](@cite).
58-
59-
For more information on custom regularizers and models thereof, please refer to [this section](@ref custom_regularizers).
60-
6137
The following table gives an overview of the available algorithms in the general case.
6238

6339
Algorithm | Quadratic Regularization | Trust Region | Quadratic term for $\varphi$ : H | Reference
@@ -72,7 +48,7 @@ Algorithm | Quadratic Regularization | Trust Region | Quadratic term for $\varph
7248
This package provides two algorithms, [`LM`](@ref LM) and [`LMTR`](@ref LMTR), specialized for regularized, nonlinear least-squares.
7349
That is, problems of the form
7450
```math
75-
\underset{x \in \mathbb{R}^n}{\text{minimize}} \quad \frac{1}{2} \frac{1}{2}\|F(x)\|_2^2 + h(x),
51+
\underset{x \in \mathbb{R}^n}{\text{minimize}} \quad \frac{1}{2}\|F(x)\|_2^2 + h(x),
7652
```
7753
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.
7854
In that case, the model $\varphi$ is defined as

docs/src/guide/custom.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/src/guide/introduction.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/src/index.md

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,63 @@ We refer to [ManualNLPModels.jl](https://github.com/JuliaSmoothOptimizers/Manual
2929

3030
---
3131

32-
## Features
32+
## Regularizers
3333

34-
- All solvers in RegularizedOptimization.jl have **in-place versions**.
35-
Users can preallocate a workspace and reuse it across solves to avoid memory allocations, which is useful in repetitive scenarios.
34+
Regularizers used in this package are based on the [ShiftedProximalOperators.jl](https://github.com/JuliaSmoothOptimizers/ShiftedProximalOperators.jl) API, which is related to [ProximalOperators.jl](https://github.com/JuliaFirstOrder/ProximalOperators.jl).
3635

37-
- Solvers work with any floating-point type.
36+
The solvers in this package work by approximating the regularizer with a *shifted model*.
37+
That is, at each iterate $x_k$, we approximate $h(x_k + s)$ with a (simpler) function $\psi(s; x_k)$.
38+
For example, if $h(x) = \|x\|$, then its *shifted model* is simply the function $h$ itself : $\psi(s; x_k) = \|x_k + s\|$.
39+
On the other hand, if $h$ is the composition of a norm with a function, $h(x) = \|c(x)\|$, then its *shifted model* can be the approximation
40+
```math
41+
\psi(s; x_k) = \|c(x_k) + J(x_k)s\| \approx \|c(x_k + s) \| = h(x_k + s),
42+
```
43+
where $J(x_k)$ is the Jacobian of $c$ at the point $x_k$.
44+
45+
Basically, we expect a regularizer `h::Foo` to
46+
47+
- Be callable with vectors, i.e. to implement `(h::Foo)(x::AbstractVector)`.
48+
- Be *shifteable*, that is, to implement a function `shifted(h::Foo, x::AbstractVector)` that returns the shifted model `ψ::ShiftedFoo`.
49+
50+
Next, we expect the shifted model `ψ::ShiftedFoo` to
51+
52+
- Be callable with vectors, i.e. to implement `(ψ::ShiftedFoo)(x::AbstractVector)`.
53+
- Be *shifteable*, that is, to implement a function `shifted(ψ::ShiftedFoo, x::AbstractVector)` that returns a shifted model `ψ'::ShiftedFoo`. Moreover, we should be able to change the shift in place, that is, the function `shift!(ψ::ShiftedFoo, x::AbstractVector)` should be implemented as well.
54+
- Be *proximable*, that is, to implement the inplace proximal mapping `prox!(y::AbstractVector, ψ::ShiftedFoo, q::AbstractVector, σ::Real)`.
55+
56+
The proximal mapping is defined as
57+
```math
58+
\text{prox}(\psi, q, \sigma) := \argmin_y \ \psi(y) + \frac{\sigma}{2} \|y - q\|_2^2.
59+
```
60+
61+
!!! note
62+
The package [ShiftedProximalOperators.jl](https://github.com/JuliaSmoothOptimizers/ShiftedProximalOperators.jl) mostly implements the shifted models `ψ`.
63+
For the unshifted version, these are often implemented in [ProximalOperators.jl](https://github.com/JuliaFirstOrder/ProximalOperators.jl) so that you might actually need to install the latter. For example, if you wish to use the L0 norm as a regularizer, then you should define `h` as `h = NormL0(1.0)` with [ProximalOperators.jl](https://github.com/JuliaFirstOrder/ProximalOperators.jl), you don't need to do anything else in this case because the shifted model of the L0 norm is already implemented in [ShiftedProximalOperators.jl](https://github.com/JuliaSmoothOptimizers/ShiftedProximalOperators.jl).
64+
65+
!!! warning
66+
The shifted model being proximable means that our solvers will not be able to automagically solve with any nonsmooth function that is given to it. Rather, the user is expected to provide an efficient solver for the proximal mapping.
67+
68+
The following table shows which regularizers are readily available and which dependency is required to use the regularizer (the shifted model is always in `ShiftedProximalOperators.jl`).
69+
70+
Regularizer | Shifted Model | Julia | Dependency
71+
------------|---------------|-------|-----------
72+
$\lambda ∥x∥_0$ | $\lambda ∥x + s∥_0$ | [`NormL0(λ)`](https://juliafirstorder.github.io/ProximalOperators.jl/stable/functions/#ProximalOperators.NormL0) | [ProximalOperators.jl](https://github.com/JuliaFirstOrder/ProximalOperators.jl)
73+
$\lambda ∥x∥_1$ | $\lambda ∥x + s∥_1$ | [`NormL1(λ)`](https://juliafirstorder.github.io/ProximalOperators.jl/stable/functions/#ProximalOperators.NormL1) | [ProximalOperators.jl](https://github.com/JuliaFirstOrder/ProximalOperators.jl)
74+
$\lambda ∥x∥_2$ | $\lambda ∥x + s∥_2$ | [`NormL2(λ)`](https://juliafirstorder.github.io/ProximalOperators.jl/stable/functions/#ProximalOperators.NormL2) | [ProximalOperators.jl](https://github.com/JuliaFirstOrder/ProximalOperators.jl)
75+
$\lambda ∥c(x)∥_2$ | $\lambda ∥c(x) + J(x)s∥_2$ | [`CompositeNormL2(λ)`](https://jso.dev/ShiftedProximalOperators.jl/dev/reference/#ShiftedProximalOperators.CompositeNormL2) | [ShiftedProximalOperators.jl](https://github.com/JuliaSmoothOptimizers/ShiftedProximalOperators.jl)
76+
77+
---
78+
79+
## Algorithms
80+
81+
A presentation of each algorithm is given [here](@ref algorithms).
82+
83+
---
84+
85+
## Preallocating
86+
87+
All solvers in RegularizedOptimization.jl have **in-place versions**.
88+
Users can preallocate a workspace and reuse it across solves to avoid memory allocations, which is useful in repetitive scenarios.
3889

3990
---
4091

@@ -44,7 +95,7 @@ RegularizedOptimization can be installed through the Julia package manager:
4495

4596
```julia
4697
julia> ]
47-
pkg> add RegularizedOptimization
98+
pkg> add https://github.com/JuliaSmoothOptimizers/RegularizedOptimization.jl
4899
```
49100

50101
---

0 commit comments

Comments
 (0)