From d96af81109f37cb7a1807659a5440d2b5ae027fc Mon Sep 17 00:00:00 2001 From: Markus Bullmann Date: Tue, 1 Oct 2019 14:56:17 +0200 Subject: [PATCH] Perform resampling as first update step to avoid plotting issue --- smc/filtering/ParticleFilter.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/smc/filtering/ParticleFilter.h b/smc/filtering/ParticleFilter.h index dae99e5..4a41a1a 100644 --- a/smc/filtering/ParticleFilter.h +++ b/smc/filtering/ParticleFilter.h @@ -134,6 +134,8 @@ namespace SMC { Assert::isNotNull(evaluation, "evaluation MUST not be null! call setEvaluation() first!"); Assert::isNotNull(estimation, "estimation MUST not be null! call setEstimation() first!"); + // if the number of efficient particles is too low, perform resampling + if (lastNEff < particles.size() * nEffThresholdPercent) { resampler->resample(particles); } // perform the transition step @@ -153,9 +155,6 @@ namespace SMC { // estimate the current state const State est = estimation->estimate(particles); - // if the number of efficient particles is too low, perform resampling - if (lastNEff < particles.size() * nEffThresholdPercent) {resampler->resample(particles); } - // done return est;