LinearBirth

The class LinearBirth is derived from action and calculates a birth probablity for each paired female agent. If a random number is less than that probability an agent birth is registered.

The birth probability \(p_B\) in a cell with capacity \(K\) and a local population size of \(N\) is calculated as follows:

\[p_B = b_0 + (\theta - b_0) * N/K\]

where \(b_0\) is the birth probability for \(N = 0\), and \(\theta\) is the turnover i.e. the birth probability for \(N = K\).

../../images/LinBirthCoords.png

These birth probabilities only depend on the environment, not on the agents’ attributes.

Code:

Attributes

ATTR_LINBIRTH_NAME

“LinearBirth”

action name

ATTR_LINBIRTH_B0_NAME

“LinearBirth_b0”

birth probability for N=0

ATTR_LINBIRTH_TURNOVER_NAME

“LinearBirth_theta”

turnover

ATTR_LINBIRTH_CAPACITY_NAME

“LinearBirth_K”

capacity

Public Methods

constructors

LinearBirth(SPopulation<T> *pPop, SCellGrid *pCG, std::string sID, WELL512 **apWELL);
LinearBirth(SPopulation<T> *pPop, SCellGrid *pCG, std::string sID, WELL512 **apWELL, double dB0, double dTheta, double dK);
LinearBirth(SPopulation<T> *pPop, SCellGrid *pCG, std::string sID, WELL512 **apWELL, double dB0, double dTheta, double* adK, int iStride);
pPop

A pointer to the SPopulation object performing this action.

pCG

A pointer to the SCellGrid object on which the simulation runs.

sID

An ID for this action.

apWELL

A pointer to an array of WELL512 random number generators (one for each thread).

dB0

The value for \(b_0\).

dTheta

The value for \(\theta\).

dK

The carrying capacity (globally uniform).

adK

Array of carrying capacity values, one for eac cell.

iStride

Stride to read the array.

Allocates an array to hold the birth probabilities.

destructor

virtual ~LinearBirth();

Deletes the array of birth probabilituies.

initialize

virtual int initialize(float fT);
fT

Current simulation step.

In this method the birth probabilities for all cells are calculated.

execute

virtual int execute(int iAgentIndex, float fT);
iAgentIndex

Current agent’s index.

fT

Current simulation step

This method is called for all agents (in parallel).
For each agent the a random number is compared to the local birth probability; if it is less a new birth is registered.

extractAttributesQDF

virtual int extractAttributesQDF(hid_t hSpeciesGroup);
hSpeciesGroup

HDF handle for the species group to read from.

This method reads the attributes of this action from a QDF.

writeAttributesQDF

virtual int writeAttributesQDF(hid_t hSpeciesGroup);
hSpeciesGroup

HDF handle for the species group to write to.

This method writes the attributes of this action to the specified group in a QDF file.

constructor

virtual int tryGetAttributes(const ModuleComplex *pMC);
pMC

A ModuleComplex object.

Extracts the action’s attributes from the ModuleComplex object.

modifyAttributes

virtual int modifyAttributes(const std::string sAttrName, double dValue);
sAttrName

Name of attribute to change.

dValue

Value to set the attribute to.

This method can change the values of \(b_0\) (ATTR_LINBIRTH_B0_NAME), \(\theta\) (ATTR_LINBIRTH_TURNOVER_NAME) or the global capacity \(K\) (ATTR_LINBIRTH_CAPACITY_NAME).

isEqual

virtual bool isEqual(Action<T> *pAction, bool bStrict);
pAction

Pointer to an action object to compare with this.

bStrict

Strictness of comparisons (ignored here).

pAction is equal to this, if it is a LinearBirth object whose attributes match those of this.