53 #if !defined(LIBEVOCOSM_ROULETTE_H)
54 #define LIBEVOCOSM_ROULETTE_H
62 #include "evocommon.h"
100 double a_min_weight = std::numeric_limits<double>::epsilon(),
101 double a_max_weight = std::numeric_limits<double>::max());
113 double a_min_weight = std::numeric_limits<double>::epsilon(),
114 double a_max_weight = std::numeric_limits<double>::max());
153 double set_weight(
size_t a_index,
double a_weight);
double m_total_weight
Total weight of all indexes.
Definition: roulette.h:180
double m_max_weight
Maximum possible weight value.
Definition: roulette.h:186
double * m_weights
Array of m_weights.
Definition: roulette.h:177
size_t get_size() const
Get size (number of weights)
Definition: roulette.h:141
roulette_wheel & operator=(const roulette_wheel &a_source)
Assignment operator.
A toolkit and framework for implementing evolutionary algorithms.
Definition: analyzer.h:60
Elements shared by all classes in Evocosm.
Definition: evocommon.h:117
A simulated roulette wheel for weighted selection.
Definition: roulette.h:89
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)
~roulette_wheel()
Destructor.
size_t get_index() const
Retrieve a random index.
double get_weight(size_t a_index) const
Get the weight for an index.
double set_weight(size_t a_index, double a_weight)
Change the weight assigned to an entry.
double m_min_weight
Minimum possible weight value.
Definition: roulette.h:183
size_t m_size
Number of weights in this wheel.
Definition: roulette.h:174