|
creativity
v1.3.0
Agent-based model of creativity and piracy
|
A BookMarket is very simple: it has an exogenously determined price and can supply infinite copies of a Book at that price. More...
#include <creativity/BookMarket.hpp>
Public Member Functions | |
| BookMarket ()=delete | |
| Not default constructible. | |
| BookMarket (const Creativity &creativity, eris::SharedMember< Book > b, double price) | |
| Constructs a BookMarket that sells copies of the given Book with an initial price of p times the money good. More... | |
| virtual price_info | price (double q) const override |
| Returns price info. More... | |
| virtual quantity_info | quantity (double p) const override |
| Returns quantity info for a given payment. More... | |
| virtual void | setPrice (double p) |
| Sets the price of copies of the book on the market for future sales. More... | |
| virtual const double & | price () |
| Returns the price of a single copy of the book. More... | |
| virtual void | added () override |
| Registers this market as the book's market when added to the simulation. More... | |
| virtual Reservation | reserve (eris::SharedMember< eris::Agent > agent, double q, double p_max=std::numeric_limits< double >::infinity()) override |
| Reserves a copy of a book, paying at most p_max for it. More... | |
| eris::SharedMember< Book > | book () |
| Returns the Book sold by this market. More... | |
| virtual void | intraFinish () override |
| Transfers all sales (less unit costs) generated in the just-ending period to the author. | |
| virtual bool | isPublic () const |
| Returns true if this is a public market. More... | |
| virtual void | buy (Reservation &res) override |
| We override reservation completion to transfer the payment to the author and put the book into the b_ bundle. More... | |
Protected Attributes | |
| const Creativity & | creativity_ |
| The creativity object pointer. | |
| eris::SharedMember< Book > | book_ |
| The book this market object sells. | |
| double | price_ |
| The current price of the book. | |
| eris::Bundle | proceeds_ |
| Accrued income of the book (these get transferred in the interApply phase) | |
A BookMarket is very simple: it has an exogenously determined price and can supply infinite copies of a Book at that price.
| creativity::BookMarket::BookMarket | ( | const Creativity & | creativity, |
| eris::SharedMember< Book > | b, | ||
| double | price | ||
| ) |
Constructs a BookMarket that sells copies of the given Book with an initial price of p times the money good.
Books are created as needed at zero cost.
|
overridevirtual |
Registers this market as the book's market when added to the simulation.
Reimplemented in creativity::PublicTrackerMarket.
|
overridevirtual |
|
inlinevirtual |
Returns true if this is a public market.
This class always returns false; public market subclasses are intended to override.
Reimplemented in creativity::PublicTrackerMarket.
|
overridevirtual |
Returns price info.
Since price is constant, and quantity should always 1, this price info is simple: it's always feasible, and total is just the price.
| q | the quantity, which must be 1. |
| std::logic_error | if the given quantity does not equal 1.0. |
|
virtual |
Returns the price of a single copy of the book.
This will be the same value as any of m.price(1).total, m.price(1).marginalFirst, m.price(1).marginal.
This is guaranteed not to change during an intra-period optimization phase (and so a read lock on the market to obtain market price is not required).
|
overridevirtual |
Returns quantity info for a given payment.
As long as the given price is at least as large as the market price, this returns a quantity_info with quantity set to 1, constrained set to false, spent set to the price, and unspent set to p minus the price.
Otherwise (if p is too low) this returns a quantity of 0, spent set to 0, constrained set to false, and unspent set to p.
|
overridevirtual |
Reserves a copy of a book, paying at most p_max for it.
The q argument must be 1: you can't buy anything other than 1 copy.
|
virtual |
Sets the price of copies of the book on the market for future sales.
The value is a multiple of creativity::MONEY.
This may not be called during an intra-optimization phase.
1.8.12