File tool-distribute-meat.hpp¶
FileList > epiworld > tool-distribute-meat.hpp
Go to the source code of this file
Public Functions¶
| Type | Name |
|---|---|
| ToolToAgentFun< TSeq > | distribute_tool_randomly (epiworld_double prevalence, bool as_proportion=true, std::vector< size_t > agents_ids={}) |
| ToolToAgentFun< TSeq > | distribute_tool_to_entities (std::vector< double > prevalence, bool as_proportion=true) |
| ToolToAgentFun< TSeq > | distribute_tool_to_set (std::vector< size_t > agents_ids) Distributes a tool to a set of agents. |
Public Functions Documentation¶
function distribute_tool_randomly¶
template<typename TSeq>
inline ToolToAgentFun < TSeq > distribute_tool_randomly (
epiworld_double prevalence,
bool as_proportion=true,
std::vector< size_t > agents_ids={}
)
Function template to distribute a tool randomly to agents in a model.
Template parameters:
TSeqThe sequence type used in the model.
Parameters:
prevalenceThe prevalence of the tool in the population.as_proportionFlag indicating whether the prevalence is given as a proportion or an absolute value.
Returns:
A lambda function that distributes the tool randomly to agents in the model.
function distribute_tool_to_entities¶
template<typename TSeq>
inline ToolToAgentFun < TSeq > distribute_tool_to_entities (
std::vector< double > prevalence,
bool as_proportion=true
)
Function template to distribute a tool to agents in each entity of a model.
Template parameters:
TSeqThe sequence type used in the model.
Parameters:
prevalenceA vector of prevalences for each entity in the model.as_proportionFlag indicating whether the prevalences are given as proportions or absolute values.
Returns:
A lambda function that distributes the tool to agents in each entity of the model.
function distribute_tool_to_set¶
Distributes a tool to a set of agents.
template<typename TSeq>
inline ToolToAgentFun < TSeq > distribute_tool_to_set (
std::vector< size_t > agents_ids
)
This function takes a vector of agent IDs and returns a lambda function that distributes a tool to each agent in the set.
The lambda function takes a reference to a Tool object and a pointer to a Model object as parameters. It iterates over the agent IDs and adds the tool to each agent using the add_tool() method of the Model object.
Template parameters:
Parameters:
agents_idsA vector of agent IDs representing the set of agents to distribute the tool to.
Returns:
A lambda function that distributes the tool to the set of agents.
The documentation for this class was generated from the following file epiworld-src/include/epiworld/tool-distribute-meat.hpp