Construct version 5.3.9
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, const std::string &name)
 Constructor for all models in Construct. More...
 
 Model (const std::string &name)
 Constructor for the PlaceHolder model. 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 (InteractionMessageQueue::iterator 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...
 

Public Attributes

Construct *const construct
 
GraphManager *const graph_manager
 
NodesetManager *const ns_manager
 
Random *const random
 
const std::string name
 Name of the model. Set by the Model constructor.
 
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.

Constructor & Destructor Documentation

◆ Model() [1/2]

Model::Model ( Construct _construct,
const std::string &  name 
)

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() [2/2]

Model::Model ( const std::string &  name)

Constructor for the PlaceHolder model.

This constructor initializes all pointers as NULL pointers and sets Model::valid to false. Only Model::name is updated using the submitted string.

◆ ~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()

void Model::cleanup ( void  )
virtual

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 KnowledgeTransactiveMemory, Subscription, Beliefs, Emotions, Forget, GrandInteraction, KnowledgeTrust, Location, Social_Media_no_followers, Social_Media_with_followers, Tasks, and Template.

Here is the call graph for this function:

◆ communicate()

void Model::communicate ( InteractionMessageQueue::iterator  msg)
virtual

Function called after the update functions in a simulation cycle.

Messages are typically parsed in this function.

Reimplemented in Emotions, Forget, GrandInteraction, KnowledgeParsing, KnowledgeTransactiveMemory, KnowledgeTrust, Social_Media_no_followers, Social_Media_with_followers, Subscription, and Template.

Here is the call graph for this function:

◆ initialize()

void Model::initialize ( void  )
virtual

Function called once before any simulation cycles begin.

Reimplemented in Beliefs, GrandInteraction, KnowledgeTransactiveMemory, KnowledgeTrust, Location, Social_Media_no_followers, StandardInteraction, Tasks, and Template.

Here is the call graph for this function:

◆ think()

void Model::think ( void  )
virtual

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.

Here is the call graph for this function:

◆ update()

void Model::update ( void  )
virtual

Function called after the think functions in a simulation cycle.

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

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

Here is the call graph for this function: