Construct version 5.4.3
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 read (media_event *_event) override
 The read event is checked to ensure it contains knowledge More...
 
void reply (media_event *_event) override
 With proabability default_media_user::pr creates a reply to the event. More...
 
void quote (media_event *_event) override
 With proabability default_media_user::pqu creates a quote to the event. More...
 
void repost (media_event *_event) override
 With proabability default_media_user::prp creates a quote to the event. More...
 
void generate_post_events (void) override
 The user adds a number of post events based on default_media_user::pdp. More...
 
unsigned int get_read_count (void) override
 The user reads a number of events based on default_media_user::pdread. More...
 
virtual void add_mentions (media_event *post)
 Allows derived classes to mention users when creating an event. More...
 
virtual void add_trust (media_event *post)
 If the trust model is present, this users trust is added to a post using Social_Media_no_followers::default_media_user::get_trust.
 
virtual float get_trust (unsigned int knowledge_index)
 Returns the trust the user has in the knowledge index. Returns -1 if the Trust Model is not loaded. 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...
 
- Public Member Functions inherited from Social_Media_no_followers::media_user
 media_user (Social_Media_no_followers *media)
 
virtual ~media_user ()
 
virtual void read (media_event *read_event)=0
 Called during Social_Media_no_followers::communicate when an agent is to read and parse an event. This function is called once for every message. More...
 
virtual void reply (media_event *read_event)=0
 Called after read 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 read 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 read 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 reply 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 that are added to Social_Media_no_followers::list_of_events. 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...
 

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 when agents read and create messages. media_user::generate_post_events is called during Social_Media_with_followers::think to create post events. These events are created independently with a random piece of known knowledge. media_user::get_trust is used to decide the trust value to attach to an event. When an event is read in Social_Media_with_followers::communicate, media_user::read 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) are each called after media_user::read. In these calls, the class decides whether to respond to the submitted event. During these function calls if events are created, mentions are added using media_user::get_mentions.

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 media_user::get_trust to promote specific view points, or manipulating mentions to affect which users see which types of messages. It is recommended to use non-default constructors for events and ensure media_user::get_mentions is called on any new event. However, the option is currently available for detailed manual manipulation of the process.

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

◆ add_mentions()

void Social_Media_no_followers::default_media_user::add_mentions ( media_event post)
virtual

Allows derived classes to mention users when creating an event.

Called by the reply, quote, repost, and generate_post_events functions. Base version performs no operations.

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

◆ generate_post_events()

void Social_Media_no_followers::default_media_user::generate_post_events ( void  )
overridevirtual

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, and SM_nf_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  )
overridevirtual

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

Implements Social_Media_no_followers::media_user.

◆ get_trust()

float Social_Media_no_followers::default_media_user::get_trust ( unsigned int  knowledge_index)
virtual

Returns the trust the user has in the knowledge index. Returns -1 if the Trust Model is not loaded.

Called by the reply, quote, repost, and generate_post_events functions.

◆ quote()

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

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

void Social_Media_no_followers::default_media_user::read ( media_event _event)
overridevirtual

The read 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:

◆ reply()

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

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

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: