# HG changeset patch # User Tuomo Valkonen # Date 1785889495 18000 # Node ID b471a13e3136792df23948068b7f7ea66001b831 # Parent 8d1c959432c8a707af192288123ab4ef8e0e756e Added greedy insertion option, but does and actually really should not too much diff -r 8d1c959432c8 -r b471a13e3136 src/lib.rs --- a/src/lib.rs Tue Aug 04 14:12:18 2026 -0500 +++ b/src/lib.rs Tue Aug 04 19:24:55 2026 -0500 @@ -251,6 +251,12 @@ /// Whether to perform random insertions after merge. Not all methods support this. pub random_insertions: Option, + #[arg(long)] + /// Whether to do insertions even if there is no tolerance violation. + /// This will require merging to be enabled for the number of spikes to not increase + /// uncontrollably. + pub greedy: Option, + #[arg(long, value_names = &["ε", "θ", "p"])] /// Set the tolerance to ε_k = ε/(1+θk)^p pub tolerance: Option>, diff -r 8d1c959432c8 -r b471a13e3136 src/prox_penalty.rs --- a/src/prox_penalty.rs Tue Aug 04 14:12:18 2026 -0500 +++ b/src/prox_penalty.rs Tue Aug 04 19:24:55 2026 -0500 @@ -69,11 +69,14 @@ /// Additional weight optimisation steps after merge and random insertion pub extra_weight_optimisation_steps: usize, + /// Maximum iteration for scaling hack, zero if no maximum. + pub max_scaling_iter: usize, + /// Random insertion after merge pub random_insertions: bool, - /// Maximum iteration for scaling hack, zero if no maximum. - pub max_scaling_iter: usize, + /// Greedily insert points, even if no tolerance violation. + pub greedy: bool, } #[replace_float_literals(F::cast_from(literal))] @@ -95,6 +98,7 @@ extra_weight_optimisation_steps: 0, max_scaling_iter: 0, random_insertions: false, + greedy: false, } } } diff -r 8d1c959432c8 -r b471a13e3136 src/regularisation.rs --- a/src/regularisation.rs Tue Aug 04 14:12:18 2026 -0500 +++ b/src/regularisation.rs Tue Aug 04 19:24:55 2026 -0500 @@ -272,7 +272,7 @@ where M: MinMaxMapping, F>, { - let τα = τ * self.α(); + let τα = if config.greedy { 0.0 } else { τ * self.α() }; let keep_above = -τα - ε; let minimise_below = -τα - ε * config.insertion_cutoff_factor; let refinement_tolerance = ε * config.refinement.tolerance_mult; @@ -501,7 +501,7 @@ where M: MinMaxMapping, F>, { - let τα = τ * self.α(); + let τα = if config.greedy { 0.0 } else { τ * self.α() }; let keep_below = τα + ε; let keep_above = -τα - ε; let maximise_above = τα + ε * config.insertion_cutoff_factor; diff -r 8d1c959432c8 -r b471a13e3136 src/run.rs --- a/src/run.rs Tue Aug 04 14:12:18 2026 -0500 +++ b/src/run.rs Tue Aug 04 19:24:55 2026 -0500 @@ -131,6 +131,7 @@ .extra_weight_optimisation_steps .unwrap_or(g.extra_weight_optimisation_steps), random_insertions: cli.random_insertions.unwrap_or(g.random_insertions), + greedy: cli.greedy.unwrap_or(g.greedy), tolerance: cli .tolerance .as_ref()