35 #if !defined(LIBEVOCOSM_ROULETTE_H)
36 #define LIBEVOCOSM_ROULETTE_H
44 #include "evocommon.h"
82 double a_min_weight = std::numeric_limits<double>::epsilon(),
83 double a_max_weight = std::numeric_limits<double>::max());
95 double a_min_weight = std::numeric_limits<double>::epsilon(),
96 double a_max_weight = std::numeric_limits<double>::max());
135 double set_weight(
size_t a_index,
double a_weight);
size_t get_index() const
Retrieve a random index.
roulette_wheel & operator=(const roulette_wheel &a_source)
Assignment operator.
double set_weight(size_t a_index, double a_weight)
Change the weight assigned to an entry.
size_t m_size
Number of weights in this wheel.
Definition: roulette.h:156
double get_weight(size_t a_index) const
Get the weight for an index.
double m_min_weight
Minimum possible weight value.
Definition: roulette.h:165
double m_max_weight
Maximum possible weight value.
Definition: roulette.h:168
size_t get_size() const
Get size (number of weights)
Definition: roulette.h:123
roulette_wheel(const vector< double > &a_weights, double a_min_weight=std::numeric_limits< double >::epsilon(), double a_max_weight=std::numeric_limits< double >::max())
Creation constructor (from vector)
A toolkit and framework for implementing evolutionary algorithms.
Definition: evocommon.h:60
double m_total_weight
Total weight of all indexes.
Definition: roulette.h:162
Elements shared by all classes in Evocosm.
Definition: evocommon.h:115
A simulated roulette wheel for weighted selection.
Definition: roulette.h:71
double * m_weights
Array of m_weights.
Definition: roulette.h:159
~roulette_wheel()
Destructor.