Commit 42629e3c authored by Jason Rhinelander's avatar Jason Rhinelander

Rename public_sharing_voting to public_voting

The former is cumbersome.
parent fc9ea94f
......@@ -177,9 +177,9 @@ int main(int argc, char *argv[]) {
"Policy ";
if (creativity.policyActive()) {
std::cout << u8"✔[";
if (creativity.publicSharing()) std::cout << 'P';
if (creativity.publicSharingVoting()) std::cout << 'V';
if (creativity.catchPirates()) std::cout << 'C';
if (creativity.publicSharingActive()) std::cout << 'P';
if (creativity.publicVotingActive()) std::cout << 'V';
if (creativity.catchPiratesActive()) std::cout << 'C';
std::cout << "]; ";
}
else std::cout << u8"✘; ";
......
......@@ -45,8 +45,8 @@ void Creativity::checkParameters() {
PROHIBIT(piracy_link_proportion, < 0);
PROHIBIT(piracy_link_proportion, > 1);
PROHIBIT(policy_public_sharing_tax, < 0);
PROHIBIT(policy_public_sharing_voting_tax, <= 0);
PROHIBIT(policy_public_sharing_voting_votes, < 1);
PROHIBIT(policy_public_voting_tax, <= 0);
PROHIBIT(policy_public_voting_votes, < 1);
PROHIBIT(policy_catch_tax, <= 0);
PROHIBIT(policy_catch_cost, < 0);
PROHIBIT(initial.prob_write, < 0);
......@@ -275,27 +275,27 @@ bool Creativity::policyActive() const {
return parameters.policy and parameters.policy_begins > 0 and sim->t() >= parameters.policy_begins;
}
bool Creativity::publicSharing() const {
if (!setup_sim_) throw std::logic_error("Cannot call publicSharing() on a non-live or unconfigured simulation");
bool Creativity::publicSharingActive() const {
if (!setup_sim_) throw std::logic_error("Cannot call publicSharingActive() on a non-live or unconfigured simulation");
return parameters.policy & POLICY_PUBLIC_SHARING and policyActive();
}
bool Creativity::publicSharingVoting() const {
if (!setup_sim_) throw std::logic_error("Cannot call publicSharingVoting() on a non-live or unconfigured simulation");
bool Creativity::publicVotingActive() const {
if (!setup_sim_) throw std::logic_error("Cannot call publicVotingActive() on a non-live or unconfigured simulation");
return parameters.policy & POLICY_PUBLIC_SHARING_VOTING and policyActive();
}
bool Creativity::catchPirates() const {
if (!setup_sim_) throw std::logic_error("Cannot call catchPirates() on a non-live or unconfigured simulation");
bool Creativity::catchPiratesActive() const {
if (!setup_sim_) throw std::logic_error("Cannot call catchPiratesActive() on a non-live or unconfigured simulation");
return parameters.policy & POLICY_CATCH_PIRATES and policyActive();
}
double Creativity::policyTaxes() const {
if (!setup_sim_) throw std::logic_error("Cannot call policyTaxes() on a non-live or unconfigured simulation");
double tax = 0;
if (catchPirates()) tax += parameters.policy_catch_tax;
if (publicSharing()) tax += parameters.policy_public_sharing_tax;
if (publicSharingVoting()) tax += parameters.policy_public_sharing_voting_tax;
if (catchPiratesActive()) tax += parameters.policy_catch_tax;
if (publicSharingActive()) tax += parameters.policy_public_sharing_tax;
if (publicVotingActive()) tax += parameters.policy_public_voting_tax;
return tax;
}
......
......@@ -158,21 +158,21 @@ class Creativity : private eris::noncopyable {
* begins). Attempting to call this on a Creativity object that is not a live simulation,
* or is a live simulation but has not been set up yet, will raise an exception.
*/
bool publicSharing() const;
bool publicSharingActive() const;
/** Returns true if public sharing with voting is an enabled policy response *and* it is
* active in the simulation (i.e. the simulation has reached the period in which the policy
* response begins). Attempting to call this on a Creativity object that is not a live
* simulation, or is a live simulation but has not been set up yet, will raise an exception.
*/
bool publicSharingVoting() const;
bool publicVotingActive() const;
/** Returns true if getting caught for piracy is a configured policy response *and* it is
* active in the simulation (i.e. the simulation has reached the policy response stage).
* Attempting to call this on a Creativity object that is not a live simulation, or is a
* live simulation but has not been set up yet, will raise an exception.
*/
bool catchPirates() const;
bool catchPiratesActive() const;
/** Returns the per-user policies taxes currently in effect. Before the policy comes into
* effect, this is 0; afterwards, it is whatever is the sum of the taxes of whichever
......
......@@ -145,7 +145,7 @@ struct CreativitySettings {
/** This is the lump-sum per-reader tax for public sharing with voting. Has no effect when
* public sharing with voting is not enabled. Must be strictly greater than 0.
*/
double policy_public_sharing_voting_tax = 10.0;
double policy_public_voting_tax = 10.0;
/** The number of votes each reader receives in the public-sharing-with-voting regime. Voters
* cast votes in (rough) proportion to the net utility they received from reading each public
......@@ -155,7 +155,7 @@ struct CreativitySettings {
* given 4 votes, he would cast 3 votes for book 1, and 1 vote for book 2; with 18 votes he
* would cast 10, 5, 2, 1.
*/
uint32_t policy_public_sharing_voting_votes = 3;
uint32_t policy_public_voting_votes = 3;
/** This is the lump-sum tax extracted from each user to fund the policing policy to catch and
* fine readers using piracy. Has no effect when the catching policy is not enabled.
......
......@@ -19,7 +19,7 @@ PublicTracker::PublicTracker(const Creativity &creativity) : creativity_{std::mo
if (dl and dlTax() < 0) throw std::domain_error("PublicTracker creation error: public sharing lump sum tax cannot be negative");
if (vote) {
if (voteTax() <= 0) throw std::domain_error("PublicTracker creation error: public voting lump sum tax must be positive");
if (creativity_.parameters.policy_public_sharing_voting_votes <= 0)
if (creativity_.parameters.policy_public_voting_votes <= 0)
throw std::domain_error("PublicTracker creation error: number of votes must be positive");
}
}
......@@ -27,7 +27,7 @@ PublicTracker::PublicTracker(const Creativity &creativity) : creativity_{std::mo
void PublicTracker::interApply() {
auto lock = writeLock();
// If the tax is 0, we don't need to do any transfers.
if (creativity_.publicSharing() and dlTax() > 0) {
if (creativity_.publicSharingActive() and dlTax() > 0) {
Bundle tax_bill(creativity_.money, dlTax());
for (auto &r : simulation()->agents<Reader>()) {
lock.add(r);
......@@ -36,7 +36,7 @@ void PublicTracker::interApply() {
}
}
if (creativity_.publicSharingVoting() and voteTax() > 0) {
if (creativity_.publicVotingActive() and voteTax() > 0) {
Bundle tax_bill(creativity_.money, voteTax());
for (auto &r : simulation()->agents<Reader>()) {
lock.add(r);
......@@ -114,10 +114,10 @@ void PublicTracker::distributeVoteFunds() {
void PublicTracker::intraFinish() {
if (creativity_.publicSharing())
if (creativity_.publicSharingActive())
distributeDLFunds();
if (creativity_.publicSharingVoting())
if (creativity_.publicVotingActive())
distributeVoteFunds();
}
......
......@@ -73,7 +73,7 @@ class PublicTracker : public eris::Agent,
double dlTax() const { return creativity_.parameters.policy_public_sharing_tax; }
/// Returns the lump sum per-reader tax collected each period for vote-based compensation
double voteTax() const { return creativity_.parameters.policy_public_sharing_voting_tax; }
double voteTax() const { return creativity_.parameters.policy_public_voting_tax; }
/** Returns the current total asset pool that will be distributed to authors (proportional
* to downloads) at the end of the current period. If called between periods, this will be
......
......@@ -323,7 +323,7 @@ void Reader::interOptimize() {
// sharing cost (which is the minimum of unit cost and piracy cost) if that is lower (since
// that's what the public sharing marginal cost and price ends up being).
double marginal_cost = creativity_.parameters.cost_unit;
if (creativity_.publicSharing() and creativity_.parameters.cost_piracy < marginal_cost)
if (creativity_.publicSharingActive() and creativity_.parameters.cost_piracy < marginal_cost)
marginal_cost = creativity_.parameters.cost_piracy;
double min_effort = creationEffort(distancePenalty(0) + numBooksPenalty(1) + 1.05 * marginal_cost);
double max_effort = income_available - creation_base_cost;
......@@ -769,7 +769,7 @@ void Reader::updateProfitBelief() {
// beliefs
extrap_books.push_back(b);
}
else if (creativity_.publicSharing()) {
else if (creativity_.publicSharingActive()) {
// If public sharing exists, we wait until the book has been off the private market for
// 5 periods (so that it has most likely earned any public money it's going to get)
if (t - b->leftPrivateMarket() >= 5)
......@@ -902,7 +902,7 @@ void Reader::intraOptimize() {
// Get expected piracy penalty value:
SharedMember<CopyrightPolice> police;
auto exp_piracy_cost = [this, &police](unsigned pirated) -> double {
if (!creativity_.catchPirates())
if (!creativity_.catchPiratesActive())
return 0.0;
double prob = police->prob(pirated);
......@@ -912,7 +912,7 @@ void Reader::intraOptimize() {
unsigned books_pirating = 0;
double piracy_penalty = 0, piracy_penalty_next = 0;
if (creativity_.catchPirates())
if (creativity_.catchPiratesActive())
police = simulation()->agents<CopyrightPolice>()[0];
// Baseline expected penalty: even if we don't pirate, there's some probability of being
......@@ -1064,7 +1064,7 @@ void Reader::intraApply() {
}
reserved_books_.clear();
if (creativity_.publicSharingVoting()) {
if (creativity_.publicVotingActive()) {
// If we are voting, figure out the distribution of votes, by allocating votes in coarse
// proportion to the realized book sub-utility (i.e. uBook(), the book utility, minus its
// cost (market or piracy), without taking into account the added opportunity cost of
......@@ -1105,7 +1105,7 @@ void Reader::intraApply() {
if (not book_subu.empty()) {
while (total_votes < creativity_.parameters.policy_public_sharing_voting_votes) {
while (total_votes < creativity_.parameters.policy_public_voting_votes) {
// We need to change the key, which means we have to remove and reinsert the element
// (so that it gets resorted into the right place in the multimap).
auto best = book_subu.begin();
......
......@@ -85,8 +85,8 @@ void Simulator::addOptions() {
pol_public.add_options()
("public-sharing-tax,A", min<0>(s_.policy_public_sharing_tax), "The per-period, lump sum tax collected from each reader for --policy=public-sharing")
("public-voting-tax,V", above<0>(s_.policy_public_sharing_voting_tax), "The per-period, lump sum tax collected from each reader for --policy=public-voting")
("public-voting-votes,v", min<1>(s_.policy_public_sharing_voting_votes), "The number of votes each readers gets for --policy=public-voting")
("public-voting-tax,V", above<0>(s_.policy_public_voting_tax), "The per-period, lump sum tax collected from each reader for --policy=public-voting")
("public-voting-votes,v", min<1>(s_.policy_public_voting_votes), "The number of votes each readers gets for --policy=public-voting")
;
policy.add(pol_public);
......
......@@ -938,8 +938,8 @@ void GUI::thr_update_parameters() {
SET_SB(policy_public_sharing_tax);
// Public voting policy:
SET_SB(policy_public_sharing_voting_tax);
SET_SB(policy_public_sharing_voting_votes);
SET_SB(policy_public_voting_tax);
SET_SB(policy_public_voting_votes);
// Catching policy:
SET_SB(policy_catch_tax);
......@@ -955,7 +955,7 @@ void GUI::thr_update_parameters() {
creativity_.parameters.policy & POLICY_PUBLIC_SHARING);
widget<Gtk::CheckButton>("set_policy_catch")->set_active(
creativity_.parameters.policy & POLICY_CATCH_PIRATES);
widget<Gtk::CheckButton>("set_policy_public_sharing_voting")->set_active(
widget<Gtk::CheckButton>("set_policy_public_voting")->set_active(
creativity_.parameters.policy & POLICY_PUBLIC_SHARING_VOTING);
if (creativity_.parameters.policy & ~(POLICY_PUBLIC_SHARING | POLICY_CATCH_PIRATES | POLICY_PUBLIC_SHARING_VOTING))
......
......@@ -146,8 +146,8 @@ void FileStorage::configureHeaderFields() {
addHeaderField(settings_.policy_public_sharing_tax);
addHeaderField(settings_.policy_public_sharing_voting_tax);
addHeaderField(settings_.policy_public_sharing_voting_votes);
addHeaderField(settings_.policy_public_voting_tax);
addHeaderField(settings_.policy_public_voting_votes);
addHeaderField(settings_.policy_catch_tax);
addHeaderField(settings_.policy_catch_cost);
......
......@@ -62,7 +62,7 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adj_policy_public_sharing_voting_tax">
<object class="GtkAdjustment" id="adj_policy_public_voting_tax">
<property name="lower">0.01</property>
<property name="upper">1000</property>
<property name="step_increment">1</property>
......@@ -2399,7 +2399,7 @@ This paramter is &lt;b&gt;s₂&lt;/b&gt;.</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_policy_public_sharing_voting">
<object class="GtkLabel" id="lbl_policy_public_voting">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;&lt;u&gt;Public voting&lt;/u&gt;&lt;/b&gt;</property>
......@@ -2412,7 +2412,7 @@ This paramter is &lt;b&gt;s₂&lt;/b&gt;.</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_policy_public_sharing_voting_tax">
<object class="GtkLabel" id="lbl_policy_public_voting_tax">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Lump-sum tax</property>
......@@ -2424,7 +2424,7 @@ This paramter is &lt;b&gt;s₂&lt;/b&gt;.</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="set_policy_public_sharing_voting">
<object class="GtkCheckButton" id="set_policy_public_voting">
<property name="label" translatable="yes">Enabled</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
......@@ -2438,7 +2438,7 @@ This paramter is &lt;b&gt;s₂&lt;/b&gt;.</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbl_policy_public_sharing_voting_votes">
<object class="GtkLabel" id="lbl_policy_public_voting_votes">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Votes per reader</property>
......@@ -2450,7 +2450,7 @@ This paramter is &lt;b&gt;s₂&lt;/b&gt;.</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="set_policy_public_sharing_voting_tax">
<object class="GtkSpinButton" id="set_policy_public_voting_tax">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">The per-period lump-sum tax paid by each reader to fund public provisioning. The amount is redistributed to authors in proportion to votes cast for their works.</property>
......@@ -2458,7 +2458,7 @@ This paramter is &lt;b&gt;s₂&lt;/b&gt;.</property>
<property name="invisible_char"></property>
<property name="text" translatable="yes">0.00</property>
<property name="input_purpose">number</property>
<property name="adjustment">adj_policy_public_sharing_voting_tax</property>
<property name="adjustment">adj_policy_public_voting_tax</property>
<property name="digits">2</property>
<property name="numeric">True</property>
<property name="update_policy">if-valid</property>
......@@ -2469,7 +2469,7 @@ This paramter is &lt;b&gt;s₂&lt;/b&gt;.</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="set_policy_public_sharing_voting_votes">
<object class="GtkSpinButton" id="set_policy_public_voting_votes">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">The number of votes each reader receives. Readers cast their votes using a mechanism that is coarsely proportional to the net utility they gained from each public market book (ignoring the opportunity cost).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment