Construct version 5.4.4
An agent based modeling framework
|
Specializes the SM_nf_emotions model for Facebook. More...
Public Member Functions | |
Facebook_nf_emotions (const dynet::ParameterMap ¶meters, Construct &construct) | |
Parameters are passed directly to the base class constructor. More... | |
void | initialize () override |
Function called once before any simulation cycles begin. More... | |
Public Member Functions inherited from SM_nf_emotions | |
SM_nf_emotions (const std::string &_media_name, InteractionItem::item_keys event_key, const dynet::ParameterMap ¶ms, Construct &construct) | |
Social_Media_no_followers::media_user * | get_default_media_user (const Node &node) override |
InteractionItem | convert_to_InteractionItem (media_event *_event, unsigned int sender_index, unsigned int receiver_index) const override |
Public Member Functions inherited from Social_Media_no_followers | |
void | load_events (const std::string &fname, const dynet::datetime &start_time, float time_conversion, const std::map< std::string, unsigned int > &agent_mask=std::map< std::string, unsigned int >()) |
Parses the content of a json file and loads the information into Social_Media_no_followers::list_of_events. More... | |
virtual media_event * | create_post (unsigned int knowledge_index, unsigned int id) |
Creates a post event and adds it to Social_Media_no_followers::list_of_events. More... | |
virtual media_event * | create_response (unsigned int id, media_event *parent) |
Creates a response event based on the parent event and adds it to Social_Media_no_followers::list_of_events. More... | |
virtual media_event * | create_quote (unsigned int id, media_event *parent) |
Creates a quote event based on the parent event and adds it to Social_Media_no_followers::list_of_events. More... | |
virtual media_event * | create_reply (unsigned int id, media_event *parent) |
Creates a reply event based on the parent event and adds it to Social_Media_no_followers::list_of_events. More... | |
virtual media_event * | create_repost (unsigned int id, media_event *parent) |
Creates a quote event based on the parent event and adds it to Social_Media_no_followers::list_of_events. More... | |
virtual void | finalize_event (media_event *_event) |
Allows each model to intercept the created event. More... | |
void | check_list_order () const |
Checks the list of events to make sure the time stamps are sorted in descending order. More... | |
Social_Media_no_followers::media_user & | user (unsigned int index) |
Social_Media_no_followers (const std::string &_media_name, InteractionItem::item_keys event_key, const dynet::ParameterMap ¶meters, Construct &_construct) | |
Base constructor for any social media model. More... | |
virtual | ~Social_Media_no_followers () |
All pointers in Social_Media_with_followers::users are deallocated. | |
virtual media_user * | get_default_media_user (const Node &node) |
Gets the default media user for a social media class. More... | |
void | think (void) override |
Agents read events in their feed and create messages based on the read events. More... | |
void | initialize (void) override |
Loads users using Social_Media_no_followers::load_user and adds Knowledge_Parser to Construct::message_parsers if one is not present. More... | |
void | communicate (const InteractionMessage &msg) override |
Parses messages that contain the Social_Media_no_followers::event key in their attributes. If the event contains the attribute, media_user::(read, reply, quote, and repost) are called from the receiver's index in Social_Media_no_followers::users More... | |
void | cleanup (void) override |
Feeds are updated, list_of_events::removed_events are cleared, and events are erased from list_of_events that have have become inactive. More... | |
virtual void | append_message (media_event *_event, InteractionMessage &msg) |
Appends the array of InteractionItems based on the submitted event and the intended receiver of the message. More... | |
virtual InteractionItem | convert_to_InteractionItem (media_event *_event, unsigned int sender_index, unsigned int receiver_index) const |
Copies some or all information from the submitted event based on the sender's and receiver's node attributes. More... | |
virtual int | get_feed_priority (const media_event &_event, unsigned int user) |
Returns 10 if the user is mentioned by the event or if the event is a reply to an event authored by the user. Returns 100 otherwise. More... | |
virtual void | update_event_scores () |
Goes through all events and updates media_event::score to media_event::child_size * media_event::time_stamp. More... | |
virtual void | random_event_swapping (unsigned int user_index) |
Randomly swaps 10% of events in the user's feed. More... | |
virtual void | update_feeds (float new_events_timestamp) |
Updates each user's feeds. More... | |
template<typename function > | |
auto | get_events (function filter) |
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. | |
Additional Inherited Members | |
Public Attributes inherited from SM_nf_emotions | |
const Nodeset * | emotions = ns_manager.get_nodeset(nodeset_names::emotions) |
const Graph< float > & | emotion_net = graph_manager.load_required(graph_names::emotion_net, agents, emotions) |
const Graph< float > & | emot_broadcast_bias = graph_manager.load_optional(graph_names::emot_broad_bias, 1.0f, agents, false, emotions, false) |
The base probability an agent attaches an emotion. More... | |
const Graph< float > & | emot_broadcast_first = graph_manager.load_optional(graph_names::emot_broad_first, 0.0f, emotions, false, emotions, false) |
The first order emotional dependence on the probability an agent attaches an emotion. More... | |
const Graph< std::map< unsigned int, float > > & | emot_broadcast_second |
The second order emotional dependence on the probability an agent attaches an emotion. More... | |
const Graph< float > & | pd_emotion_first = graph_manager.load_optional("first order post density emotion network", 0.0f, agents, false, emotions, false) |
The first order emotional dependence on the probability density for how many posts an agent creates each timestep. More... | |
const Graph< float > & | pd_emotion_second = graph_manager.load_optional("second order post density emotion network", 0.0f, emotions, false, emotions, false) |
The second order emotional dependence on the probability density for how many posts an agent creates each timestep. More... | |
const Graph< float > & | pr_emotion_first = graph_manager.load_optional("first order reply probability emotion network", 0.0f, agents, false, emotions, false) |
The first order emotional dependence on the probability that an agent replies to an event when reading it. More... | |
const Graph< float > & | pr_emotion_second = graph_manager.load_optional("second order reply probability emotion network", 0.0f, emotions, false, emotions, false) |
The second order emotional dependence on the probability that an agent replies to an event when reading it. More... | |
const Graph< float > & | prp_emotion_first = graph_manager.load_optional("first order repost probability emotion network", 0.0f, agents, false, emotions, false) |
The first order emotional dependence on the probability that an agent reposts an event when reading it. More... | |
const Graph< float > & | prp_emotion_second = graph_manager.load_optional("second order repost probability emotion network", 0.0f, emotions, false, emotions, false) |
The second order emotional dependence on the probability that an agent reposts an event when reading it. More... | |
const Graph< float > & | pq_emotion_first = graph_manager.load_optional("first order quote probability emotion network", 0.0f, agents, false, emotions, false) |
The first order emotional dependence on the probability that an agent quotes an event when reading it. More... | |
const Graph< float > & | pq_emotion_second = graph_manager.load_optional("second order quote probability emotion network", 0.0f, emotions, false, emotions, false) |
The second order emotional dependence on the probability that an agent quotes an event when reading it. More... | |
const Graph< float > & | pread_emotion_first = graph_manager.load_optional("first order read density emotion network", 0.0f, agents, false, emotions, false) |
The first order emotional dependence on the probability density for how many posts an agent reads each timestep. More... | |
const Graph< float > & | pread_emotion_second = graph_manager.load_optional("second order read density emotion network", 0.0f, emotions, false, emotions, false) |
The second order emotional dependence on the probability density for how many posts an agent reads each timestep. More... | |
const Graph< float > & | kselect_emotion = graph_manager.load_optional("knowledge select emotion network", 0.0f, knowledge, false, emotions, false) |
The emotional dependence on the probability weight an agent selects a knowledge bit for creating an event. More... | |
const Graph< float > & | kselect_trust = graph_manager.load_optional("knowledge select trust network", 0.0f, agents, false, knowledge, false) |
The knowledge trust dependence on the probability weight an agent selects a knowledge bit for creating an event. More... | |
const Graph< float > & | kselect = graph_manager.load_optional("knowledge select bias network", 1.0f, agents, false, knowledge, false) |
The base probability weight an agent selects a knowledge bit for creating an event. More... | |
Public Attributes inherited from Social_Media_no_followers | |
event_container | list_of_events |
The list of all current events in this social media. New events should be added to the front of this list. | |
const Nodeset & | agents = ns_manager.get_nodeset(nodeset_names::agents) |
const Nodeset & | knowledge = ns_manager.get_nodeset(nodeset_names::knowledge) |
const CommunicationMedium | medium |
The medium used for all messages created by this model. | |
const InteractionItem::item_keys | event_key |
The item key added to all messages created by this model. | |
std::vector< std::vector< media_event * > > | users_feed |
Each user's feed of events with the first dimension corresponding to each user. More... | |
std::vector< unsigned int > | read_count |
float | age |
The maximum time a post can exist without its tree being added to. | |
float | dt |
The time duration between time steps. | |
float | time = 0.0f |
The current time period. | |
std::string | media_name |
The prefix for some of the node attributes names parsed by the media_user class. | |
Graph< bool > & | knowledge_net = graph_manager.load_required(graph_names::knowledge, agents, knowledge) |
Pointer to the graph with name "knowledge network". | |
const Graph< bool > * | active_agents = graph_manager.load_optional(graph_names::active, true, agents, sparse, ns_manager.get_nodeset(nodeset_names::time), sparse) |
Pointer to the graph with name "agent active time network". | |
std::vector< media_user * > | users |
The list of users. More... | |
std::function< bool(media_event &)> | current_timestep = [this](media_event& _event) { return _event.time_stamp > time - 0.5f * dt; } |
std::function< bool(media_event &)> | previous_timestep = [this](media_event& _event) { return _event.time_stamp > time - 1.5f * dt; } |
std::function< bool(media_event &)> | active = [this](media_event& _event) { return _event.last_used > time - age; } |
std::function< void(Social_Media_no_followers *, unsigned int)> | feed_update_output |
std::function< void(Social_Media_no_followers *)> | cleanup_output |
Public Attributes inherited from Model | |
Construct & | construct |
GraphManager & | graph_manager |
NodesetManager & | ns_manager |
Random & | random |
bool | valid |
If member is false, the model's functions are not called. | |
Specializes the SM_nf_emotions model for Facebook.
Sets Social_Media_no_followers::media_name to "Facebook" and Social_Media_no_followers::event_key to event_key::facebook_event.
Facebook_nf_emotions::Facebook_nf_emotions | ( | const dynet::ParameterMap & | parameters, |
Construct & | construct | ||
) |
Parameters are passed directly to the base class constructor.
summary>
|
inlineoverridevirtual |
Function called once before any simulation cycles begin.
Reimplemented from Model.