Class convergence_calculator
Defined in File convergence_calculator.hpp
Inheritance Relationships
Base Types
public cosm::convergence::metrics::convergence_metrics
(Class convergence_metrics)public rer::client< convergence_calculator >
Class Documentation
-
class convergence_calculator : public cosm::convergence::metrics::convergence_metrics, public rer::client<convergence_calculator>
Convenience class for managing calculation of swarm convergence using any enabled methods.
Takes a set of optional callbacks for during construction for calculating the various quantities needed for convergence calculations (if a specific type of convergence calculation is enabled, then you obviously need to pass a valid callback to calculate the necessary input data).
Public Types
-
using headings_calc_cb_type = std::function<std::vector<rmath::radians>(size_t)>
Callback function that returns a vector of robot headings (1 per robot). Used to calculate swarm angular order.
Takes a single integer argument specifying the # OpenMP threads to be used, per configuration.
-
using nn_calc_cb_type = std::function<std::vector<double>(size_t)>
Callback function that returns a vector of nearest neighbor distances (1 per robot). Used to calculate swarm interactivity.
Takes a single integer argument specifying the # OpenMP threads to be used, per configuration.
-
using pos_calc_cb_type = std::function<std::vector<rmath::vector2d>(size_t)>
Callback function that returns a vector of robot positions (1 per robot). Used to calculate swarm positional entropy and velocity (SEPARATE calls per timestep). The calling application should cache the results of the computation passed to the calculator internally if separate calls to obtain the positions of each robot is expensive.
Takes a single integer argument specifying the # OpenMP threads to be used, per configuration.
-
using tasks_calc_cb_type = std::function<std::vector<int>(size_t)>
Callback function that returns a vector of robot tasks (as unique non-negative numbers, 1 per robot). Used to calculate swarm task distribution entropy.
Tasks a single integer argument specifying the # OpenMP threads to be used, per configuration.
Public Functions
-
~convergence_calculator(void) override
-
void angular_order_init(const headings_calc_cb_type &cb)
Set the callback for calculating angular_order. In order to actually calculate it time update is called, it must have also been enabled in configuration.
-
bool converged(void) const
Return swarm convergence status in an OR fashion (i.e. if ANY of the configured methods say convergence has occured, return
TRUE
).
-
void interactivity_init(const nn_calc_cb_type &cb)
Set the callback for calculating interactivity. In order to actually calculate it time update is called, it must have also been enabled in configuration.
-
void positional_entropy_init(const pos_calc_cb_type &cb)
Set the callback for calculating positional_entropy. In order to actually calculate it time update is called, it must have also been enabled in configuration.
-
void reset_metrics(void) override
-
virtual conv_status_t swarm_angular_order(void) const override
Return the conv_status_t for the angular order of the swarm. See angular_order for the calculation/input variables.
-
inline virtual double swarm_conv_epsilon(void) const override
Return the current convergence epsilon (threshold) for the swarm (can be static or vary in time). Captured here to make graph generation much easier in SIERRA.
-
virtual conv_status_t swarm_interactivity(void) const override
Return the conv_status_t for the interaction degree of the swarm. See interactivity for the calculation/input variables.
-
virtual conv_status_t swarm_positional_entropy(void) const override
Return the conv_status_t for the positional entropy of the swarm. See positional_entropy for the calculation/input variables.
-
virtual conv_status_t swarm_task_dist_entropy(void) const override
Return the conv_status_t for the task distribution entropy of the swarm. See task_dist_entropy for the calculation/input variables.
-
virtual conv_status_t swarm_velocity(void) const override
Return the conv_status_t for the velocity of the swarm. See velocity for the calculation/input variables.
-
void task_dist_entropy_init(const tasks_calc_cb_type &cb)
Set the callback for calculating task_dist_entropy. In order to actually calculate it time update is called, it must have also been enabled in configuration.
-
void update(void)
Update convergence calculations for the current timestep.
-
void velocity_init(const pos_calc_cb_type &cb)
Set the callback for calculating velocity. In order to actually calculate it time update is called, it must have also been enabled in configuration.
-
using headings_calc_cb_type = std::function<std::vector<rmath::radians>(size_t)>