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

Adds the contents of the event to the message as an InteractionItem if the message is empty. More...

Inheritance diagram for Reddit::default_media_user:
Collaboration diagram for Reddit::default_media_user:

Public Member Functions

 default_media_user (Social_Media_no_followers *media, const Node &node)
 Loads node attributes of the agent into values for the class. More...
 
Redditmedia ()
 
void generate_post_events (void)
 Each user checks whether to generate a post this time step. More...
 
void parse (media_event *_event)
 Allows the user to upvote or downvote the event they're reading. More...
 
void reply (media_event *_event)
 The user replies to the event with probability default_media_user::pr. More...
 
void upvote (media_event *_event)
 The user upvotes the event with probability default_media_user::up.
 
void downvote (media_event *_event)
 The user downvotes the event with probability default_media_user::dp.
 
virtual void enrich_event (media_event *_event)
 The user's trust of the knowledge bit associated with the media_event is updated. More...
 
virtual unsigned int select_subreddit ()
 Selects a random subreddit that the user is subscribed to for creating a post.
 
virtual unsigned int select_knowledge ()
 Selects a random knowledge index that the user knows for creating a post.
 
unsigned int get_read_count ()
 Returns a value sampled from a poisson distribution with a mean of default_media_user::pdread * Social_Media_no_followers::dt. More...
 
std::set< media_event * > read (media_event *read_event)
 Returns the set of events that an agent will read in addition the submitted event. More...
 
void repost (media_event *_event)
 No Operation More...
 
void quote (media_event *_event)
 No Operation 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 pdread
 The probability density to read events (time in hours) pdread * dt = average number of read messages in a time period.
 
float pp
 The probability the agent creates a post each time step.
 
float pr
 The probability to reply when an event is read.
 
float up
 The probability to upvote an event when read.
 
float dp
 The probability to downvote an event when read.
 
float expand
 The probability when reading event to read the replies to that event.
 
float reply_tree
 The probability to continue reading the replies (ordered by upvote downvote difference) of a post.
 
- Public Attributes inherited from Social_Media_no_followers::media_user
Social_Media_no_followersmedia_ptr
 

Detailed Description

Adds the contents of the event to the message as an InteractionItem if the message is empty.

By only adding an event if the message is empty, only the information of the event being read is added. Additional events like replies to the event are skipped from being added to the message using this condition.

‍/ media_user& user(unsigned int index) { media_user temp = dynamic_cast<media_user*>(users[index]); // if the media couldn't be up casted the desired class this assertion will be raised. // If you're confused why, you probably have a diamond inheritence that makes casting non-trivial assert(temp); return *temp; }

static std::function<Social_Media_no_followers::media_user* (Reddit*, const Node&)> load_user;

#ifdef CUSTOM_REDDIT_USERS media_user* load_user(const Node& node); #endif

/*!

Creates and loads the users/moderators as specified by the "Reddit user type" node attribute of each agent.

‍/ void load_users(const std::string& version) override { assert(Construct::version == version);

for (auto& node : agents) { #ifndef CUSTOM_REDDIT_USERS media_user* user = NULL; if (node["Reddit user type"] == "moderator") { user = new Reddit::reddit_moderator(this, node); } else if (node["Reddit user type"] == "user") { user = new Reddit::default_media_user(this, node); } else { assert(false); } #endif users[node.index] = #ifdef CUSTOM_REDDIT_USERS load_user(node); #else user; #endif } }

/*!
<summary>
Class of users that interact with Reddit's subreddits.
<para>
Reddit users can't repost or quote, but they can upvote or downvote an event when reading it.
Users choose which subreddit they post to in addition to other information.
If the user has been banned by a moderator of a subreddit, they will be unable to post any content 
and ilicits a moderation response via the Moderation Model.
</para>
</summary>

Constructor & Destructor Documentation

◆ default_media_user()

Reddit::default_media_user::default_media_user ( Social_Media_no_followers media,
const Node node 
)

Loads node attributes of the agent into values for the class.

The following attributes are required:

Member Function Documentation

◆ enrich_event()

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

The user's trust of the knowledge bit associated with the media_event is updated.

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.

◆ generate_post_events()

void Reddit::default_media_user::generate_post_events ( void  )
virtual

Each user checks whether to generate a post this time step.

Each user creates a post with probability default_media_user::pp. Users that create a post select a random subreddit they subscribe to from the subreddit network and a random knowledge bit from knowledge they know in the knowledge network and adds that information to the post along with the agent's corresponding knowledge trust from the knowledge trust network.

Implements Social_Media_no_followers::media_user.

Here is the call graph for this function:

◆ get_read_count()

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

Returns a value sampled from a poisson distribution with a mean of default_media_user::pdread * Social_Media_no_followers::dt.

Implements Social_Media_no_followers::media_user.

Here is the call graph for this function:

◆ parse()

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

Allows the user to upvote or downvote the event they're reading.

Implements Social_Media_no_followers::media_user.

◆ quote()

void Reddit::default_media_user::quote ( media_event _event)
inlinevirtual

No Operation

No Operation

Implements Social_Media_no_followers::media_user.

◆ read()

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

Returns the set of events that an agent will read in addition the submitted event.

Implements Social_Media_no_followers::media_user.

◆ reply()

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

The user replies to the event with probability default_media_user::pr.

Implements Social_Media_no_followers::media_user.

Here is the call graph for this function:

◆ repost()

void Reddit::default_media_user::repost ( media_event _event)
inlinevirtual

No Operation

Implements Social_Media_no_followers::media_user.