Class Agent¶
template <typename TSeq>
#include <agent-bones.hpp>
Public Functions¶
| Type | Name |
|---|---|
| Agent () = default |
|
| Agent (Agent< TSeq > && p) |
|
| Agent (const Agent< TSeq > & p) |
|
| void | add_entity (Model< TSeq > & model, Entity< TSeq > & entity, epiworld_fast_int state_new=-99, epiworld_fast_int queue=-99) |
| void | add_neighbor (Agent< TSeq > & p, bool check_source=true, bool check_target=true) |
| void | add_tool (Model< TSeq > & model, const Tool< TSeq > & tool, epiworld_fast_int state_new=-99, epiworld_fast_int queue=-99) |
| void | change_state (Model< TSeq > & model, epiworld_fast_uint new_state, epiworld_fast_int queue=0) |
| epiworld_double | get_death_reduction (VirusPtr< TSeq > & v, Model< TSeq > & model) |
| const std::vector< size_t > & | get_entities () const |
| const Entity< TSeq > & | get_entity (size_t i, const Model< TSeq > & model) const |
| Entity< TSeq > & | get_entity (size_t i, Model< TSeq > & model) |
| int | get_id () const Id of the individual. |
| size_t | get_n_entities () const |
| size_t | get_n_neighbors () const |
| size_t | get_n_tools () noexcept const |
| std::vector< Agent< TSeq > * > | get_neighbors (Model< TSeq > & model) |
| epiworld_double | get_recovery_enhancer (VirusPtr< TSeq > & v, Model< TSeq > & model) |
| const unsigned int & | get_state () const |
| const unsigned int & | get_state_prev () const |
| epiworld_double | get_susceptibility_reduction (VirusPtr< TSeq > & v, Model< TSeq > & model) |
| ToolPtr< TSeq > & | get_tool (int i) |
| ToolPtr< TSeq > & | get_tool (std::string name) |
| std::vector< ToolPtr< TSeq > > | get_tools () |
| const std::vector< ToolPtr< TSeq > > | get_tools () const |
| epiworld_double | get_transmission_reduction (VirusPtr< TSeq > & v, Model< TSeq > & model) |
| VirusPtr< TSeq > & | get_virus () |
| const VirusPtr< TSeq > & | get_virus () const |
| bool | has_entity (epiworld_fast_uint t) const |
| bool | has_entity (std::string_view name, const Model< TSeq > & model) const |
| bool | has_tool (epiworld_fast_uint t) const |
| bool | has_tool (std::string_view name) const |
| bool | has_tool (const Tool< TSeq > & t) const |
| bool | has_virus (epiworld_fast_uint t) const |
| bool | has_virus (std::string_view name) const |
| bool | has_virus (const Virus< TSeq > & v) const |
| void | mutate_virus () |
| bool | operator!= (const Agent< TSeq > & other) const |
| double & | operator() (size_t j, Model< TSeq > & model) Access the j-th column of the agent. |
| double | operator() (size_t j, const Model< TSeq > & model) const |
| Agent< TSeq > & | operator= (const Agent< TSeq > & other_agent) |
| bool | operator== (const Agent< TSeq > & other) const |
| void | print (Model< TSeq > & model, bool compressed=false) const |
| void | rm_agent_by_virus (Model< TSeq > & model) = delete Agent removed by virus. |
| void | rm_entity (Model< TSeq > & model, epiworld_fast_uint entity_idx, epiworld_fast_int state_new=-99, epiworld_fast_int queue=-99) |
| void | rm_entity (Model< TSeq > & model, Entity< TSeq > & entity, epiworld_fast_int state_new=-99, epiworld_fast_int queue=-99) |
| void | rm_tool (Model< TSeq > & model, epiworld_fast_uint tool_idx, epiworld_fast_int state_new=-99, epiworld_fast_int queue=-99) |
| void | rm_tool (Model< TSeq > & model, ToolPtr< TSeq > & tool, epiworld_fast_int state_new=-99, epiworld_fast_int queue=-99) |
| void | rm_virus (Model< TSeq > & model, epiworld_fast_int state_new=-99, epiworld_fast_int queue=-99) |
| void | set_virus (Model< TSeq > & model, const Virus< TSeq > & virus, epiworld_fast_int state_new=-99, epiworld_fast_int queue=-99) |
| void | swap_neighbors (Agent< TSeq > & other, size_t n_this, size_t n_other, Model< TSeq > & model) Swaps neighbors between the current agent and agent other __ |
| ~Agent () |
Protected Attributes¶
| Type | Name |
|---|---|
| std::vector< size_t > | entities Entity IDs (indices intoModel::entities ) |
| int | id = -1 |
| size_t | n_neighbors = 0u |
| std::vector< size_t > * | neighbors = nullptr |
| std::vector< size_t > * | neighbors_locations = nullptr |
| unsigned int | state = 0u |
| int | state_last_changed = -1Last time the agent was updated. |
| unsigned int | state_prev = 0uFor accounting, if need to undo a change. |
| std::vector< ToolPtr< TSeq > > | tools |
| VirusPtr< TSeq > | virus = nullptr |
Protected Functions¶
| Type | Name |
|---|---|
| void | reset () Resets the agent to the initial state (no virus, no tools, no entities, state 0.) |
Detailed Description¶
Template parameters:
TSeqSequence type (should matchTSeqacross the model)
Public Functions Documentation¶
function Agent [1/3]¶
function Agent [2/3]¶
function Agent [3/3]¶
function add_entity¶
inline void Agent::add_entity (
Model < TSeq > & model,
Entity < TSeq > & entity,
epiworld_fast_int state_new=-99,
epiworld_fast_int queue=-99
)
function add_neighbor¶
inline void Agent::add_neighbor (
Agent < TSeq > & p,
bool check_source=true,
bool check_target=true
)
function add_tool¶
inline void Agent::add_tool (
Model < TSeq > & model,
const Tool < TSeq > & tool,
epiworld_fast_int state_new=-99,
epiworld_fast_int queue=-99
)
function change_state¶
inline void Agent::change_state (
Model < TSeq > & model,
epiworld_fast_uint new_state,
epiworld_fast_int queue=0
)
function get_death_reduction¶
function get_entities¶
function get_entity [1/2]¶
function get_entity [2/2]¶
function get_id¶
Id of the individual.
function get_n_entities¶
function get_n_neighbors¶
function get_n_tools¶
function get_neighbors¶
function get_recovery_enhancer¶
inline epiworld_double Agent::get_recovery_enhancer (
VirusPtr < TSeq > & v,
Model < TSeq > & model
)
function get_state¶
function get_state_prev¶
function get_susceptibility_reduction¶
inline epiworld_double Agent::get_susceptibility_reduction (
VirusPtr < TSeq > & v,
Model < TSeq > & model
)
function get_tool [1/2]¶
function get_tool [2/2]¶
function get_tools [1/2]¶
function get_tools [2/2]¶
function get_transmission_reduction¶
inline epiworld_double Agent::get_transmission_reduction (
VirusPtr < TSeq > & v,
Model < TSeq > & model
)
function get_virus [1/2]¶
function get_virus [2/2]¶
function has_entity [1/2]¶
function has_entity [2/2]¶
function has_tool [1/3]¶
function has_tool [2/3]¶
function has_tool [3/3]¶
function has_virus [1/3]¶
function has_virus [2/3]¶
function has_virus [3/3]¶
function mutate_virus¶
function operator!=¶
function operator()¶
Access the j-th column of the agent.
If an external array has been specified, then these two functions can be used to access additional agent's features not included in the model.
Parameters:
jmodelReference to the Model
Returns:
double&
function operator()¶
function operator=¶
function operator==¶
function print¶
function rm_agent_by_virus¶
Agent removed by virus.
function rm_entity [1/2]¶
inline void Agent::rm_entity (
Model < TSeq > & model,
epiworld_fast_uint entity_idx,
epiworld_fast_int state_new=-99,
epiworld_fast_int queue=-99
)
function rm_entity [2/2]¶
inline void Agent::rm_entity (
Model < TSeq > & model,
Entity < TSeq > & entity,
epiworld_fast_int state_new=-99,
epiworld_fast_int queue=-99
)
function rm_tool [1/2]¶
inline void Agent::rm_tool (
Model < TSeq > & model,
epiworld_fast_uint tool_idx,
epiworld_fast_int state_new=-99,
epiworld_fast_int queue=-99
)
function rm_tool [2/2]¶
inline void Agent::rm_tool (
Model < TSeq > & model,
ToolPtr < TSeq > & tool,
epiworld_fast_int state_new=-99,
epiworld_fast_int queue=-99
)
function rm_virus¶
inline void Agent::rm_virus (
Model < TSeq > & model,
epiworld_fast_int state_new=-99,
epiworld_fast_int queue=-99
)
function set_virus¶
inline void Agent::set_virus (
Model < TSeq > & model,
const Virus < TSeq > & virus,
epiworld_fast_int state_new=-99,
epiworld_fast_int queue=-99
)
function swap_neighbors¶
Swaps neighbors between the current agent and agent other __
inline void Agent::swap_neighbors (
Agent < TSeq > & other,
size_t n_this,
size_t n_other,
Model < TSeq > & model
)
Parameters:
othern_thisn_other
function ~Agent¶
Protected Attributes Documentation¶
variable entities¶
Entity IDs (indices intoModel::entities )
variable id¶
variable n_neighbors¶
variable neighbors¶
variable neighbors_locations¶
variable state¶
variable state_last_changed¶
Last time the agent was updated.
variable state_prev¶
For accounting, if need to undo a change.
variable tools¶
variable virus¶
Protected Functions Documentation¶
function reset¶
Resets the agent to the initial state (no virus, no tools, no entities, state 0.)
The documentation for this class was generated from the following file epiworld-src/include/epiworld/agent-bones.hpp