creativity  v1.3.0
Agent-based model of creativity and piracy
ReaderState.hpp
1 #pragma once
2 #include <set>
3 #include <map>
4 #include <eris/types.hpp>
5 #include <eris/Position.hpp>
6 #include "creativity/BookCopy.hpp" // IWYU pragma: keep
7 #include "creativity/belief/Demand.hpp"
8 #include "creativity/belief/Profit.hpp"
9 #include "creativity/belief/ProfitStream.hpp"
10 
11 namespace creativity { class Reader; }
12 
13 namespace creativity { namespace state {
14 
18 class ReaderState final {
19  public:
21  explicit ReaderState(const Reader &r);
22 
27  explicit ReaderState(const uint32_t dimensions);
28 
30  eris::eris_id_t id;
31 
33  eris::Position position;
34 
38  std::map<eris::eris_id_t, BookCopy> library;
39 
44 
49 
54  uint32_t library_public;
55 
61 
65  uint32_t library_pirated;
66 
71 
72  std::set<eris::eris_id_t>
74  new_books,
75  wrote;
76 
78  double u;
79 
81  double u_lifetime;
82 
85 
88 
89  // Beliefs, copied out at the time the ReaderState object is created
93  std::map<uint32_t, belief::ProfitStream> profit_stream;
94 
99  const belief::Profit& profitExtrap() const;
100 
107  void updateLibraryCounts(eris::eris_time_t t);
108 };
109 
110 }}
double creation_shape
Creation shape coefficient.
Definition: ReaderState.hpp:84
Records the various variables associated with a reader.
Definition: ReaderState.hpp:18
Primary namespace for all Creativity library code.
Definition: config.hpp:4
This class represents an author&#39;s belief about the per-period demand for books.
Definition: Demand.hpp:36
belief::Profit profit_extrap
Profit beliefs using extrapolation for on-market books (will be default-constructed if there is no ex...
Definition: ReaderState.hpp:91
eris::Position position
Position of the reader.
Definition: ReaderState.hpp:33
uint32_t library_public_new
The number of public provider-purchased books in the reader&#39;s library that were acquired in the curre...
Definition: ReaderState.hpp:60
uint32_t library_public
The number of public provider-purchased books in the reader&#39;s library.
Definition: ReaderState.hpp:54
std::set< eris::eris_id_t > wrote
IDs of books written by this reader.
Definition: ReaderState.hpp:73
A Reader is an agent that both consumes previously unread books and potentially writes new books and ...
Definition: Reader.hpp:141
double u_lifetime
Lifetime cumulative utility up to and including the current period.
Definition: ReaderState.hpp:81
uint32_t library_pirated_new
The number of pirated books in the reader&#39;s library that were acquired in the current period...
Definition: ReaderState.hpp:70
std::map< uint32_t, belief::ProfitStream > profit_stream
Profit stream beliefs.
Definition: ReaderState.hpp:93
uint32_t library_pirated
The number of pirated books in the reader&#39;s library.
Definition: ReaderState.hpp:65
void updateLibraryCounts(eris::eris_time_t t)
Utility method to recalculate purchased, purchased_new, pirated, and pirated_new from the current lib...
uint32_t library_purchased
The number of market-purchased books in the reader&#39;s library.
Definition: ReaderState.hpp:43
This class represents an author&#39;s belief about the lifetime profitability of a work.
Definition: Profit.hpp:33
belief::Demand demand
Single-period demand belief.
Definition: ReaderState.hpp:92
eris::eris_id_t id
Unique simulation ID of the reader.
Definition: ReaderState.hpp:30
uint32_t library_purchased_new
The number of market-purchased books in the reader&#39;s library that were acquired in the current period...
Definition: ReaderState.hpp:48
std::map< eris::eris_id_t, BookCopy > library
The reader&#39;s library: the keys are the book IDs of owned books, the values are the per-reader specifi...
Definition: ReaderState.hpp:38
double u
Utility in the current period.
Definition: ReaderState.hpp:78
const belief::Profit & profitExtrap() const
Returns profit_extrap if it exists (i.e.
std::set< eris::eris_id_t > friends
Friends of the reader.
Definition: ReaderState.hpp:73
belief::Profit profit
Profit beliefs.
Definition: ReaderState.hpp:90
double creation_scale
Creation scale coefficient.
Definition: ReaderState.hpp:87
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...
Definition: ReaderState.hpp:73
ReaderState(const Reader &r)
Constructs a new ReaderState, settings its values using the given Reader.