12 |
12 |
13 use crate::types::*; |
13 use crate::types::*; |
14 |
14 |
15 pub mod nonneg; |
15 pub mod nonneg; |
16 pub mod unconstrained; |
16 pub mod unconstrained; |
|
17 pub mod l1squared_unconstrained; |
|
18 pub mod l1squared_nonneg; |
|
19 |
17 |
20 |
18 /// Method for solving finite-dimensional subproblems |
21 /// Method for solving finite-dimensional subproblems |
19 #[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Debug)] |
22 #[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Debug)] |
20 #[allow(dead_code)] |
23 #[allow(dead_code)] |
21 pub enum InnerMethod { |
24 pub enum InnerMethod { |
22 /// Forward-backward |
25 /// Forward-backward |
23 FB, |
26 FB, |
24 /// Semismooth Newton |
27 /// Semismooth Newton |
25 SSN, |
28 SSN, |
|
29 /// PDPS |
|
30 PDPS, |
|
31 /// Problem-specific choice (in practise FB or PDPS, whichever is implemented) |
|
32 Default, |
26 } |
33 } |
27 |
34 |
28 /// Settings for the solution of finite-dimensional subproblems |
35 /// Settings for the solution of finite-dimensional subproblems |
29 #[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Debug)] |
36 #[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Debug)] |
30 pub struct InnerSettings<F : Float> { |
37 pub struct InnerSettings<F : Float> { |
31 /// Method |
38 /// Method |
32 pub method : InnerMethod, |
39 pub method : InnerMethod, |
33 /// Proportional step length (∈ [0, 1) for `InnerMethod::FB`). |
40 /// Proportional step length ∈ [0, 1) for `InnerMethod::FB`. |
34 pub τ0 : F, |
41 pub fb_τ0 : F, |
|
42 /// Proportional primal and dual step lengths for `InnerMethod::PDPS`. |
|
43 pub pdps_τσ0 : (F, F), |
35 /// Fraction of `tolerance` given to inner algorithm |
44 /// Fraction of `tolerance` given to inner algorithm |
36 pub tolerance_mult : F, |
45 pub tolerance_mult : F, |
37 /// Iterator options |
46 /// Iterator options |
38 #[serde(flatten)] |
47 #[serde(flatten)] |
39 pub iterator_options : AlgIteratorOptions, |
48 pub iterator_options : AlgIteratorOptions, |
41 |
50 |
42 #[replace_float_literals(F::cast_from(literal))] |
51 #[replace_float_literals(F::cast_from(literal))] |
43 impl<F : Float> Default for InnerSettings<F> { |
52 impl<F : Float> Default for InnerSettings<F> { |
44 fn default() -> Self { |
53 fn default() -> Self { |
45 InnerSettings { |
54 InnerSettings { |
46 τ0 : 0.99, |
55 fb_τ0 : 0.99, |
|
56 pdps_τσ0 : (1.98, 0.5), |
47 iterator_options : AlgIteratorOptions { |
57 iterator_options : AlgIteratorOptions { |
48 // max_iter cannot be very small, as initially FB needs many iterations, although |
58 // 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 |
59 // on later invocations even one or two tends to be enough |
50 max_iter : 2000, |
60 max_iter : 2000, |
51 // verbose_iter affects testing of sufficient convergence, so we set it to |
61 // verbose_iter affects testing of sufficient convergence, so we set it to |
53 verbose_iter : Verbose::Every(1), |
63 verbose_iter : Verbose::Every(1), |
54 // … but don't print out anything |
64 // … but don't print out anything |
55 quiet : true, |
65 quiet : true, |
56 .. Default::default() |
66 .. Default::default() |
57 }, |
67 }, |
58 method : InnerMethod::FB, |
68 method : InnerMethod::Default, |
59 tolerance_mult : 0.01, |
69 tolerance_mult : 0.01, |
60 } |
70 } |
61 } |
71 } |
62 } |
72 } |