creativity  v1.3.0
Agent-based model of creativity and piracy
Public Member Functions | Protected Member Functions | List of all members
creativity::PublicTrackerMarket Class Reference

This class extends BookMarket by always pricing the book at marginal cost (and thus never has any profits). More...

#include <creativity/PublicTrackerMarket.hpp>

Public Member Functions

 PublicTrackerMarket (const Creativity &creativity, eris::SharedMember< Book > b)
 Constructs a PublicTrackerMarket that sells copies of the given Book at marginal cost of the lower of unit_cost or piracy_cost.
 
virtual void added () override
 Sets the initial price and registers this as the book's market when added to the simulation.
 
virtual void interAdvance () override
 Updates the market price of the book to the minimum of unit_cost or piracy_cost (in case those changed for the upcoming period).
 
virtual void intraFinish () override
 Overrides BookMarket finish to just discard proceeds instead of transferring them to the author: since price is at marginal cost, net proceeds will come out to 0 anyway, so there is never any profit to redistribute. More...
 
virtual bool isPublic () const override
 Returns true: this is a public market. More...
 
- Public Member Functions inherited from creativity::BookMarket
 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 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< Bookbook ()
 Returns the Book sold by this 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 Member Functions

void updatePrice ()
 Resets price to the smaller of cost_unit and cost_piracy.
 

Additional Inherited Members

- Protected Attributes inherited from creativity::BookMarket
const Creativitycreativity_
 The creativity object pointer.
 
eris::SharedMember< Bookbook_
 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)
 

Detailed Description

This class extends BookMarket by always pricing the book at marginal cost (and thus never has any profits).

It is created by PublicTracker for books that are taken off (or are never placed on) the market by authors.

Member Function Documentation

§ intraFinish()

virtual void creativity::PublicTrackerMarket::intraFinish ( )
overridevirtual

Overrides BookMarket finish to just discard proceeds instead of transferring them to the author: since price is at marginal cost, net proceeds will come out to 0 anyway, so there is never any profit to redistribute.

(Technically, the proceeds should be transferred to the PublicTracker, which should also subtract costs, but we just skip that step by just clearing any proceeds).

Reimplemented from creativity::BookMarket.

§ isPublic()

virtual bool creativity::PublicTrackerMarket::isPublic ( ) const
inlineoverridevirtual

Returns true: this is a public market.

Reimplemented from creativity::BookMarket.

Inheritance diagram for creativity::PublicTrackerMarket:
[legend]
Collaboration diagram for creativity::PublicTrackerMarket:
[legend]

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