Mon, 05 Dec 2022 23:50:22 +0200
Zenodo packaging hacks
|
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; |
|
34
efa60bc4f743
Radon FB + sliding improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
29
diff
changeset
|
17 | pub mod l1squared_unconstrained; |
|
efa60bc4f743
Radon FB + sliding improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
29
diff
changeset
|
18 | pub mod l1squared_nonneg; |
|
efa60bc4f743
Radon FB + sliding improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
29
diff
changeset
|
19 | |
|
24
d29d1fcf5423
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
Tuomo Valkonen <tuomov@iki.fi>
parents:
0
diff
changeset
|
20 | |
|
39
6316d68b58af
Merging adjustments, parameter tuning, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
34
diff
changeset
|
21 | /// Method for solving finite-dimensional subproblems. |
|
6316d68b58af
Merging adjustments, parameter tuning, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
34
diff
changeset
|
22 | /// Not all outer methods necessarily support all options. |
| 0 | 23 | #[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Debug)] |
| 24 | #[allow(dead_code)] | |
| 25 | pub enum InnerMethod { | |
| 26 | /// Forward-backward | |
| 27 | FB, | |
| 28 | /// Semismooth Newton | |
| 29 | SSN, | |
|
34
efa60bc4f743
Radon FB + sliding improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
29
diff
changeset
|
30 | /// PDPS |
|
efa60bc4f743
Radon FB + sliding improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
29
diff
changeset
|
31 | PDPS, |
| 0 | 32 | } |
| 33 | ||
| 34 | /// Settings for the solution of finite-dimensional subproblems | |
| 35 | #[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Debug)] | |
| 36 | pub struct InnerSettings<F : Float> { | |
| 37 | /// Method | |
| 38 | pub method : InnerMethod, | |
|
34
efa60bc4f743
Radon FB + sliding improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
29
diff
changeset
|
39 | /// Proportional step length ∈ [0, 1) for `InnerMethod::FB`. |
|
efa60bc4f743
Radon FB + sliding improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
29
diff
changeset
|
40 | pub fb_τ0 : F, |
|
efa60bc4f743
Radon FB + sliding improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
29
diff
changeset
|
41 | /// Proportional primal and dual step lengths for `InnerMethod::PDPS`. |
|
efa60bc4f743
Radon FB + sliding improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
29
diff
changeset
|
42 | pub pdps_τσ0 : (F, F), |
| 0 | 43 | /// Fraction of `tolerance` given to inner algorithm |
| 44 | pub tolerance_mult : F, | |
| 45 | /// Iterator options | |
| 46 | #[serde(flatten)] | |
| 47 | pub iterator_options : AlgIteratorOptions, | |
| 48 | } | |
| 49 | ||
| 50 | #[replace_float_literals(F::cast_from(literal))] | |
| 51 | impl<F : Float> Default for InnerSettings<F> { | |
| 52 | fn default() -> Self { | |
| 53 | InnerSettings { | |
|
34
efa60bc4f743
Radon FB + sliding improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
29
diff
changeset
|
54 | fb_τ0 : 0.99, |
|
efa60bc4f743
Radon FB + sliding improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
29
diff
changeset
|
55 | pdps_τσ0 : (1.98, 0.5), |
| 0 | 56 | iterator_options : AlgIteratorOptions { |
| 57 | // max_iter cannot be very small, as initially FB needs many iterations, although | |
| 58 | // on later invocations even one or two tends to be enough | |
| 59 | max_iter : 2000, | |
| 60 | // verbose_iter affects testing of sufficient convergence, so we set it to | |
| 61 | // a small value… | |
| 62 | verbose_iter : Verbose::Every(1), | |
| 63 | // … but don't print out anything | |
| 64 | quiet : true, | |
| 65 | .. Default::default() | |
| 66 | }, | |
|
39
6316d68b58af
Merging adjustments, parameter tuning, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
34
diff
changeset
|
67 | method : InnerMethod::SSN, |
| 0 | 68 | tolerance_mult : 0.01, |
| 69 | } | |
| 70 | } | |
| 71 | } |