Fri, 28 Apr 2023 08:20:51 +0300
Remove deprecated interfaces
|
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 | |
| 0 | 18 | /// Method for solving finite-dimensional subproblems |
| 19 | #[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Debug)] | |
| 20 | #[allow(dead_code)] | |
| 21 | pub enum InnerMethod { | |
| 22 | /// Forward-backward | |
| 23 | FB, | |
| 24 | /// Semismooth Newton | |
| 25 | SSN, | |
| 26 | } | |
| 27 | ||
| 28 | /// Settings for the solution of finite-dimensional subproblems | |
| 29 | #[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Debug)] | |
| 30 | pub struct InnerSettings<F : Float> { | |
| 31 | /// Method | |
| 32 | pub method : InnerMethod, | |
| 33 | /// Proportional step length (∈ [0, 1) for `InnerMethod::FB`). | |
| 34 | pub τ0 : F, | |
| 35 | /// Fraction of `tolerance` given to inner algorithm | |
| 36 | pub tolerance_mult : F, | |
| 37 | /// Iterator options | |
| 38 | #[serde(flatten)] | |
| 39 | pub iterator_options : AlgIteratorOptions, | |
| 40 | } | |
| 41 | ||
| 42 | #[replace_float_literals(F::cast_from(literal))] | |
| 43 | impl<F : Float> Default for InnerSettings<F> { | |
| 44 | fn default() -> Self { | |
| 45 | InnerSettings { | |
| 46 | τ0 : 0.99, | |
| 47 | iterator_options : AlgIteratorOptions { | |
| 48 | // max_iter cannot be very small, as initially FB needs many iterations, although | |
| 49 | // on later invocations even one or two tends to be enough | |
| 50 | max_iter : 2000, | |
| 51 | // verbose_iter affects testing of sufficient convergence, so we set it to | |
| 52 | // a small value… | |
| 53 | verbose_iter : Verbose::Every(1), | |
| 54 | // … but don't print out anything | |
| 55 | quiet : true, | |
| 56 | .. Default::default() | |
| 57 | }, | |
| 58 | method : InnerMethod::FB, | |
| 59 | tolerance_mult : 0.01, | |
| 60 | } | |
| 61 | } | |
| 62 | } |