Construct version 5.4.4
An agent based modeling framework
Subscription Struct Reference

A modification model that forwards messages that are made public to subscribers. More...

Inheritance diagram for Subscription:
Collaboration diagram for Subscription:

Public Member Functions

 Subscription (Construct &construct)
 
void think () override
 Each message in Subscription public_queue is copied for each person that subsribes to the message's sender from Subscription::subscriptions. The receiver is then modified in the copied message and set to the subscriber's index. More...
 
void communicate (const InteractionMessage &msg) override
 Messages that are communicated are added to Subscription::public_queue with probability from Subscription::public_propensity. More...
 
void cleanup () override
 Agents subscribe to the sender of each message in Subscription::public_queue with probability from Subscription::sub_prob. 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 > & public_propensity
 
Graph< bool > & subscriptions
 
const Graph< float > & sub_prob
 
std::list< InteractionMessagepublic_queue
 
- 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 that forwards messages that are made public to subscribers.

Member Function Documentation

◆ cleanup()

void Subscription::cleanup ( void  )
overridevirtual

Agents subscribe to the sender of each message in Subscription::public_queue with probability from Subscription::sub_prob.

summary>

Reimplemented from Model.

Here is the call graph for this function:

◆ communicate()

void Subscription::communicate ( const InteractionMessage msg)
overridevirtual

Messages that are communicated are added to Subscription::public_queue with probability from Subscription::public_propensity.

Reimplemented from Model.

Here is the call graph for this function:

◆ think()

void Subscription::think ( void  )
overridevirtual

Each message in Subscription public_queue is copied for each person that subsribes to the message's sender from Subscription::subscriptions. The receiver is then modified in the copied message and set to the subscriber's index.

Reimplemented from Model.

Here is the call graph for this function:

Member Data Documentation

◆ public_propensity

const Graph<float>& Subscription::public_propensity
Initial value:
0.01f, nodeset_names::agents, sparse, nodeset_names::comm, sparse)
Graph_Intermediary load_optional(const std::string &name, const Nodeset *src, const Nodeset *trg, const Nodeset *slc=nullptr) const
Finds a Graph if its loaded and returns it via a proxy class.
Definition: GraphManager.cpp:908
const std::string propensity
Definition: GraphManager.h:133
const std::string agents
Definition: NodesetManager.h:14
const std::string comm
Definition: NodesetManager.h:22
GraphManager & graph_manager
Definition: Model.h:77

summary>

◆ sub_prob

const Graph<float>& Subscription::sub_prob
Initial value:
const std::string sub_probability
Definition: GraphManager.h:147

summary>

◆ subscriptions

Graph<bool>& Subscription::subscriptions
Initial value:
const std::string subs
Definition: GraphManager.h:145

summary>