Empirical
|
Build a class to track distances between organisms. More...
#include <World_structure.h>
Public Member Functions | |
World_MinDistInfo (World< ORG > &in_world, const TraitSet< ORG > &in_traits) | |
double | CalcDist (size_t id1, size_t id2) |
void | Refresh_AgainstBin (size_t refresh_id, size_t target_bin) |
void | Refresh (size_t refresh_id, size_t start_id=0) |
size_t | CalcBin (size_t id) |
Calculate which bin an organism should be in. More... | |
void | ResetBins () |
Reset all of the bins in the multidimensional grid for nearest-neighbor analysis. More... | |
void | Setup () |
void | Clear () |
size_t | FindKill () |
size_t | GetBirthPos (size_t world_size) |
Return an empty world position. If none are available, return the position of an org to be killed. More... | |
void | Update (size_t pos) |
Assume a position has changed; refresh it AND everything that had it as a closest connection. More... | |
bool | OK () |
A debug function to make sure the internal state is all valid. More... | |
Public Attributes | |
emp::vector< size_t > | nearest_id |
For each individual, whom are they closest to? More... | |
emp::vector< double > | distance |
And what is their distance? More... | |
World< ORG > & | world |
World object being tracked. More... | |
TraitSet< ORG > | traits |
Traits we are tryng to spread. More... | |
emp::vector< double > | min_vals |
Smallest value found for each trait. More... | |
emp::vector< double > | max_vals |
Largest value found for each trait. More... | |
emp::vector< double > | bin_width |
Largest value found for each trait. More... | |
bool | is_setup |
Have we initialized the internal data stucture? More... | |
size_t | num_trait_bins |
How many bins should we use for each trait? More... | |
size_t | num_total_bins |
How many bins are there overall? More... | |
emp::vector< std::set< size_t > > | bin_ids |
Which org ids fall into each bin? More... | |
emp::vector< size_t > | org_bins |
Which bin is each org currently in? More... | |
Static Public Attributes | |
static constexpr size_t | ID_NONE = (size_t) -1 |
ID for organism does not exist. More... | |
Build a class to track distances between organisms.
DiverseElites is similar to MAP-Elites, but rather than merely keep the elites on a pre-defined grid, it merely tries to maintain maximal distance between elites in trait space. The main advantages to this technique are (1) It's easy to build up an inital population that grows in diversity over time, and (2) You don't need to predefine box sizes or even limits to trait values. Set the population to use a DiverseElites structure. This means that organism placement has two key components: 1: Organism position is in continuous space based on phenotypic traits. 2: When the population is full, nearby organisms must battle to keep their position.
Note: Since organisms compete with their predecessors for space in the populations, synchronous generations do not make sense.
|
inline |
|
inline |
Calculate which bin an organism should be in.
|
inline |
|
inline |
|
inline |
Find the best organism to kill in the popualtion. In this case, find the two closest organisms and kill the one with the lower fitness.
|
inline |
Return an empty world position. If none are available, return the position of an org to be killed.
|
inline |
A debug function to make sure the internal state is all valid.
|
inline |
|
inline |
|
inline |
Reset all of the bins in the multidimensional grid for nearest-neighbor analysis.
|
inline |
|
inline |
Assume a position has changed; refresh it AND everything that had it as a closest connection.
Determine if this new point extends the range of any phenotypes.
Remove org if from the bin we currently have it in.
Determine if we need to re-place all orgs in the structure
Otherwise just update closest connections to this org.
emp::vector<std::set<size_t> > emp::World_MinDistInfo< ORG >::bin_ids |
Which org ids fall into each bin?
emp::vector<double> emp::World_MinDistInfo< ORG >::bin_width |
Largest value found for each trait.
emp::vector<double> emp::World_MinDistInfo< ORG >::distance |
And what is their distance?
|
static |
ID for organism does not exist.
bool emp::World_MinDistInfo< ORG >::is_setup |
Have we initialized the internal data stucture?
emp::vector<double> emp::World_MinDistInfo< ORG >::max_vals |
Largest value found for each trait.
emp::vector<double> emp::World_MinDistInfo< ORG >::min_vals |
Smallest value found for each trait.
emp::vector<size_t> emp::World_MinDistInfo< ORG >::nearest_id |
For each individual, whom are they closest to?
size_t emp::World_MinDistInfo< ORG >::num_total_bins |
How many bins are there overall?
size_t emp::World_MinDistInfo< ORG >::num_trait_bins |
How many bins should we use for each trait?
emp::vector<size_t> emp::World_MinDistInfo< ORG >::org_bins |
Which bin is each org currently in?
TraitSet<ORG> emp::World_MinDistInfo< ORG >::traits |
Traits we are tryng to spread.
World<ORG>& emp::World_MinDistInfo< ORG >::world |
World object being tracked.