# HG changeset patch # User Tuomo Valkonen # Date 1670587848 -7200 # Node ID 90f77ad9a98d808a772fae0c63e9ad9c7b46eec8 # Parent de8d43ebfd0d269ed71c3eafb1c88bd997256a8d Added command line option for (power) tolerance diff -r de8d43ebfd0d -r 90f77ad9a98d src/main.rs --- a/src/main.rs Wed Dec 07 08:17:46 2022 +0200 +++ b/src/main.rs Fri Dec 09 14:10:48 2022 +0200 @@ -195,6 +195,11 @@ /// Either the string "none", or a radius value for heuristic merging. /// Only affects FB, FISTA, and PDPS. final_merging : Option>, + + #[arg(long, value_names = &["ε", "θ", "p"])] + /// Set the tolerance to ε_k = ε/(1+θk)^p + tolerance : Option>, + } /// The entry point for the program. diff -r de8d43ebfd0d -r 90f77ad9a98d src/run.rs --- a/src/run.rs Wed Dec 07 08:17:46 2022 +0200 +++ b/src/run.rs Fri Dec 09 14:10:48 2022 +0200 @@ -64,6 +64,7 @@ use crate::seminorms::*; use crate::plot::*; use crate::{AlgorithmOverrides, CommandLineArgs}; +use crate::tolerance::Tolerance; /// Available algorithms and their configurations #[derive(Copy, Clone, Debug, Serialize, Deserialize)] @@ -73,6 +74,11 @@ PDPS(PDPSConfig), } +fn unpack_tolerance(v : &Vec) -> Tolerance { + assert!(v.len() == 3); + Tolerance::Power { initial : v[0], factor : v[1], exponent : v[2] } +} + impl AlgorithmConfig { /// Override supported parameters based on the command line. pub fn cli_override(self, cli : &AlgorithmOverrides) -> Self { @@ -85,6 +91,7 @@ merge_every : cli.merge_every.unwrap_or(g.merge_every), merging : cli.merging.clone().unwrap_or(g.merging), final_merging : cli.final_merging.clone().unwrap_or(g.final_merging), + tolerance: cli.tolerance.as_ref().map(unpack_tolerance).unwrap_or(g.tolerance), .. g } }; @@ -105,6 +112,7 @@ }), FW(fw) => FW(FWConfig { merging : cli.merging.clone().unwrap_or(fw.merging), + tolerance : cli.tolerance.as_ref().map(unpack_tolerance).unwrap_or(fw.tolerance), .. fw }) }