Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the trust region subsolver exchangeable. #294

Merged
merged 51 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
616f3ef
Fix a few typos.
kellertuer Sep 24, 2023
8065fb4
Rework a bit of docs.
kellertuer Sep 24, 2023
80fb063
Decouple and Renaming / Add documentation to some fields, and remaini…
kellertuer Sep 25, 2023
956a6d0
Update a few more variable names.
kellertuer Sep 25, 2023
2e5ec17
A bit more documentation and notation unification.
kellertuer Sep 26, 2023
09f430d
Merge branch 'master' into kellertuer/TR-subsolver
kellertuer Sep 29, 2023
891d3db
Clear code and introduce `get_parameter`.
kellertuer Sep 29, 2023
2e84590
Improve tests to the new defaults.
kellertuer Sep 29, 2023
cd6da72
Fix docs, loosen one test for Mac OS.
kellertuer Sep 30, 2023
71e503a
Bump documenter to 1.x
kellertuer Sep 30, 2023
ccf17d5
Move IJulia compilation back to where it was.
kellertuer Sep 30, 2023
502557f
Update Readme.
kellertuer Sep 30, 2023
0ea1818
Unify docs.
kellertuer Sep 30, 2023
950f3f8
$ -> `` in docs (being more strict now).
kellertuer Sep 30, 2023
b12de09
Merge branch 'master' into kellertuer/TR-subsolver
kellertuer Oct 2, 2023
6ecd342
Merge branch 'master' into kellertuer/TR-subsolver
kellertuer Oct 11, 2023
59b2a89
Based on TangentSpace from ManifoldsBase.jl – start modelling the tru…
kellertuer Oct 11, 2023
f0c23b4
Rename a few keywords.
kellertuer Oct 11, 2023
cbb6f75
Continue a bit on modelling here, ...
kellertuer Oct 13, 2023
cb44677
Bump dependencies to forthcoming packages.
kellertuer Oct 19, 2023
44fe628
Update .gitignore.
kellertuer Oct 25, 2023
bc2b732
Merge branch 'master' into kellertuer/TR-subsolver
kellertuer Oct 25, 2023
da87f25
Continue sketching the TR subsolver
kellertuer Oct 25, 2023
58868b7
Continue the work on nicer constructors and more documentation.
kellertuer Oct 26, 2023
ce06eb0
Reorganize and document code.
kellertuer Oct 28, 2023
27a5004
Introduce one further layer for tCG so the constructor already genera…
kellertuer Oct 28, 2023
f803906
Finish modelling and constructor defaults.
kellertuer Oct 28, 2023
71d1a07
Final default value adaptions.
kellertuer Oct 28, 2023
22c7ce8
Update base point properly.
kellertuer Oct 28, 2023
8289bb2
Refactor and simplify ARC, such that Lanczos can actually be defined …
kellertuer Oct 29, 2023
4593efd
Merge branch 'master' into kellertuer/TR-subsolver
kellertuer Oct 29, 2023
b9cd1df
runs formatter.
kellertuer Oct 29, 2023
b4b5603
fix one bug, one bug left.
kellertuer Oct 30, 2023
7002e01
Remove a side effect where a stopping criterion accidentally updated …
kellertuer Oct 30, 2023
64e5d1c
Add compat entries for standard libs.
kellertuer Oct 30, 2023
0c8af58
loosen checks for Julia 1.6
kellertuer Oct 31, 2023
eb6bf63
Trying to find out why it runs locally on 1.6 but not on Mac OS CI.
kellertuer Oct 31, 2023
2ae6ca0
Fix a typo
kellertuer Oct 31, 2023
70bb309
Remove debug again, tolerances should be fine now.
kellertuer Oct 31, 2023
615ea3f
Update test/solvers/test_adaptive_regularization_with_cubics.jl
kellertuer Oct 31, 2023
22fdab8
Work on Code coverage.
kellertuer Oct 31, 2023
2bde1f5
Improve documentation.
kellertuer Oct 31, 2023
a8bf0d7
Sketch a first technical details section.
kellertuer Oct 31, 2023
4938e69
A bit of rework on the docs, starts a first technical section.
kellertuer Oct 31, 2023
0234310
Improve Test coverage.
kellertuer Nov 1, 2023
e74035f
Fixing stuff for Documenter 1.3 ...
kellertuer Nov 1, 2023
4ce3046
grmphølkejqbrg
kellertuer Nov 1, 2023
f36115f
Fix DocumenterCitations.
kellertuer Nov 1, 2023
0fcf1c4
add comments to TR
kellertuer Nov 1, 2023
fbb1fe9
Fix a link.
kellertuer Nov 1, 2023
7f1707e
Bump version, finish changelog.
kellertuer Nov 2, 2023
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
7 changes: 7 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable Changes to the Julia package `Manopt.jl` will be documented in this
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.41] - dd/mm/yyyy

### Changed

– `trust_regions` is now more flexible and the sub solver (Steinhaug-Toint tCG by default)
can now be exchanged.

## [0.4.40] – 24/10/2023

### Added
Expand Down
7 changes: 5 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ ColorSchemes = "3.5.0"
ColorTypes = "0.9.1, 0.10, 0.11"
Colors = "0.11.2, 0.12"
DataStructures = "0.17, 0.18"
LinearAlgebra = "1.6"
LRUCache = "1.4"
ManifoldDiff = "0.2, 0.3.3"
ManifoldDiff = "0.3.8"
Manifolds = "0.9"
ManifoldsBase = "0.15"
Markdown = "1.6"
PolynomialRoots = "1"
Random = "1.6"
Requires = "0.5, 1"
Statistics = "1"
Statistics = "1.6"
julia = "1.6"

[extras]
Expand Down
19 changes: 18 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,24 @@ To refer to a certain version or the source code in general we recommend to cite
```

for the most recent version or a corresponding version specific DOI, see [the list of all versions](https://zenodo.org/search?page=1&size=20&q=conceptrecid:%224290905%22&sort=-version&all_versions=True).
Note that both citations are in [BibLaTeX](https://ctan.org/pkg/biblatex) format.

If you are also using [`Manifolds.jl`](https://juliamanifolds.github.io/Manifolds.jl/stable/) please consider to cite

```
@article{AxenBaranBergmannRzecki:2023,
AUTHOR = {Seth D. Axen and Mateusz Baran and Ronny Bergmann and Krzysztof Rzecki},
DOI = {10.1145/3618296},
EPRINT = {2021.08777},
EPRINTTYPE = {arXiv},
JOURNAL = {AMS Transactions on Mathematical Software},
NOTE = {accepted for publication},
TITLE = {Manifolds.jl: An Extensible {J}ulia Framework for Data Analysis on Manifolds},
YEAR = {2023}
}
```

as well.
Note that all citations are in [BibLaTeX](https://ctan.org/pkg/biblatex) format.

## Further and Similar Packages & Links

Expand Down
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ tutorials_menu =
bib = CitationBibliography(joinpath(@__DIR__, "src", "references.bib"); style=:alpha)
makedocs(;
format=Documenter.HTML(;
mathengine=MathJax3(), prettyurls=get(ENV, "CI", nothing) == "true"
prettyurls=false, assets=["assets/favicon.ico", "assets/citations.css"]
),
modules=[
Manopt,
Expand Down
19 changes: 19 additions & 0 deletions docs/src/assets/citations.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* Taken from https://juliadocs.org/DocumenterCitations.jl/v1.2/styling/ */

.citation dl {
display: grid;
grid-template-columns: max-content auto; }
.citation dt {
grid-column-start: 1; }
.citation dd {
grid-column-start: 2;
margin-bottom: 0.75em; }
.citation ul {
padding: 0 0 2.25em 0;
margin: 0;
list-style: none;}
.citation ul li {
text-indent: -2.25em;
margin: 0.33em 0.5em 0.5em 2.25em;}
.citation ol li {
padding-left:0.75em;}
13 changes: 6 additions & 7 deletions docs/src/functions/gradients.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# [Gradients](@id GradientFunctions)

For a function $f:\mathcal M→ℝ$
the Riemannian gradient $\operatorname{grad}f(x)$ at $x∈\mathcal M$
For a function ``f:\mathcal M→ℝ``
the Riemannian gradient ``\operatorname{grad}f(x)`` at ``x∈\mathcal M``
is given by the unique tangent vector fulfilling

$\langle \operatorname{grad}f(x), ξ\rangle_x = D_xf[ξ],\quad
\forall ξ ∈ T_x\mathcal M,$
where $D_xf[ξ]$ denotes the differential of $f$ at $x$ with respect to
the tangent direction (vector) $ξ$ or in other words the directional
``\langle \operatorname{grad}f(x), ξ\rangle_x = D_xf[ξ],\quad
\forall ξ ∈ T_x\mathcal M,``
where ``D_xf[ξ]`` denotes the differential of ``f`` at ``x`` with respect to
the tangent direction (vector) ``ξ`` or in other words the directional
derivative.

This page collects the available gradients.
Expand Down
1 change: 1 addition & 0 deletions docs/src/plans/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ Still there might be the need to set certain parameters within any of these stru

```@docs
set_manopt_parameter!
get_manopt_parameter
Manopt.status_summary
```
20 changes: 19 additions & 1 deletion docs/src/plans/objective.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ ManifoldProximalMapObjective
get_proximal_map
```


### Hessian Objective

```@docs
AbstractManifoldHessianObjective
ManifoldHessianObjective
```

Expand Down Expand Up @@ -234,3 +234,21 @@ get_grad_inequality_constraint!
get_grad_inequality_constraints
get_grad_inequality_constraints!
```

### Subproblem Objective

This objective can be use when the objective of a sub problem
solver still needs access to the (outer/main) objective.

```@docs
AbstractManifoldSubObjective
```

#### Access functions

```@docs
Manopt.get_objective_cost
Manopt.get_objective_gradient
Manopt.get_objective_hessian
Manopt.get_objective_preconditioner
```
31 changes: 17 additions & 14 deletions docs/src/solvers/ChambollePock.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,34 @@
The Riemannian Chambolle–Pock is a generalization of the Chambolle–Pock algorithm [ChambollePock:2011](@citet*)
It is also known as primal-dual hybrid gradient (PDHG) or primal-dual proximal splitting (PDPS) algorithm.

In order to minimize over $p∈\mathcal M$ the cost function consisting of
In order to minimize over ``p∈\mathcal M`` the cost function consisting of
In order to minimize a cost function consisting of

```math
F(p) + G(Λ(p)),
```

where $F:\mathcal M → \overline{ℝ}$, $G:\mathcal N → \overline{ℝ}$, and
$Λ:\mathcal M →\mathcal N$.
If the manifolds $\mathcal M$ or $\mathcal N$ are not Hadamard, it has to be considered locally,
i.e. on geodesically convex sets $\mathcal C \subset \mathcal M$ and $\mathcal D \subset\mathcal N$
such that $Λ(\mathcal C) \subset \mathcal D$.
over ``p∈\mathcal M``

where ``F:\mathcal M → \overline{ℝ}``, ``G:\mathcal N → \overline{ℝ}``, and
``Λ:\mathcal M →\mathcal N``.
If the manifolds ``\mathcal M`` or ``\mathcal N`` are not Hadamard, it has to be considered locally,
i.e. on geodesically convex sets ``\mathcal C \subset \mathcal M`` and ``\mathcal D \subset\mathcal N``
such that ``Λ(\mathcal C) \subset \mathcal D``.

The algorithm is available in four variants: exact versus linearized (see `variant`)
as well as with primal versus dual relaxation (see `relax`). For more details, see
[BergmannHerzogSilvaLouzeiroTenbrinckVidalNunez:2021](@citet*).
In the following we note the case of the exact, primal relaxed Riemannian Chambolle–Pock algorithm.

Given base points $m∈\mathcal C$, $n=Λ(m)∈\mathcal D$,
initial primal and dual values $p^{(0)} ∈\mathcal C$, $ξ_n^{(0)} ∈T_n^*\mathcal N$,
and primal and dual step sizes $\sigma_0$, $\tau_0$, relaxation $\theta_0$,
as well as acceleration $\gamma$.
Given base points ``m∈\mathcal C``, ``n=Λ(m)∈\mathcal D``,
initial primal and dual values ``p^{(0)} ∈\mathcal C``, ``ξ_n^{(0)} ∈T_n^*\mathcal N``,
and primal and dual step sizes ``\sigma_0``, ``\tau_0``, relaxation ``\theta_0``,
as well as acceleration ``\gamma``.

As an initialization, perform $\bar p^{(0)} \gets p^{(0)}$.
As an initialization, perform ``\bar p^{(0)} \gets p^{(0)}``.

The algorithms performs the steps $k=1,…,$ (until a [`StoppingCriterion`](@ref) is fulfilled with)
The algorithms performs the steps ``k=1,…,`` (until a [`StoppingCriterion`](@ref) is fulfilled with)

1. ```math
ξ^{(k+1)}_n = \operatorname{prox}_{\tau_k G_n^*}\Bigl(ξ_n^{(k)} + \tau_k \bigl(\log_n Λ (\bar p^{(k)})\bigr)^\flat\Bigr)
Expand All @@ -46,9 +49,9 @@ The algorithms performs the steps $k=1,…,$ (until a [`StoppingCriterion`](@ref
Furthermore you can exchange the exponential map, the logarithmic map, and the parallel transport
by a retraction, an inverse retraction, and a vector transport.

Finally you can also update the base points $m$ and $n$ during the iterations.
Finally you can also update the base points ``m`` and ``n`` during the iterations.
This introduces a few additional vector transports. The same holds for the case
$Λ(m^{(k)})\neq n^{(k)}$ at some point. All these cases are covered in the algorithm.
``Λ(m^{(k)})\neq n^{(k)}`` at some point. All these cases are covered in the algorithm.

```@meta
CurrentModule = Manopt
Expand Down
10 changes: 4 additions & 6 deletions docs/src/solvers/adaptive-regularization-with-cubics.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,17 @@ Manopt.LanczosState

## (Conjugate) Gradient Descent

There are two generic functors, that implement the sub problem
There is a generic objective, that implements the sub problem

```@docs
AdaptiveRegularizationCubicCost
AdaptiveRegularizationCubicGrad
AdaptiveRagularizationWithCubicsModelObjective
```

Since the sub problem is given on the tangent space, you have to provide

```
g = AdaptiveRegularizationCubicCost(M, mho, σ)
grad_g = AdaptiveRegularizationCubicGrad(M, mho, σ)
sub_problem = DefaultProblem(TangentSpaceAt(M,p), ManifoldGradienObjective(g, grad_g))
arc_obj = AdaptiveRagularizationWithCubicsModelObjective(mho, σ)
sub_problem = DefaultProblem(TangentSpaceAt(M,p), arc_obj)
```

where `mho` is the hessian objective of `f` to solve.
Expand Down
4 changes: 2 additions & 2 deletions docs/src/solvers/cyclic_proximal_point.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ The Cyclic Proximal Point (CPP) algorithm aims to minimize
F(x) = \sum_{i=1}^c f_i(x)
```

assuming that the [proximal maps](@ref proximalMapFunctions) $\operatorname{prox}_{λ f_i}(x)$
assuming that the [proximal maps](@ref proximalMapFunctions) ``\operatorname{prox}_{λ f_i}(x)``
are given in closed form or can be computed efficiently (at least approximately).

The algorithm then cycles through these proximal maps, where the type of cycle
might differ and the proximal parameter $λ_k$ changes after each cycle $k$.
might differ and the proximal parameter ``λ_k`` changes after each cycle ``k``.

For a convergence result on
[Hadamard manifolds](https://en.wikipedia.org/wiki/Hadamard_manifold)
Expand Down
28 changes: 14 additions & 14 deletions docs/src/solvers/primal_dual_semismooth_Newton.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ The aim is to solve an optimization problem on a manifold with a cost function o
F(p) + G(Λ(p)),
```

where $F:\mathcal M → \overline{ℝ}$, $G:\mathcal N → \overline{ℝ}$, and
$Λ:\mathcal M →\mathcal N$.
If the manifolds $\mathcal M$ or $\mathcal N$ are not Hadamard, it has to be considered locally,
i.e. on geodesically convex sets $\mathcal C \subset \mathcal M$ and $\mathcal D \subset\mathcal N$
such that $Λ(\mathcal C) \subset \mathcal D$.
where ``F:\mathcal M → \overline{ℝ}``, ``G:\mathcal N → \overline{ℝ}``, and
``Λ:\mathcal M →\mathcal N``.
If the manifolds ``\mathcal M`` or ``\mathcal N`` are not Hadamard, it has to be considered locally,
i.e. on geodesically convex sets ``\mathcal C \subset \mathcal M`` and ``\mathcal D \subset\mathcal N``
such that ``Λ(\mathcal C) \subset \mathcal D``.

The algorithm comes down to applying the Riemannian semismooth Newton method to the rewritten primal-dual optimality conditions, i.e., we define the vector field $X: \mathcal{M} \times \mathcal{T}_{n}^{*} \mathcal{N} \rightarrow \mathcal{T} \mathcal{M} \times \mathcal{T}_{n}^{*} \mathcal{N}$ as
The algorithm comes down to applying the Riemannian semismooth Newton method to the rewritten primal-dual optimality conditions, i.e., we define the vector field ``X: \mathcal{M} \times \mathcal{T}_{n}^{*} \mathcal{N} \rightarrow \mathcal{T} \mathcal{M} \times \mathcal{T}_{n}^{*} \mathcal{N}`` as

```math
X\left(p, \xi_{n}\right):=\left(\begin{array}{c}
Expand All @@ -23,13 +23,13 @@ X\left(p, \xi_{n}\right):=\left(\begin{array}{c}
\end{array}\right)
```

and solve for $X(p,ξ_{n})=0$.
and solve for ``X(p,ξ_{n})=0``.

Given base points $m∈\mathcal C$, $n=Λ(m)∈\mathcal D$,
initial primal and dual values $p^{(0)} ∈\mathcal C$, $ξ_{n}^{(0)} ∈ \mathcal T_{n}^{*}\mathcal N$,
and primal and dual step sizes $\sigma$, $\tau$.
Given base points ``m∈\mathcal C``, ``n=Λ(m)∈\mathcal D``,
initial primal and dual values ``p^{(0)} ∈\mathcal C``, ``ξ_{n}^{(0)} ∈ \mathcal T_{n}^{*}\mathcal N``,
and primal and dual step sizes ``\sigma``, ``\tau``.

The algorithms performs the steps $k=1,…,$ (until a [`StoppingCriterion`](@ref) is reached)
The algorithms performs the steps ``k=1,…,`` (until a [`StoppingCriterion`](@ref) is reached)

1. Choose any element
```math
Expand All @@ -40,7 +40,7 @@ The algorithms performs the steps $k=1,…,$ (until a [`StoppingCriterion`](@ref
```math
V^{(k)} [(d_p^{(k)}, d_n^{(k)})] = - X(p^{(k)},ξ_n^{(k)})
```
in the vector space $\mathcal{T}_{p^{(k)}} \mathcal{M} \times \mathcal{T}_{n}^{*} \mathcal{N}$
in the vector space ``\mathcal{T}_{p^{(k)}} \mathcal{M} \times \mathcal{T}_{n}^{*} \mathcal{N}``
3. Update
```math
p^{(k+1)} := \exp_{p^{(k)}}(d_p^{(k)})
Expand All @@ -53,9 +53,9 @@ The algorithms performs the steps $k=1,…,$ (until a [`StoppingCriterion`](@ref
Furthermore you can exchange the exponential map, the logarithmic map, and the parallel transport
by a retraction, an inverse retraction and a vector transport.

Finally you can also update the base points $m$ and $n$ during the iterations.
Finally you can also update the base points ``m`` and ``n`` during the iterations.
This introduces a few additional vector transports. The same holds for the case that
$Λ(m^{(k)})\neq n^{(k)}$ at some point. All these cases are covered in the algorithm.
``Λ(m^{(k)})\neq n^{(k)}`` at some point. All these cases are covered in the algorithm.

```@meta
CurrentModule = Manopt
Expand Down
Loading
Loading