Utilities
Parameters
Experiment ━━ Genus ━━ Species ━━ Organism ━━ Genotype ━━ Chromosome ━━ Node
┗━━━━ Phenotype
┗━━━━━ Link
A Genus
stores and manages a collection of Species
.
Experiment* experiment
Points to the Experiment
to which the Genus
belongs.
std::unordered_map<unsigned long int, unsigned int> logbook
Catalogs all tag
s by the key
property of the Link
or Node
they label.
unsigned int tag_counter
Counts the total number of catalogued Link
and Node
tag
s.
std::unordered_map<int, Species*> species
Catalogs all Species*
s by the group
property of the Species
s they reference.
std::vector<Organism*> organisms
Stores pointers to the Genus
' next generation of Organism
s.
Genus(Experiment* experiment_, std::vector<Graph> graphs_);
Constructs a Genus
by populating a single DOMINANT
Species
with Organism
s generated from a set of minimal input graphs_
. The Genus
is associated to the referenced input Experiment
.
~Genus()
Destructs the Genus
, as well as all of its Species
.
std::pair<unsigned long int, unsigned int> tag(unsigned int role_, element_type type_, unsigned int source_tag_, unsigned int target_tag_)
Returns the key
and tag
associated with a Link
or Node
uniquely identified by the input arguments.
std::pair<unsigned long int, unsigned int> log(unsigned long int key_)
Creates a new tag
, cataloguing it under the input key_
.
unsigned int size(const std::vector<int> groups_ = {0, 1})
Returns the number of Species*
s catalogued under the input groups_
.
std::vector<Species*>::iterator begin(int group_)
Returns an iterator at the beginning of the input group_
.
std::vector<Species*>::iterator end(int group_)
Returns an iterator at the end of the input group_
.
Species* front(int group_)
Returns the first Species*
catalogued under the input group_
.
Species* back(int group_)
Returns the last Orgainsm*
catalogued under the input group_
.
Species* insert(Species* spcecies_)
Stores the input species_
in the Genus
, returning the stored species_
.
Species* remove(Species* species_)
Removes the input species_
from the Genus
, returning the removed species_
.
void purge(Species* species_)
Removes the input Species*
from the Genus
, subsequently deleting the referenced Species
.
void purge(const std::vector<int> groups_ = {0, 1})
Removes every Species*
catalogued under the input groups_
, subsequently deleting each referenced Species
.
void toggle(Species* species_, int group_)
Ensures the referenced input Species
is toggled to the input group_
.
Species* random(const std::vector<int> groups_ = {0, 1}, const std::vector<double> weights_ = {})
Returns a random Species*
catalogued under one of the input groups_
. The weights_
argument sets the relative odds of each candidate Species*
being returned. When weights_
is empty, the same odds are assigned to all candidate Species*
.
std::vector<Species*> retrieve(const std::vector<int> groups_ = {0, 1})
Returns all Species*
catalogued under the input groups_
.
std::vector<Species*> sort(const std::vector<int> groups_ = {0, 1})
Sorts and returns the Species*
catalogued under the input groups_
. The sorting criterium is provided by the species_comparison
method.
void select()
Purges all stagnated Species
. The criterium for stagnation is provided by the species_rejection
method.
void spawn()
Spawns a new generation of Organism
s.
void speciate()
Assigns the Organism
s of a new generation to a new or existing Species
.
bool species_rejection(Species* species_)
Returns true
if the referenced input CONTESTANT
Species
' rank has been stagnated for several generational cycles. Returns false
otherwise.
static bool organism_comparison(Species* first_species_, Species* second_species_)
Compares the DOMINANT
Organism
s of each referenced input Species
through the organism_comparison
method.