Skip to content

Commit

Permalink
A normalize action closure would also do
Browse files Browse the repository at this point in the history
Signed-off-by: Nahuel Espinosa <nespinosa@ekumenlabs.com>
  • Loading branch information
nahueespinosa committed Jan 19, 2024
1 parent 21219f9 commit 58cb129
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions beluga_system_tests/test/test_system_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ auto particle_filter_test(
beluga::actions::propagate([&motion](const auto& state) { return motion.apply_motion(state, engine); }) |
beluga::actions::reweight([&sensor](const auto& state) { return sensor.importance_weight(state); });

// TODO(nahuel): Reweight should normalize over the total weight.
// Computing the slow and fast average ratio in adaptive sampling is the same before and after normalizing.
// TODO(nahuel): Implement a `normalize` action closure that normalizes over the total weight.
/**
* particles |= beluga::actions::normalize;
*/
const double total_weight = ranges::accumulate(beluga::views::weights(particles), 0.0);
particles |= beluga::actions::reweight([total_weight](auto) { return 1.0 / total_weight; }); // HACK

Expand Down

0 comments on commit 58cb129

Please sign in to comment.