Skip to content

Latest commit

 

History

History
213 lines (135 loc) · 5.25 KB

species.md

File metadata and controls

213 lines (135 loc) · 5.25 KB

Utilities
Parameters
Experiment ━━ Genus ━━ Species ━━ Organism ━━ Genotype ━━ Chromosome ━━ Node
                                                                ┗━━━━ Phenotype              ┗━━━━━ Link

Species

A Species stores and manages a collection of compatible Organisms.
 

Properties

Genus* genus

Points to the Genus to which the Species belongs.
 

taxon_group group

Specifies whether the Species belongs to the DOMINANT or CONTESTANT group within its Genus.
 

std::unordered_map<int, std::vector<Organism*>> organisms

Catalogs all Organism*s by the group property of the Organisms they reference.
 

double rank

The Species's rank.
 

Constructors

Species(Genus* genus_, taxon_group group_, std::vector<Graph> graphs_)

Constructs a Species by populating it with Organisms generated from a set of minimal input graphs_. The Species is assigned to the input group_ and associated to the referenced input Genus.
 

Species(Genus* genus_, taxon_group group_, Organism* organism_)

Constructs a Species from a single representative Organism. The Species is assigned to the input group_ and associated to the referenced input Genus.
 

Destructor

~Species()

Destructs the Species, as well as all of its Organisms.
 

Methods

unsigned int size(const std::vector<int> groups_ = {0, 1})

Returns the number of Organism*s catalogued under the input groups_.
 

std::vector<Organism*>::iterator begin(int group_)

Returns an iterator at the beginning of the input group_.
 

std::vector<Organism*>::iterator end(int group_)

Returns an iterator at the end of the input group_.
 

Organism* front(int group_)

Returns the first Orgainsm* catalogued under the input group_.
 

Organism* back(int group_)

Returns the last Orgainsm* catalogued under the input group_.
 

Organism* insert(Organism* organism_)

Stores the input organism_ in the Species, returning the stored organism_.
 

Organism* remove(Organism* organism_)

Removes the input organism_ from the Species, returning the removed organism_.
 

void purge(Organism* organism_)

Removes the input Organism* from the Species, subsequently deleting the referenced Organism.
 

void purge(const std::vector<int> groups_ = {0, 1})

Removes every Organism* catalogued under the input groups_, subsequently deleting each referenced Organism.
 

void toggle(Organism* organism_, int group_)

Ensures the referenced input Organism is toggled to the input group_.
 

Organism* random(const std::vector<int> groups_ = {0, 1}, const std::vector<double> weights_ = {})

Returns a random Organism* catalogued under one of the input groups_. The weights_ argument sets the relative odds of each candidate Organism* being returned. When weights_ is empty, the same odds are assigned to all candidate Organism*s.
 

std::vector<Organism*> retrieve(const std::vector<int> groups_ = {0, 1})

Returns all Organism*s catalogued under the input groups_.
 

std::vector<Organism*> sort(const std::vector<int> groups_ = {0, 1})

Sorts and returns the Organism*s catalogued under the input groups_. The sorting criterium is provided by the organism_comparison method.
 

void select()

Purges a fraction of the CONTESTANT Organisms belonging to the Species.
 

Organism* spawn()

Attempts to spawn an offspring Organism through either MUTATION or ASSIMILATION.
 

bool organism_compatibility(Organism* organism_)

Returns true if the referenced input Organism's Genotype is compatible with the Genotype of the Species' DOMINANT Organism. Returns false otherwise.
 

static bool organism_comparison(Organism* first_organism_, Organism* second_organism_)

If the referenced input Organisms possess the same score: returns true if first_organism_ references an Organism with a smaller Genotype than that of the Organism referenced by second_organism_; returns false otherwise.
If the referened input Organisms do not possess the same score: returns true if first_organism_ references an Organism with a smaller score than that of the Organism referenced by second_organism_; returns false otherwise.