Construct version 5.4.4
An agent based modeling framework
Mail Class Reference

A modification model which causes delays in the transmission of messages. More...

Inheritance diagram for Mail:
Collaboration diagram for Mail:

Public Member Functions

 Mail (Construct &construct)
 
void update (void) override
 For each message in Construct::interaction_message_queue the message is added the sender's entry in Mail::mailboxes with probability using the sender's index and communication index in Mail::mail_pref. If the message is moved into Mail::mailboxes, the message is removed from Construct::interaction_message_queue. Then each agent checks their mail with probability from Mail::mail_check_prob. If an agent checks their mail, their entry in Mail::mailboxes are added to Construct::interaction_message_queue and that entry in Mail::mailboxes is cleared. More...
 
- Public Member Functions inherited from Model
 Model (Construct &_construct)
 Constructor for all models in Construct. More...
 
virtual ~Model (void)
 Virtual Deconstructor. More...
 
virtual void initialize (void)
 Function called once before any simulation cycles begin. More...
 
virtual void think (void)
 First function called in a simulation cycle. More...
 
virtual void update (void)
 Function called after the think functions in a simulation cycle. More...
 
virtual bool intercept (InteractionItem &item, unsigned int sender, unsigned int receiver, const CommunicationMedium *medium)
 Allows for models to effect change to items created by other models. More...
 
virtual void communicate (const InteractionMessage &msg)
 Function called after the update functions in a simulation cycle. More...
 
virtual void cleanup (void)
 Function called after the Model::communicate functions in a simulation cycle. More...
 
void add_base_model_to_model_manager (const std::string &base_model_name)
 Adds a derived model under the name of the base model and disables the model manager from calling its functions.
 

Public Attributes

const Graph< float > & mail_pref = graph_manager.load_optional(graph_names::mail_usage, 1.0f, nodeset_names::agents, sparse, nodeset_names::comm, sparse)
 
const Graph< float > & mail_check_prob = graph_manager.load_optional(graph_names::mail_check_prob, 0.5f, nodeset_names::agents, sparse, nodeset_names::time, sparse)
 
std::vector< std::list< InteractionMessage > > mailboxes = std::vector<std::list<InteractionMessage> >(mail_pref.source_nodeset->size())
 
- Public Attributes inherited from Model
Constructconstruct
 
GraphManagergraph_manager
 
NodesetManagerns_manager
 
Randomrandom
 
bool valid
 If member is false, the model's functions are not called.
 

Detailed Description

A modification model which causes delays in the transmission of messages.

Member Function Documentation

◆ update()

void Mail::update ( void  )
overridevirtual

For each message in Construct::interaction_message_queue the message is added the sender's entry in Mail::mailboxes with probability using the sender's index and communication index in Mail::mail_pref. If the message is moved into Mail::mailboxes, the message is removed from Construct::interaction_message_queue. Then each agent checks their mail with probability from Mail::mail_check_prob. If an agent checks their mail, their entry in Mail::mailboxes are added to Construct::interaction_message_queue and that entry in Mail::mailboxes is cleared.

Reimplemented from Model.

Here is the call graph for this function:

Member Data Documentation

◆ mail_check_prob

const Graph<float>& Mail::mail_check_prob = graph_manager.load_optional(graph_names::mail_check_prob, 0.5f, nodeset_names::agents, sparse, nodeset_names::time, sparse)

summary>

◆ mail_pref

const Graph<float>& Mail::mail_pref = graph_manager.load_optional(graph_names::mail_usage, 1.0f, nodeset_names::agents, sparse, nodeset_names::comm, sparse)

summary>

◆ mailboxes

std::vector<std::list<InteractionMessage> > Mail::mailboxes = std::vector<std::list<InteractionMessage> >(mail_pref.source_nodeset->size())

summary>