Construct version 5.4.4
An agent based modeling framework
Social_Media_no_followers::default_media_user Struct Reference

Class that implements the behavior of a user on the social media. More...

Inheritance diagram for Social_Media_no_followers::default_media_user:
Collaboration diagram for Social_Media_no_followers::default_media_user:

Public Member Functions

 default_media_user (Social_Media_no_followers *reddit, const Node &node)
 Constructor that takes the media pointer this user is apart of and the iterator containing all the required node attributes. More...
 
Social_Media_no_followersmedia ()
 
void parse (media_event *_event)
 The parsed event is checked to ensure it contains knowledge More...
 
void reply (media_event *_event)
 With proabability default_media_user::pr creates a reply to the event. More...
 
void quote (media_event *_event)
 With proabability default_media_user::pqu creates a quote to the event. More...
 
void repost (media_event *_event)
 With proabability default_media_user::prp creates a quote to the event. More...
 
void generate_post_events (void)
 The user adds a number of post events based on default_media_user::pdp. More...
 
unsigned int get_read_count (void)
 The user reads a number of events based on default_media_user::pdread. More...
 
virtual void enrich_event (media_event *_event)
 Enirches the event with information. More...
 
virtual unsigned int get_knowledge_selection (void)
 Called during media_user::generate_post_events to choose which piece of knowledge to add to a media_event. More...
 
std::set< media_event * > read (media_event *read_event)
 Collects all events an agent will parse when reading an event. More...
 
- Public Member Functions inherited from Social_Media_no_followers::media_user
Randomrandom ()
 
 media_user (Social_Media_no_followers *media)
 
virtual ~media_user ()
 
virtual void parse (media_event *read_event)=0
 Called during Social_Media_no_followers::communicate when an agent parses an event. This function is called once for every message. More...
 
virtual void reply (media_event *read_event)=0
 Called after media_user::parse only if this agent posseses the knowledge in the read event. This function should create a reply based on the implementation's conditions. More...
 
virtual void quote (media_event *read_event)=0
 Called after media_user::parse only if this agent posseses the knowledge in the read event. This function should create a quote based on the implementation's conditions. More...
 
virtual void repost (media_event *read_event)=0
 Called after media_user::parse only if this agent posseses the knowledge in the read event and read_event::type equals media_event::event_types::post. This function should create a repost based on the implementation's conditions. More...
 
virtual void generate_post_events (void)=0
 Called during Social_Media_no_followers::think. Function should generate post events using Social_Media_no_followers::create_post. More...
 
virtual unsigned int get_read_count (void)=0
 Called during Social_Media_no_followers::think to determine how many events to read in a user's feed. More...
 
virtual std::set< media_event * > read (media_event *read_event)=0
 Called during Social_Media_no_followers::think to determine which other events should be added to an InteractionMessage in addition to the read event. More...
 

Public Attributes

unsigned int id
 This user's agent index.
 
float pdp
 The probability density to post pdtw * dt = average number of events in a time period.
 
float pr
 The probability to reply when an event is read.
 
float prp
 The probability to repost when a post is read.
 
float pqu
 The probability to quote when an event is read.
 
float pdread
 The probability density to read events (time in hours) pdread * dt = average number of read messages in a time period.
 
- Public Attributes inherited from Social_Media_no_followers::media_user
Social_Media_no_followersmedia_ptr
 

Detailed Description

Class that implements the behavior of a user on the social media.

The class provides the descision making for when agents read and create messages. When default_media_user::generate_post_events is called during Social_Media_with_followers::think to create post events, they events are created independently with a random piece of known knowledge. When an event is parsed in Social_Media_with_followers::communicate, default_media_user::parse is immediately called which checks for a knowledge index in the read event. If the peice of knowledge in the event is already known, media_user::(reply, quote, repost) is then called. In these calls, the class decides whether to respond to the submitted event. After any event is created, enrich_event is called which allows other models to intercept the created event.

This provides a loose guideline for how to create different types of users that respond to events in different ways. Examples might be, createing a graph that changes how likely an agent would respond based on the peice of knowledge, modifying what other events an agent parses when reading an event, or additional actions that should be taken when parsing an event. To create custom event generation, use Social_Media_no_followers::create_post, Social_Media_no_followers::create_reply, etc. Always call default_media_user::enrich_event on all event created after adding any custom information.

Constructor & Destructor Documentation

◆ default_media_user()

Social_Media_no_followers::default_media_user::default_media_user ( Social_Media_no_followers reddit,
const Node node 
)

Constructor that takes the media pointer this user is apart of and the iterator containing all the required node attributes.

Some required node attribute names depend on Social_Media_with_followers::media_name. Thus the following attributes are required:

  • media_name + " post density"
  • media_name + " reply probability"
  • media_name + " repost probability"
  • media_name + " quote probability"
  • media_name + " reading density"
Here is the call graph for this function:

Member Function Documentation

◆ enrich_event()

void Social_Media_no_followers::default_media_user::enrich_event ( media_event _event)
virtual

Enirches the event with information.

By default this is called after every event is created by this class. The last operation in this function is Social_Media_no_followers::finalize_event. Any functions that override this function should call this function after performing all other operations.

Reimplemented in SM_wf_emotions::default_media_user, and Social_Media_with_followers::default_media_user.

Here is the caller graph for this function:

◆ generate_post_events()

void Social_Media_no_followers::default_media_user::generate_post_events ( void  )
virtual

The user adds a number of post events based on default_media_user::pdp.

Implements Social_Media_no_followers::media_user.

Here is the call graph for this function:

◆ get_knowledge_selection()

unsigned int Social_Media_no_followers::default_media_user::get_knowledge_selection ( void  )
virtual

Called during media_user::generate_post_events to choose which piece of knowledge to add to a media_event.

Reimplemented in SM_wf_emotions::default_media_user.

Here is the call graph for this function:

◆ get_read_count()

unsigned int Social_Media_no_followers::default_media_user::get_read_count ( void  )
virtual

The user reads a number of events based on default_media_user::pdread.

Implements Social_Media_no_followers::media_user.

Here is the call graph for this function:

◆ parse()

void Social_Media_no_followers::default_media_user::parse ( media_event _event)
virtual

The parsed event is checked to ensure it contains knowledge

Implements Social_Media_no_followers::media_user.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ quote()

void Social_Media_no_followers::default_media_user::quote ( media_event _event)
virtual

With proabability default_media_user::pqu creates a quote to the event.

Implements Social_Media_no_followers::media_user.

Here is the call graph for this function:

◆ read()

std::set< Social_Media_no_followers::media_event * > Social_Media_no_followers::default_media_user::read ( media_event read_event)
virtual

Collects all events an agent will parse when reading an event.

Implements Social_Media_no_followers::media_user.

◆ reply()

void Social_Media_no_followers::default_media_user::reply ( media_event _event)
virtual

With proabability default_media_user::pr creates a reply to the event.

Implements Social_Media_no_followers::media_user.

Here is the call graph for this function:

◆ repost()

void Social_Media_no_followers::default_media_user::repost ( media_event _event)
virtual

With proabability default_media_user::prp creates a quote to the event.

Implements Social_Media_no_followers::media_user.

Here is the call graph for this function: