diff -r df92e78cc3f4 -r 677a5fd1b014 src/sliding_fb.rs --- a/src/sliding_fb.rs Thu Jul 16 19:51:51 2026 +0300 +++ b/src/sliding_fb.rs Sun Jul 19 07:30:06 2026 +0200 @@ -1041,7 +1041,7 @@ // Solve finite-dimensional subproblem several times until the dual variable for the // regularisation term conforms to the assumptions made for the transport above. - let (maybe_d, _within_tolerances, mut τv̆, μ̆) = 'adapt_transport: loop { + let (mut τv̆, μ̆) = 'adapt_transport: loop { // Set initial guess for μ=μ^{k+1}. γ.μ̆_into(&mut μ); let μ̆ = μ.clone(); @@ -1054,7 +1054,7 @@ let mut τv̆ = f.differential(&μ̆) * τ; // Construct μ^{k+1} by solving finite-dimensional subproblems and insert new spikes. - let (maybe_d, within_tolerances) = prox_penalty.insert_and_reweigh( + prox_penalty.insert_and_reweigh( &mut μ, &mut τv̆, τ, @@ -1081,7 +1081,7 @@ &config.insertion.refinement, &mut attempts, ) { - break 'adapt_transport (maybe_d, within_tolerances, τv̆, μ̆); + break 'adapt_transport (τv̆, μ̆); } stats.get_transport_mut().readjustment_iters += 1; @@ -1103,20 +1103,39 @@ ®, Some(|μ̃: &RNDM| f.apply(μ̃)), ); - if m > 0 { - stats.merged += m; - v = f.differential(&μ); - } + //if m > 0 { + stats.merged += m; + //v = f.differential(&μ); + //} } γ.prune_compat(&mut μ, &mut stats); + // Do extra weight optimisation step heuristic + for _ in 1..config.insertion.extra_weight_optimisation_steps { + τv̆ = f.differential(&μ) * τ; + prox_penalty.reweigh( + &mut μ, + &mut τv̆, + τ, + ε, + &config.insertion, + ®, + &state, + &mut stats, + )?; + } + + if config.insertion.extra_weight_optimisation_steps > 0 { + γ.prune_compat(&mut μ, &mut stats); + } + let iter = state.iteration(); stats.this_iters += 1; // Give statistics if requested state.if_verbose(|| { - plotter.plot_spikes(iter, maybe_d.as_ref(), Some(&τv̆), &μ); + plotter.plot_spikes(iter, None, Some(&τv̆), &μ); full_stats(&μ, ε, std::mem::replace(&mut stats, IterInfo::new())) });