Starver¶
This page describes the class Starver
The class Starver
is derived from Action
and is used to decrease agnts’ masses at each step.
This class has been tailored for the use with SheepPop
(see QHG Tutorial 08 - Simple Predator-Prey).
- Code:
Attributes
|
“AnimalReproducer” |
action name |
|
“MassFert” |
minimum fertility mass |
|
“MassBaby” |
decay (fraction of mass to subtract) |
Public Methods¶
constructor
¶
Starver(SPopulation<T> *pPop, SCellGrid *pCG, std::string sID);
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.
destructor
¶
virtual ~Starver();
The destructor destroy some openMP locks.
execute
¶
virtual int execute(int iAgentIndex, float fT);
iAgentIndex
Index of the current agent.
fT
Current simulation step.
Decreases the agent’s mass: \(m_A = (1 - d) \cdot m_A\) , where \(m_A\) is the agent’s mass, and \(d\) is the decay factor.
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.
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 Starver
object whose attributes match those of this
.