3
* @author Ugo Cupcic <ugo@shadowrobot.com>, Contact <contact@shadowrobot.com>
11
#include "particle.hpp"
21
Particle::Particle( int population_size )
23
init_weight(population_size);
26
Particle::Particle( boost::ptr_vector<Particle>::iterator particle, bool reset_weight, float average_weight )
29
weight = average_weight;
31
weight = particle->weight;
33
squared_weight = weight * weight;
41
void Particle::init_weight( int population_size )
43
weight = 1.0f / ((float)population_size);
44
squared_weight = weight * weight;
47
float Particle::get_weight() const
52
float Particle::set_weight( float new_weight )
55
squared_weight = weight * weight;
57
return squared_weight;