creativity  v1.3.0
Agent-based model of creativity and piracy
Public Member Functions | Public Attributes | List of all members
creativity::state::ReaderState Class Referencefinal

Records the various variables associated with a reader. More...

#include <creativity/state/ReaderState.hpp>

Public Member Functions

 ReaderState (const Reader &r)
 Constructs a new ReaderState, settings its values using the given Reader.
 
 ReaderState (const uint32_t dimensions)
 Constructs a new blank ReaderState for a reader with a position of the given number of dimensions. More...
 
const belief::ProfitprofitExtrap () const
 Returns profit_extrap if it exists (i.e. More...
 
void updateLibraryCounts (eris::eris_time_t t)
 Utility method to recalculate purchased, purchased_new, pirated, and pirated_new from the current library. More...
 

Public Attributes

eris::eris_id_t id
 Unique simulation ID of the reader.
 
eris::Position position
 Position of the reader.
 
std::map< eris::eris_id_t, BookCopylibrary
 The reader's library: the keys are the book IDs of owned books, the values are the per-reader specific BookCopy values.
 
uint32_t library_purchased
 The number of market-purchased books in the reader's library. More...
 
uint32_t library_purchased_new
 The number of market-purchased books in the reader's library that were acquired in the current period. More...
 
uint32_t library_public
 The number of public provider-purchased books in the reader's library. More...
 
uint32_t library_public_new
 The number of public provider-purchased books in the reader's library that were acquired in the current period. More...
 
uint32_t library_pirated
 The number of pirated books in the reader's library. More...
 
uint32_t library_pirated_new
 The number of pirated books in the reader's library that were acquired in the current period. More...
 
std::set< eris::eris_id_t > friends
 Friends of the reader.
 
std::set< eris::eris_id_t > new_books
 The set of book IDs that were newly obtained in the period, not including self-authored books.
 
std::set< eris::eris_id_t > wrote
 IDs of books written by this reader.
 
double u
 Utility in the current period.
 
double u_lifetime
 Lifetime cumulative utility up to and including the current period.
 
double creation_shape
 Creation shape coefficient.
 
double creation_scale
 Creation scale coefficient.
 
belief::Profit profit
 Profit beliefs.
 
belief::Profit profit_extrap
 Profit beliefs using extrapolation for on-market books (will be default-constructed if there is no extrapolation)
 
belief::Demand demand
 Single-period demand belief.
 
std::map< uint32_t, belief::ProfitStreamprofit_stream
 Profit stream beliefs.
 

Detailed Description

Records the various variables associated with a reader.

This is basically a container class with a constructor that copies the current state of a given Reader.

Constructor & Destructor Documentation

§ ReaderState()

creativity::state::ReaderState::ReaderState ( const uint32_t  dimensions)
explicit

Constructs a new blank ReaderState for a reader with a position of the given number of dimensions.

All values will be default initialized. (The number of dimensions is needed for Position initialization).

Member Function Documentation

§ profitExtrap()

const belief::Profit& creativity::state::ReaderState::profitExtrap ( ) const

Returns profit_extrap if it exists (i.e.

if there is extrapolated data), otherwise returns profit (i.e. if there was no extrapolated data and so profit_extrap_ is exactly the same as profit_).

§ updateLibraryCounts()

void creativity::state::ReaderState::updateLibraryCounts ( eris::eris_time_t  t)

Utility method to recalculate purchased, purchased_new, pirated, and pirated_new from the current library.

Parameters
tthe time period of the state. Needed to identify newly-acquired books (books with copy.acquired == t

Member Data Documentation

§ library_pirated

uint32_t creativity::state::ReaderState::library_pirated

The number of pirated books in the reader's library.

When loading/modifying a ReaderState object you should call updateLibraryCounts() to recalculate this, or else set it yourself.

§ library_pirated_new

uint32_t creativity::state::ReaderState::library_pirated_new

The number of pirated books in the reader's library that were acquired in the current period.

When loading/modifying a ReaderState object you should call updateLibraryCounts() to recalculate this, or else set it yourself.

§ library_public

uint32_t creativity::state::ReaderState::library_public

The number of public provider-purchased books in the reader's library.

When loading/modifying a ReaderState object you should call updateLibraryCounts() to recalculate this, or else set it yourself.

§ library_public_new

uint32_t creativity::state::ReaderState::library_public_new

The number of public provider-purchased books in the reader's library that were acquired in the current period.

When loading/modifying a ReaderState object you should call updateLibraryCounts() to recalculate this, or else set it yourself.

§ library_purchased

uint32_t creativity::state::ReaderState::library_purchased

The number of market-purchased books in the reader's library.

When loading/modifying a ReaderState object you should call updateLibraryCounts() to recalculate this, or else set it yourself.

§ library_purchased_new

uint32_t creativity::state::ReaderState::library_purchased_new

The number of market-purchased books in the reader's library that were acquired in the current period.

When loading/modifying a ReaderState object you should call updateLibraryCounts() to recalculate this, or else set it yourself.

Collaboration diagram for creativity::state::ReaderState:
[legend]

The documentation for this class was generated from the following file: