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