Empirical
|
#include <UnorderedIndexMap.h>
Public Member Functions | |
UnorderedIndexMap (size_t _items=0, double init_weight=0.0) | |
UnorderedIndexMap (const UnorderedIndexMap &)=default | |
UnorderedIndexMap (UnorderedIndexMap &&)=default | |
~UnorderedIndexMap ()=default | |
UnorderedIndexMap & | operator= (const UnorderedIndexMap &)=default |
UnorderedIndexMap & | operator= (UnorderedIndexMap &&)=default |
size_t | GetSize () const |
How many indices are in this map? More... | |
double | GetWeight () const |
What is the total weight of all indices in this map? More... | |
double | RawWeight (size_t id) const |
What is the current weight of the specified index? More... | |
double | GetWeight (size_t id) const |
double | RawProb (size_t id) const |
What is the probability of the specified index being selected? More... | |
double | GetProb (size_t id) const |
void | Resize (size_t new_size, double def_value=0.0) |
Change the number of indecies in the map. More... | |
size_t | size () const |
Standard library compatibility. More... | |
void | resize (size_t new_size) |
Standard library compatibility. More... | |
void | Clear () |
Reset all item weights to zero. More... | |
void | ResizeClear (size_t new_size) |
Change the size of this map AND change all weights to zero. More... | |
void | RawAdjust (size_t id, const double new_weight) |
void | Adjust (size_t id, const double new_weight) |
void | Adjust (const emp::vector< double > &new_weights) |
Adjust all index weights to the set provided. More... | |
void | AdjustAll (double new_weight) |
Adjust all index weights to the set provided. More... | |
size_t | Index (double index, size_t cur_id=0) const |
Determine the ID at the specified index position. More... | |
Proxy | operator[] (size_t id) |
Index into a specified ID. More... | |
double | operator[] (size_t id) const |
UnorderedIndexMap & | operator+= (UnorderedIndexMap &in_map) |
Add the weights in another index map to this one. More... | |
UnorderedIndexMap & | operator-= (UnorderedIndexMap &in_map) |
Substract the weigthes from another index map from this one. More... | |
void | DeferRefresh () |
A map of weighted indecies. If a random index is selected, the probability of an index being returned is directly proportional to its weight.
|
inline |
Construct an UnorderedIndexMap where num_items is the maximum number of items that can be placed into the data structure. All item weigths default to zero.
|
default |
|
default |
|
default |
|
inline |
|
inline |
Adjust all index weights to the set provided.
|
inline |
Adjust all index weights to the set provided.
|
inline |
Reset all item weights to zero.
|
inline |
Indicate that we need to adjust weights before relying on them in the future; this will prevent refreshes from occuring immediately and is useful when many updates to weights are likely to be done before any are accessed again.
|
inline |
|
inline |
How many indices are in this map?
|
inline |
What is the total weight of all indices in this map?
|
inline |
|
inline |
Determine the ID at the specified index position.
|
inline |
Add the weights in another index map to this one.
|
inline |
Substract the weigthes from another index map from this one.
|
default |
|
default |
|
inline |
Index into a specified ID.
|
inline |
|
inline |
Adjust the weight associated with a particular index in the map.
id | is the identification number of the item whose weight is being adjusted. |
weight | is the new weight for that entry. |
|
inline |
What is the probability of the specified index being selected?
|
inline |
What is the current weight of the specified index?
|
inline |
Change the number of indecies in the map.
|
inline |
Standard library compatibility.
|
inline |
Change the size of this map AND change all weights to zero.
|
inline |
Standard library compatibility.