Wed, 22 Mar 2023 20:37:49 +0200
Bump version
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
1 | /*! |
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
2 | Iterative algorithms for solving the finite-dimensional subproblem. |
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
3 | */ |
0 | 4 | |
5 | use serde::{Serialize, Deserialize}; | |
6 | use numeric_literals::replace_float_literals; | |
7 | use alg_tools::iterate::{ | |
8 | AlgIteratorOptions, | |
9 | Verbose, | |
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
10 | |
0 | 11 | }; |
12 | ||
13 | use crate::types::*; | |
14 | ||
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
15 | pub mod nonneg; |
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
16 | pub mod unconstrained; |
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
17 | |
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
18 | #[deprecated(since = "1.0.1", note = "Moved to submodule nonneg")] |
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
19 | pub use nonneg::{ |
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
20 | quadratic_nonneg, |
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
21 | quadratic_nonneg_ssn, |
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
22 | quadratic_nonneg_fb |
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
23 | }; |
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
24 | |
0 | 25 | /// Method for solving finite-dimensional subproblems |
26 | #[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Debug)] | |
27 | #[allow(dead_code)] | |
28 | pub enum InnerMethod { | |
29 | /// Forward-backward | |
30 | FB, | |
31 | /// Semismooth Newton | |
32 | SSN, | |
33 | } | |
34 | ||
35 | /// Settings for the solution of finite-dimensional subproblems | |
36 | #[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Debug)] | |
37 | pub struct InnerSettings<F : Float> { | |
38 | /// Method | |
39 | pub method : InnerMethod, | |
40 | /// Proportional step length (∈ [0, 1) for `InnerMethod::FB`). | |
41 | pub τ0 : F, | |
42 | /// Fraction of `tolerance` given to inner algorithm | |
43 | pub tolerance_mult : F, | |
44 | /// Iterator options | |
45 | #[serde(flatten)] | |
46 | pub iterator_options : AlgIteratorOptions, | |
47 | } | |
48 | ||
49 | #[replace_float_literals(F::cast_from(literal))] | |
50 | impl<F : Float> Default for InnerSettings<F> { | |
51 | fn default() -> Self { | |
52 | InnerSettings { | |
53 | τ0 : 0.99, | |
54 | iterator_options : AlgIteratorOptions { | |
55 | // max_iter cannot be very small, as initially FB needs many iterations, although | |
56 | // on later invocations even one or two tends to be enough | |
57 | max_iter : 2000, | |
58 | // verbose_iter affects testing of sufficient convergence, so we set it to | |
59 | // a small value… | |
60 | verbose_iter : Verbose::Every(1), | |
61 | // … but don't print out anything | |
62 | quiet : true, | |
63 | .. Default::default() | |
64 | }, | |
65 | method : InnerMethod::FB, | |
66 | tolerance_mult : 0.01, | |
67 | } | |
68 | } | |
69 | } |