Construct version 5.4.3
An agent based modeling framework
Model Struct Reference

Parent class for Construct models. More...

Inheritance diagram for Model:
Collaboration diagram for Model:

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 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

Constructconstruct
 
GraphManagergraph_manager
 
NodesetManagerns_manager
 
Randomrandom
 
bool valid
 If member is false, the model's functions are not called.
 

Detailed Description

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>

Constructor & Destructor Documentation

◆ Model()

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.

◆ ~Model()

virtual Model::~Model ( void  )
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.

Member Function Documentation

◆ cleanup()

virtual void Model::cleanup ( void  )
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.

◆ communicate()

virtual void Model::communicate ( const InteractionMessage msg)
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.

◆ initialize()

virtual void Model::initialize ( void  )
inlinevirtual

◆ think()

virtual void Model::think ( void  )
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.

◆ update()

virtual void Model::update ( void  )
inlinevirtual

Function called after the think functions in a simulation cycle.

Messages are typically amended and/or removed in this function.

Reimplemented in Emotions, KnowledgeLearningDifficulty, Trust, Mail, and Template.

Member Data Documentation

◆ construct

Construct& Model::construct

summary>

◆ graph_manager

GraphManager& Model::graph_manager

summary>

◆ ns_manager

NodesetManager& Model::ns_manager

summary>