Construct version 5.4.4
An agent based modeling framework
|
Parent class for Construct models. More...
Public Member Functions | |
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 | |
Construct & | construct |
GraphManager & | graph_manager |
NodesetManager & | ns_manager |
Random & | random |
bool | valid |
If member is false, the model's functions are not called. | |
Parent class for Construct models.
This parent class allows all model pointers to be stored in the same array. All models are required to have a custom constructor, and 5 real functions to take the place of the virtual functions. A deconstructor is not required for models. By default models are considered valid unless explicitly stated otherwise. Non-valid models won't have their virtual functions called.
summary>
Model::Model | ( | Construct & | _construct | ) |
Constructor for all models in Construct.
All models require the Construct pointer and the name of the model to be defined. The Construct pointer is transferred via ModelManager::create_model which Construct passes to the ModelManager. All model names can be found in the namespace model_names. All models are valid by default unless otherwise stated. If a model is not valid, its functions are not called by the ModelManager.
|
inlinevirtual |
Virtual Deconstructor.
Deconstructor is virtual so that when a Model is deallocated by the ModelManager, the derived model's deconstructor is also called. This virtual deconstructor preforms no operations.
|
inlinevirtual |
Function called after the Model::communicate functions in a simulation cycle.
End of cycle calculations are done during this function. Model::cleanup is called after GraphManager::push_deltas is called.
Reimplemented in SM_wf_emotions, KnowledgeTransactiveMemory, Subscription, Beliefs, Emotions, Forget, GrandInteraction, Trust, Location, Social_Media_no_followers, Social_Media_with_followers, Tasks, and Template.
|
inlinevirtual |
Function called after the update functions in a simulation cycle.
Messages are typically parsed in this function.
Reimplemented in Emotions, SM_wf_emotions, Forget, GrandInteraction, KnowledgeTransactiveMemory, Trust, Social_Media_no_followers, Social_Media_with_followers, Subscription, and Template.
|
inlinevirtual |
Function called once before any simulation cycles begin.
Reimplemented in Facebook_nf_emotions, Twitter_nf_emotions, Facebook_wf_emotions, Twitter_wf_emotions, Social_Media_Moderation, Multiplatform_Manager, Facebook_wf, Twitter_wf, Beliefs, SM_wf_emotions, GrandInteraction, KnowledgeTransactiveMemory, Trust, Location, Reddit, Social_Media_no_followers, StandardInteraction, Tasks, and Template.
|
inlinevirtual |
Allows for models to effect change to items created by other models.
A model change add, modify, or remove information from an item based other submitted information. Also allows for models to control what InteractionItems get created. Senders and receiver indexes can include values from 0 to and including the size of the agent nodeset. Always check if the index is equal to the agent nodeset size before accessing a node or network value. The medium can be a node in the medium nodeset, a medium for a specific model, or a null pointer. Always check that a node is not a null pointer before derefrencing it. Complexity and exceptions depend entirely on each models specific implementation. By default, models allow items to be created without modifying them.
item | The InteractionItem that is being created. This item can modified as each model sees fit. |
sender | The index for the agent that is the source of the InteractionItem. |
receiver | The index for the agent that is receiving the item. If the item does not have an intended recipient, its value will equal the agent nodeset size. |
medium | The communication medium intended for the item. If the medium is not yet chosen, it will be a null pointer. The medium may or may not be in the medium nodeset and there are no restraints on what index the medium could have. |
Example
Output:
0.2
Reimplemented in Emotions, KnowledgeLearningDifficulty, Trust, and Social_Media_Moderation.
|
inlinevirtual |
First function called in a simulation cycle.
Messages are typically created in this function.
Reimplemented in Subscription, Forget, Location, Social_Media_no_followers, StandardInteraction, and Template.
|
inlinevirtual |
Construct& Model::construct |
summary>
GraphManager& Model::graph_manager |
summary>
NodesetManager& Model::ns_manager |
summary>