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, emp::Ptr<SymConfigBase> _config)

Input: The world’s random seed

Output: None

Purpose: To construct an instance of SymWorld

~SymWorld()

Input: None

Output: None

Purpose: To destruct the objects belonging to SymWorld to conserve memory.

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 resources 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 id)

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 InjectHost(emp::Ptr<Organism> new_host)

Input: The pointer to a host that will be added to the world. This function assumes that the pop vector has not been resized to fit the world yet.

Output: None

Purpose: To add a host to the world.

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

Input: The pointer to an organism that will be injected into the world.

Output: None

Purpose: To add a symbiont to the world, either into a host or into a sym world cell.

void CreateDataFiles()

Definitions of data node functions, expanded in DataNodes.h

Input: None.

Output: None.

Purpose: To create and set up the data files (excluding for phylogeny) that contain data for the experiment.

void WritePhylogenyFile(const std::string &filename)

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. Prints header keys to the file.

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::DataFile &SetUpTransmissionFile(const std::string &filename)

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 counts of attempted tranmissions.

void SetupHostFileColumns(emp::DataFile &file)

Input: The Empirical DataFile object tracking data nodes.

Output: None.

Purpose: To define which data nodes should be tracked by this data file. Defines what columns should be called.

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> &GetHorizontalTransmissionAttemptCount()

Input: None

Output: The DataMonitor<int>& that has the information representing how many attempts were made to horizontally transmit.

Purpose: To retrieve the data nodes that is tracking the number of attempted horizontal transmissions.

emp::DataMonitor<int> &GetHorizontalTransmissionSuccessCount()

Input: None

Output: The DataMonitor<int>& that has the information representing how many successful attempts were made to horizontally transmit.

Purpose: To retrieve the data nodes that is tracking the number of successful horizontal transmissions.

emp::DataMonitor<int> &GetVerticalTransmissionAttemptCount()

Input: None

Output: The DataMonitor<int>& that has the information representing how many attempts were made to vertically transmit.

Purpose: To retrieve the data nodes that is tracking the number of attempted vertical transmissions.

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 Setup()

Definitions of setup functions, expanded in WorldSetup.cc

Input: None.

Output: None.

Purpose: Prepare the world for an experiment by applying the configuration settings and populating the world with hosts and symbionts.

void SetupHosts (long unsigned int *POP_SIZE)

Input: The number of hosts.

Output: None.

Purpose: To populate the world with hosts with appropriate phenotypes.

void SetupSymbionts (long unsigned int *total_syms)

Input: The number of symbionts.

Output: None.

Purpose: To populate the world with symbionts with appropriate phenotypes.

emp::WorldPosition 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: The WorldPosition object describing the symbiont’s new location (it describes an invalid position if the symbiont is deleted during movement)

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

bool IsInboundsPos(emp::WorldPosition pos)

Input: The WorldPosition object to be checked.

Output: Wether the input object is within world bounds.

Purpose: To determine whether the location of free-living organisms is within the bounds of the free-living worlds (the size of the pop and sym_pop vectors).

emp::WorldPosition 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: The WorldPosition object describing the position the symbiont was born into (index = position in a host, 0 for free living and offset by one for position in host sym vector. id = position of self or host in sym_pop or pop vector). An invalid WorldPosition object is returned if the sym was killed.

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 extracted from the world.

Purpose: To extract a symbiont from the world without deleting it.

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 SetMutationZero()

Input: None

Output: None

Purpose: To set all settings in the MUTATION group to 0 for the no-mutation updates.

void RunExperiment(bool verbose = true)

Input: Optional boolean “verbose” that specifies whether to print the update numbers to standard output or not, defaults to true.

Output: None

Purpose: Run the number of updates and non-mutation updates specified in the configuration settings.

void Update()

Input: None

Output: None

Purpose: To simulate a timestep in the world, which includes calling the process functions for hosts and symbionts and updating the data nodes.

Protected Types

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

Protected Attributes

int total_res = -1

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

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<SymConfigBase> my_config = NULL

Purpose: Represents the configuration settings for a particular run.

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_uninf_hosts
emp::Ptr<emp::DataMonitor<int>> data_node_attempts_horiztrans
emp::Ptr<emp::DataMonitor<int>> data_node_successes_horiztrans
emp::Ptr<emp::DataMonitor<int>> data_node_attempts_verttrans