2 #include <eris/Market.hpp> 3 #include <eris/Optimize.hpp> 14 class BookMarket :
public eris::Market,
public virtual eris::intraopt::Finish {
29 virtual price_info
price(
double q)
const override;
39 virtual quantity_info
quantity(
double p)
const override;
54 virtual const double&
price();
57 virtual void added()
override;
63 eris::SharedMember<eris::Agent> agent,
65 double p_max = std::numeric_limits<double>::infinity())
override;
68 eris::SharedMember<Book>
book();
77 virtual bool isPublic()
const {
return false; }
85 virtual void buy(Reservation &res)
override;
eris::Bundle proceeds_
Accrued income of the book (these get transferred in the interApply phase)
Definition: BookMarket.hpp:96
Primary namespace for all Creativity library code.
Definition: config.hpp:4
double price_
The current price of the book.
Definition: BookMarket.hpp:94
virtual void setPrice(double p)
Sets the price of copies of the book on the market for future sales.
virtual void intraFinish() override
Transfers all sales (less unit costs) generated in the just-ending period to the author.
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.
virtual void buy(Reservation &res) override
We override reservation completion to transfer the payment to the author and put the book into the b_...
virtual quantity_info quantity(double p) const override
Returns quantity info for a given payment.
eris::SharedMember< Book > book()
Returns the Book sold by this market.
Central class for a creativity simulation; this class handles setting up the simulation according to ...
Definition: Creativity.hpp:22
A BookMarket is very simple: it has an exogenously determined price and can supply infinite copies of...
Definition: BookMarket.hpp:14
eris::SharedMember< Book > book_
The book this market object sells.
Definition: BookMarket.hpp:92
virtual bool isPublic() const
Returns true if this is a public market.
Definition: BookMarket.hpp:77
BookMarket()=delete
Not default constructible.
const Creativity & creativity_
The creativity object pointer.
Definition: BookMarket.hpp:90
virtual const double & price()
Returns the price of a single copy of the book.
virtual void added() override
Registers this market as the book's market when added to the simulation.