Tue, 04 Aug 2026 19:24:55 -0500
Added greedy insertion option, but does and actually really should not too much
| src/lib.rs | file | annotate | diff | comparison | revisions | |
| src/prox_penalty.rs | file | annotate | diff | comparison | revisions | |
| src/regularisation.rs | file | annotate | diff | comparison | revisions | |
| src/run.rs | file | annotate | diff | comparison | revisions |
--- 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<bool>, + #[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<bool>, + #[arg(long, value_names = &["ε", "θ", "p"])] /// Set the tolerance to ε_k = ε/(1+θk)^p pub tolerance: Option<Vec<F>>,
--- 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, } } }
--- 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<Loc<N, F>, 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<Loc<N, F>, F>, { - let τα = τ * self.α(); + let τα = if config.greedy { 0.0 } else { τ * self.α() }; let keep_below = τα + ε; let keep_above = -τα - ε; let maximise_above = τα + ε * config.insertion_cutoff_factor;
--- 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()