Bayes Filters Library
ResamplingWithPrior.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2019 Istituto Italiano di Tecnologia (IIT)
3  *
4  * This software may be modified and distributed under the terms of the
5  * BSD 3-Clause license. See the accompanying LICENSE file for details.
6  */
7 
8 #ifndef RESAMPLINGWITHPRIOR_H
9 #define RESAMPLINGWITHPRIOR_H
10 
14 
15 #include <memory>
16 #include <vector>
17 
18 #include <Eigen/Dense>
19 
20 namespace bfl {
21  class ResamplingWithPrior;
22 }
23 
24 
26 {
27 public:
28  ResamplingWithPrior(std::unique_ptr<bfl::ParticleSetInitialization> init_model, const double prior_ratio, const unsigned int seed) noexcept;
29 
30  ResamplingWithPrior(std::unique_ptr<bfl::ParticleSetInitialization> init_model, const double prior_ratio) noexcept;
31 
32  ResamplingWithPrior(std::unique_ptr<bfl::ParticleSetInitialization> init_model) noexcept;
33 
34  ResamplingWithPrior(ResamplingWithPrior&& resampling) noexcept;
35 
36  virtual ~ResamplingWithPrior() noexcept = default;
37 
38  ResamplingWithPrior& operator=(ResamplingWithPrior&& resampling) noexcept;
39 
40  void resample(const ParticleSet& cor_particles, ParticleSet& res_particles, Eigen::Ref<Eigen::VectorXi> res_parents) override;
41 
42 
43 protected:
44  std::unique_ptr<bfl::ParticleSetInitialization> init_model_;
45 
46  double prior_ratio_ = 0.5;
47 
48 
49 private:
50  std::vector<unsigned int> sort_indices(const Eigen::Ref<const Eigen::VectorXd>& vector);
51 };
52 
53 #endif /* RESAMPLINGWITHPRIOR_H */
bfl::ResamplingWithPrior::prior_ratio_
double prior_ratio_
Definition: ResamplingWithPrior.h:46
bfl::ResamplingWithPrior::ResamplingWithPrior
ResamplingWithPrior(std::unique_ptr< bfl::ParticleSetInitialization > init_model, const double prior_ratio, const unsigned int seed) noexcept
Definition: ResamplingWithPrior.cpp:19
bfl::ResamplingWithPrior::operator=
ResamplingWithPrior & operator=(ResamplingWithPrior &&resampling) noexcept
Definition: ResamplingWithPrior.cpp:48
bfl
Port of boost::any for C++11 compilers.
Definition: AdditiveMeasurementModel.h:13
Resampling.h
bfl::ResamplingWithPrior::~ResamplingWithPrior
virtual ~ResamplingWithPrior() noexcept=default
bfl::ResamplingWithPrior
Definition: ResamplingWithPrior.h:25
bfl::ResamplingWithPrior::resample
void resample(const ParticleSet &cor_particles, ParticleSet &res_particles, Eigen::Ref< Eigen::VectorXi > res_parents) override
Definition: ResamplingWithPrior.cpp:61
ParticleSetInitialization.h
bfl::ResamplingWithPrior::sort_indices
std::vector< unsigned int > sort_indices(const Eigen::Ref< const Eigen::VectorXd > &vector)
Definition: ResamplingWithPrior.cpp:108
bfl::Resampling
Definition: Resampling.h:22
ParticleSet.h
bfl::ParticleSet
Definition: ParticleSet.h:20
bfl::ResamplingWithPrior::init_model_
std::unique_ptr< bfl::ParticleSetInitialization > init_model_
Definition: ResamplingWithPrior.h:44