LinearDeath

The class LinearDeath 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_D\) in a cell with capacity \(K\) and a local population size of \(N\) is calculated as follows:

\[p_D = d_0 + (\theta - d_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/LinDeathCoords.png

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

Code:

Attributes

ATTR_LINDEATH_NAME

“LinearDeath”

action name

ATTR_LINDEATH_D0_NAME

“LinearDeath_d0”

death probability for N=0

ATTR_LINDEATH_TURNOVER_NAME

“LinearDeath_theta”

turnover

ATTR_LINDEATH_CAPACITY_NAME

“LinearDeath_K”

capacity

Public Methods

constructors

LinearDeath(SPopulation<T> *pPop, SCellGrid *pCG, std::string sID, WELL512 **apWELL);
LinearDeath(SPopulation<T> *pPop, SCellGrid *pCG, std::string sID, WELL512 **apWELL, double dD0, double dTheta, double dK);
LinearDeath(SPopulation<T> *pPop, SCellGrid *pCG, std::string sID, WELL512 **apWELL, double dD0, 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).

dD0

The value for \(d_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 death probabilituies.

destructor

virtual ~LinearDeath();

Deletes the array of birth probabilituies.

initialize

virtual int initialize(float fT);
fT

Current simulation step.

In this method the death 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 death probability; if it is less, the agent is registered for death.

extractAttributesQDF

virtual int extractAttributesQDF(hid_t hSpeciesGroup);
hSpeciesGroup

HDF handle for the species group to read from.

This method reads the atttributes 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.

tryGetAttributes

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 \(d_0\) (ATTR_LINDEATH_D0_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 LinearDeath object whose attributes match those of this.