src/forward_pdps.rs

changeset 91
47d495348e38
parent 89
8d1c959432c8
child 93
8f1e57821d76
equal deleted inserted replaced
90:b471a13e3136 91:47d495348e38
218 for state in iterator.iter_init(|| full_stats(&μ, &z, ε, stats.clone())) { 218 for state in iterator.iter_init(|| full_stats(&μ, &z, ε, stats.clone())) {
219 // Calculate initial transport 219 // Calculate initial transport
220 let Pair(v, z_tmp) = f.differential(Pair(&μ, &z)); 220 let Pair(v, z_tmp) = f.differential(Pair(&μ, &z));
221 let mut τv = v * τ; 221 let mut τv = v * τ;
222 let μ_base = μ.clone(); 222 let μ_base = μ.clone();
223 let μ_base_len = μ_base.len();
223 224
224 // Construct μ^{k+1} by solving finite-dimensional subproblems and insert new spikes. 225 // Construct μ^{k+1} by solving finite-dimensional subproblems and insert new spikes.
225 prox_penalty.insert_and_reweigh( 226 prox_penalty.insert_and_reweigh(
226 &mut μ, 227 &mut μ,
227 &mut τv, 228 &mut τv,
249 ε, 250 ε,
250 ins, 251 ins,
251 &reg, 252 &reg,
252 Some(|μ̃: &RNDM<N, F>| f.apply(Pair(μ̃, &z)) + reg.apply(μ̃)), 253 Some(|μ̃: &RNDM<N, F>| f.apply(Pair(μ̃, &z)) + reg.apply(μ̃)),
253 ); 254 );
254 stats.pruned += prune_with_stats(&mut μ); 255 // Prune. Do not prune new insertions on first round.
256 stats.pruned += prune_with_stats(&mut μ, μ_base_len);
255 257
256 if config.insertion.random_insertions { 258 if config.insertion.random_insertions {
257 if let Some(x) = domain.random_point() { 259 if let Some(x) = domain.random_point() {
258 μ += DeltaMeasure { x, α: 0.0 }; 260 μ += DeltaMeasure { x, α: 0.0 };
259 stats.inserted += 1; 261 stats.inserted += 1;
286 } 288 }
287 Ok(()) 289 Ok(())
288 })?; 290 })?;
289 291
290 if did_merge.is_none() { 292 if did_merge.is_none() {
291 stats.pruned += prune_with_stats(&mut μ); 293 // Prune. Do not prune new insertions on first round.
294 stats.pruned += prune_with_stats(&mut μ, μ_base_len);
292 } 295 }
293 296
294 // Update step length parameters 297 // Update step length parameters
295 // let ω = pdpsconfig.acceleration.accelerate(&mut τ, &mut σ, γ); 298 // let ω = pdpsconfig.acceleration.accelerate(&mut τ, &mut σ, γ);
296 299

mercurial