Class SymWorld

Inheritance Relationships

Base Type

  • public emp::World< Organism >

Derived Types

Class Documentation

class SymWorld : public emp::World<Organism>

Subclassed by EfficientWorld, LysisWorld, PggWorld

Public Functions

SymWorld(emp::Random &_random)

Input: The world’s random seed

Output: None

Purpose: To construct an instance of SymWorld

~SymWorld()

Input: None

Output: None

Purpose: To destruct the data nodes belonging to SymWorld to conserve memory.

void SetVertTrans(double vt)

Input: The double representing the vertical transmission rate

Output: None

Purpose: To set the vertical transmission rate

void SetResPerUpdate(double val)

Input: The double representing the number of resources each host gets in each update.

Output: None

Purpose: To set the resources that each host gets per update.

void SetLimitedRes(bool val)

Input: To boolean representing if resources are limited or not.

Output: None

Purpose: To allow for resources to be limited or unlimited.

void SetFreeLivingSyms(bool flp)

Input: The boolean representing if symbionts are allowed to be free living.

Output: None

Purpose: To allow for free-living symbionts

void SetMoveFreeSyms(bool mfs)

Input: The bool representing if free living symbionts are permitted to move around in the world.

Output: None

Purpose: To set the value representing if FLS are permitted to move around.

void SetNumPhyloBins(size_t _in)

Input: The size_t number of bins that organisms should be placed into when phylogeny tracking is on.

Output: None

Purpose: To set the number of bins used by phylogenies.

void SetTrackPhylogeny(bool _in)

Input: The bool representing whether phylogenies should be tracked.

Output: None

Purpose: To set the value representing whether phylogenies should be tracked.

void SetTotalRes(int val)

Input: The int representing the total number of resources for the world.

Output: None

Purpose: To set the total number of resources in the world. If limited resources is off, then the total resource value is of no consequence.

emp::World<Organism>::pop_t GetPop()

Input: None

Output: The pop_t value that represents the world’s population.

Purpose: To get the world’s population of organisms.

emp::World<Organism>::pop_t GetSymPop()

Input: None

Output: The pop_t value that represent the world’s symbiont population.

Purpose: To get the world’s symbiont population.

bool WillTransmit()

Input: None

Output: The boolean representing if vertical transmission will occur

Purpose: To determine if vertical transmission will occur

emp::Ptr<emp::Systematics<Organism, int>> GetHostSys()

Input: None

Output: The systematic object tracking hosts

Purpose: To retrieve the host systematic

emp::Ptr<emp::Systematics<Organism, int>> GetSymSys()

Input: None

Output: The systematic object tracking hosts

Purpose: To retrieve the symbiont systematic

fun_calc_info_t GetCalcInfoFun()

Input: None

Output: The standard function object that determines which bin organisms should belong to depending on their interaction value

Purpose: To classify organsims based on their interaction value.

emp::Ptr<emp::Taxon<int>> AddSymToSystematic(emp::Ptr<Organism> sym, emp::Ptr<emp::Taxon<int>> parent_taxon = nullptr)

Input: The symbiont to be added to the systematic

Output: the taxon the symbiont is added to.

Purpose: To add a symbiont to the systematic and to set it to track its taxon

int PullResources(int desired_resources)

Input: The amount of resourcces an organism wants from the world.

Output: If there are unlimited resources or the total resources are greater than those requested, returns the amount of desired resources. If total_res is less than the desired resources, but greater than 0, then total_res will be returned. If none of these are true, then 0 will be returned.

Purpose: To determine how many resources to distribute to each organism.

void Resize(size_t new_width, size_t new_height)

Input: The size_t representing the world’s new width; the size_t representing the world’s new height.

Output: None

Purpose: To overwrite the Empirical resize so that sym_pop is also resized

void Resize(size_t new_size)

Input: The size_t representing the new size of the world

Output: None

Purpose: To override the Empirical Resize function with a single-arg method that can be used for AddOrgAt vector expansions

void AddOrgAt(emp::Ptr<Organism> new_org, emp::WorldPosition pos, emp::WorldPosition p_pos = emp::WorldPosition())

Input: The pointer to the new organism; the world position of the location to add the new organism.

Output: None

Purpose: To overwrite the empirical AddOrgAt function to permit syms to be added into sym_pop

emp::WorldPosition DoBirth(emp::Ptr<Organism> new_org, emp::WorldPosition p_pos)

Input: (1) The pointer to the organism that is being birthed; (2) The size_t location of the parent organism.

Output: The WorldPosition of the position of the new organism.

Purpose: To introduce new organisms to the world.

int GetNeighborHost(size_t i)

Input: The size_t value representing the location whose neighbors are being searched.

Output: If there are no occupied neighboring positions, -1 will be returned. If there are occupied neighboring positions, then the location of one occupied position will be returned.

Purpose: To determine the location of a valid occupied neighboring position.

void InjectSymbiont(emp::Ptr<Organism> new_sym)

Input: The pointer to an organism that will be injected into a host.

Output: None

Purpose: To add a symbiont to a host’s symbionts.

void WritePhylogenyFile(const std::string &filename)

Definitions of data node functions, expanded in DataNodes.h

Input: The address of the string representing the suffixes for the files to be created.

Output: None.

Purpose: To setup and write to the files that track the symbiont systematic information and the host systematic information

void WriteDominantPhylogenyFiles(const std::string &filename)
emp::Ptr<emp::Taxon<int>> GetDominantSymTaxon()
emp::Ptr<emp::Taxon<int>> GetDominantHostTaxon()
emp::vector<emp::Ptr<emp::Taxon<int>>> GetDominantFreeHostedSymTaxon()
emp::DataFile &SetupSymIntValFile(const std::string &filename)

Input: The address of the string representing the file to be created’s name

Output: The address of the DataFile that has been created.

Purpose: To set up the file that will be used to track the average symbiont interaction value, the total number of symbionts, the total number of symbionts in a host, the total number of free syms and set up a histogram of the symbiont’s interaction values.

emp::DataFile &SetupHostIntValFile(const std::string &filename)

Input: The address of the string representing the file to be created’s name

Output: The address of the DataFile that has been created.

Purpose: To set up the file that will be used to track host’s interaction values, the total number of hosts, the total number of colony forming units, and the histogram of the host’s interaction values

emp::DataFile &SetUpFreeLivingSymFile(const std::string &filename)

Input: The address of the string representing the file to be created’s name

Output: The address of the DataFile that has been created.

Purpose: To set up the file that will be used to track mean information about the free living symbionts in the world. This includes: (1) their total count, (2) the counts of the free and hosted symbionts, (3) the interaction values for the free and hosted symbionts, and (4) the infection chances from the total population, free symbionts, and hosted symbionts.

emp::DataMonitor<int> &GetHostCountDataNode()

Input: None

Output: The DataMonitor<int>& that has the information representing the host count.

Purpose: To collect data on the host count to be saved to the data file that is tracking host count

emp::DataMonitor<int> &GetSymCountDataNode()

Input: None

Output: The DataMonitor<int>& that has the information representing the symbiont count.

Purpose: To collect data on the symbiont count to be saved to the data file that is tracking symbiont count

emp::DataMonitor<int> &GetCountHostedSymsDataNode()

Input: None

Output: The DataMonitor<double>& that has the information representing the count of the hosted symbionts.

Purpose: To collect data on the count of the hosted symbionts to be saved to the data file that is tracking the count of the hosted symbionts.

emp::DataMonitor<int> &GetCountFreeSymsDataNode()

Input: None

Output: The DataMonitor<double>& that has the information representing the count of the free symbionts.

Purpose: To collect data on the count of the free symbionts to be saved to the data file that is tracking the count of the free symbionts.

emp::DataMonitor<int> &GetUninfectedHostsDataNode()

Input: None

Output: The DataMonitor<int>& that has the information representing the count of the uninfected hosts

Purpose: To collect data on the count of the uninfected hosts to be saved to the data file that is tracking the count of the uninfected hosts.

emp::DataMonitor<int> &GetCFUDataNode()

Input: None

Output: The DataMonitor<int>& that has the information representing the number of colony forming units.

Purpose: To collect data on the CFU count to be saved to the data file that is tracking CFU

emp::DataMonitor<double, emp::data::Histogram> &GetHostIntValDataNode()

Input: None

Output: The DataMonitor<double, emp::data::Histogram>& that has the information representing the host interaction value.

Purpose: To collect data on the host interaction value to be saved to the data file that is tracking host interaction value.

emp::DataMonitor<double, emp::data::Histogram> &GetSymIntValDataNode()

Input: None

Output: The DataMonitor<double, emp::data::Histogram>& that has the information representing the symbiont interaction value.

Purpose: To collect data on the symbiont interaction value to be saved to the data file that is tracking symbionts interaction value.

emp::DataMonitor<double, emp::data::Histogram> &GetFreeSymIntValDataNode()

Input: None

Output: The DataMonitor<double>& that has the information representing the free symbiont’s interaction value.

Purpose: To collect data on the interaction value of the free symbionts to be saved to the data file that is tracking the interaction value of the free symbionts.

emp::DataMonitor<double, emp::data::Histogram> &GetHostedSymIntValDataNode()

Input:None

Output:

Purpose: To access the data node that is tracking the hosted symbiont interaction value

emp::DataMonitor<double, emp::data::Histogram> &GetSymInfectChanceDataNode()

Input: None

Output: The DataMonitor<double, emp::data::Histogram>& that has the information representing the infection chance for each symbionts.

Purpose: To access the data node that is tracking the symbiont infection chance

emp::DataMonitor<double, emp::data::Histogram> &GetFreeSymInfectChanceDataNode()

Input: None

Output: The DataMonitor<double, emp::data::Histogram>& that has the information representing the free symbionts’ chance of infection

Purpose: To access the data node that is tracking the infection chance within the free symbionts.

emp::DataMonitor<double, emp::data::Histogram> &GetHostedSymInfectChanceDataNode()

Input: None

Output: The DataMonitor<double, emp::data::Histogram>& that has the information representing the infection chance for the hosted symbionts

Purpose: To retrieve the data nodes that is tracking the infection chance within the hosted symbionts.

void MoveIntoNewFreeWorldPos(emp::Ptr<Organism> sym, emp::WorldPosition parent_pos)

Input: The pointer to the symbiont that is moving, the WorldPosition of its current location.

Output: None

Purpose: To move a symbiont into a new world position.

void SymDoBirth(emp::Ptr<Organism> sym_baby, emp::WorldPosition parent_pos)

Input: The pointer to the organism that is being birthed, and the WorldPosition location of the parent symbiont.

Output: None

Purpose: To birth a new symbiont. If free living symbionts is on, the new symbiont can be put into an unoccupied place in the world. If not, then it will be placed in a host near its parent’s location, or deleted if the parent’s location has no eligible near-by hosts.

void MoveFreeSym(emp::WorldPosition pos)

Input: The WorldPosition location of the symbiont to be moved.

Output: None

Purpose: To move a symbiont, either into a host, or into a free world position

emp::Ptr<Organism> GetSymAt(size_t location)
emp::Ptr<Organism> ExtractSym(size_t i)

Input: The size_t representing the location of the symbiont to be extracted from the world.

Output: The pointer to the organism that was removed from the world

Purpose: To remove a symbiont from the world

void DoSymDeath(size_t i)

Input: The size_t representing the location of the symbiont to be deleted from the world.

Output: None

Purpose: To delete a symbiont from the world.

void Update()

Input: None

Output: None

Purpose: To call the process functions for hosts and symbionts.

Protected Types

using fun_calc_info_t = std::function<int(Organism&)>

Protected Attributes

double vertTrans = 0

Purpose: Represents the vertical transmission rate. This can be set with SetVertTrans()

int total_res = -1

Purpose: Represents the total resources in the world. This can be set with SetTotalRes()

bool limited_res = false

Purpose: Represents if resources are limited or not. This can be set with SetLimitedRes()

bool do_free_living_syms = false

Purpose: Represents if free living symbionts are allowed. This can be set with SetFreeLivingSyms()

double resources_per_host_per_update = 0

Purpose: Represents how many resources each host gets per update. This can be set with SetResPerUpdate()

bool move_free_syms = false

Purpose: Represents if free living symbionts are permitted to move around the world.

bool track_phylogeny = false

Purpose: Represents if phylogeneis should be tracked. This can be set with SetTrackPhylogeny()

size_t num_phylo_bins

Purpose: Represents how many bins to place organisms into when tracking phylogenies.

pop_t sym_pop

Purpose: Represents the free living sym environment, parallel to “pop” for hosts

fun_calc_info_t calc_info_fun

Purpose: Represents a standard function object which determines which taxon an organism belongs to.

emp::Ptr<emp::Systematics<Organism, int>> host_sys

Purpose: Represents the systematics object tracking hosts.

emp::Ptr<emp::Systematics<Organism, int>> sym_sys

Purpose: Represents the systematics object tracking symbionts.

emp::Ptr<emp::DataMonitor<double, emp::data::Histogram>> data_node_hostintval
emp::Ptr<emp::DataMonitor<double, emp::data::Histogram>> data_node_symintval
emp::Ptr<emp::DataMonitor<double, emp::data::Histogram>> data_node_freesymintval
emp::Ptr<emp::DataMonitor<double, emp::data::Histogram>> data_node_hostedsymintval
emp::Ptr<emp::DataMonitor<double, emp::data::Histogram>> data_node_syminfectchance
emp::Ptr<emp::DataMonitor<double, emp::data::Histogram>> data_node_freesyminfectchance
emp::Ptr<emp::DataMonitor<double, emp::data::Histogram>> data_node_hostedsyminfectchance
emp::Ptr<emp::DataMonitor<int>> data_node_hostcount
emp::Ptr<emp::DataMonitor<int>> data_node_symcount
emp::Ptr<emp::DataMonitor<int>> data_node_freesymcount
emp::Ptr<emp::DataMonitor<int>> data_node_hostedsymcount
emp::Ptr<emp::DataMonitor<int>> data_node_cfu
emp::Ptr<emp::DataMonitor<int>> data_node_uninf_hosts