creativity  v1.3.0
Agent-based model of creativity and piracy
CopyrightPolice.hpp
1 #pragma once
2 #include "creativity/Creativity.hpp"
3 #include <eris/Agent.hpp>
4 #include <eris/Optimize.hpp>
5 #include <boost/math/distributions/normal.hpp>
6 
7 namespace creativity {
8 
9 class Creativity;
10 
14 class CopyrightPolice : public eris::Agent, public virtual eris::interopt::Apply, public virtual eris::intraopt::Finish {
15 public:
16  CopyrightPolice() = delete;
17 
23  explicit CopyrightPolice(const Creativity &creativity);
24 
26  void interApply() override;
27 
29  double interApplyPriority() const override { return 1.0; }
30 
34  void intraFinish() override;
35 
37  double tax() const { return creativity_.parameters.policy_catch_tax; }
38 
42  double mu() const { return normal_.mean(); }
43 
47  double sigma() const { return normal_.standard_deviation(); }
48 
52  double prob(unsigned pirated) const { return cdf(normal_, pirated); }
53 
61  double cost() const { return creativity_.parameters.policy_catch_cost; }
62 
68  double fine(unsigned pirated);
69 
70 protected:
73 
75  double tax_;
76 
78  boost::math::normal normal_;
79 };
80 
81 }
double interApplyPriority() const override
Override priority to run after the Reader&#39;s interApply has deposited income.
Definition: CopyrightPolice.hpp:29
Primary namespace for all Creativity library code.
Definition: config.hpp:4
double tax() const
Returns the lump sum per-reader tax collected each period.
Definition: CopyrightPolice.hpp:37
double policy_catch_cost
The utility cost of being accused of piracy.
Definition: CreativitySettings.hpp:172
void intraFinish() override
When the period finishes, we probabilistically detect piracy; readers found pirating and fined...
double sigma() const
Returns the parameter; the probability of being caught is the CDF of a distribution.
Definition: CopyrightPolice.hpp:47
const CreativitySettings & parameters
Simulation parameters that are used to configure the simulation when calling setup().
Definition: Creativity.hpp:36
double cost() const
Returns the cost of being accused of piracy (whether guilty or not).
Definition: CopyrightPolice.hpp:61
double policy_catch_tax
This is the lump-sum tax extracted from each user to fund the policing policy to catch and fine reade...
Definition: CreativitySettings.hpp:164
boost::math::normal normal_
The normal distribution used to generate probabilities.
Definition: CopyrightPolice.hpp:78
double tax_
The lump sum tax amount.
Definition: CopyrightPolice.hpp:75
Central class for a creativity simulation; this class handles setting up the simulation according to ...
Definition: Creativity.hpp:22
This class represents a copyright policing agent that (probabilistically) catches readers who obtain ...
Definition: CopyrightPolice.hpp:14
double mu() const
Returns the parameter; the probability of being caught is the CDF of a distribution.
Definition: CopyrightPolice.hpp:42
double fine(unsigned pirated)
Returns the fine for being caught pirating pirated books this period.
const Creativity & creativity_
The Creativity object that owns the simulation this reader belongs to.
Definition: CopyrightPolice.hpp:72
CopyrightPolice()=delete
Not default constructible.
double prob(unsigned pirated) const
Returns the probability of being caught for a given number of pirated books.
Definition: CopyrightPolice.hpp:52
void interApply() override
When the period advances, we take the lump sum tax from all agents.