class Gambit::jswarm_1_0_0::particle
An individual particle in a swarm.
#include <jswarm.hpp>
Public Functions
Name | |
---|---|
particle(int nPar, std::vector< double > & lb, std::vector< double > & ub, rng_type & generator) Constructor. | |
void | init(bool zero_vel) Initialise a particle with a random position and zero/random velocity. |
void | update_personal_best() Update the particle’s personal best-seen fit so far. |
void | reflect() Reflect a particle’s position and velocity about the walls of the prior box. |
std::vector< double > | discretised_x(const std::vector< int > & indices) Return a particle’s position vector, discretised at some specified indices. |
Public Attributes
Name | |
---|---|
std::vector< double > | x Particle position vector. |
std::vector< double > | v Particle velocity vector. |
double | lnlike Current objective value. |
double | personal_best_value Current personal best fit. |
std::vector< double > | personal_best_x Current personal best-fit vector. |
Public Functions Documentation
function particle
particle(
int nPar,
std::vector< double > & lb,
std::vector< double > & ub,
rng_type & generator
)
Constructor.
function init
void init(
bool zero_vel
)
Initialise a particle with a random position and zero/random velocity.
function update_personal_best
void update_personal_best()
Update the particle’s personal best-seen fit so far.
Update the particle’s personal best fit seen so far.
function reflect
void reflect()
Reflect a particle’s position and velocity about the walls of the prior box.
Reflect a particle’s position and velocity off the walls of the prior box.
function discretised_x
std::vector< double > discretised_x(
const std::vector< int > & indices
)
Return a particle’s position vector, discretised at some specified indices.
Public Attributes Documentation
variable x
std::vector< double > x;
Particle position vector.
variable v
std::vector< double > v;
Particle velocity vector.
variable lnlike
double lnlike;
Current objective value.
variable personal_best_value
double personal_best_value;
Current personal best fit.
variable personal_best_x
std::vector< double > personal_best_x;
Current personal best-fit vector.
Updated on 2025-02-12 at 15:36:39 +0000