-
Notifications
You must be signed in to change notification settings - Fork 19
Add UBI Component #19
base: master
Are you sure you want to change the base?
Conversation
Create a UBI component that distributions a constant amount of coin to each mobile agent every period, drawing from the planner agent's coin endowment (which currently can run into the negatives).
Allow the planner agent to determine the UBI payment amount. In more detail: Convert UBI to have discretized amounts that the planner can choose from, define get_n_actions() to allow the planner’s actions to determine UBI payment amount, and define set_new_period_amt_model() to update the UBI payment amount each period.
Allow the planner and mobile agents to see the position in the UBI cycle as well as the UBI amount and previous UBI amount. Track the UBI payment amount of the previous step to use in observations. Also add additional reset steps (for correctness).
Restrict planner actions so that the agent can only act/modify UBI on the appropriate day of the cycle. Also add logging that shows the size of UBI payments used at each time step.
Create a version of PeriodicBracketTax that does not do lumpsum redistribution and instead adds revenue to the planner agent's coin endowment.
Fix bugs after testing UBI and SimpleRevenue components. Both appear to run and seem in working order.
Require planner to choose a UBI payment amount that its current coin endowment can pay out without becoming negative. Also edit the NO-OP operation so that it sets UBI to 0. (Otherwise, maintaining a UBI rate may drive planner coin into the negatives.) This may change though.
Reformatted using format_and_lint.sh.
Thanks for the contribution! Before we can merge this, we need @sarahlc888 to sign the Salesforce.com Contributor License Agreement. |
|
||
|
||
@component_registry.add | ||
class SimpleRevenue(BaseComponent): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sarahlc888 -- SimpleRevenue seems to still be a copy of the old tax component? Are you still working on this, or is this no longer needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is the same as the existing component but adds tax revenue to the planner coin endowment rather than redistributing it. (See line 389 for example.) I realize that the code is very redundant—is there an alternative approach you had in mind? I was not sure how to go about this.
self.amt_min, self.amt_max + self.amt_disc, self.amt_disc | ||
) | ||
self.disc_amts = self.disc_amts[self.disc_amts <= self.amt_max] | ||
assert len(self.disc_amts) > 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs amt_min < amt_max and amt_max - amt_min >= amt_disc ... could be more transparent to check for that instead?
# When NO-OP, set UBI as 0 (cannot do nothing because agent may | ||
# not be able to afford the same UBI rate as last time) | ||
if planner_action == 0: | ||
self.curr_amt_index = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amt_index = 0 sets the UBI amount to amt_min, not 0?
else: | ||
raise ValueError | ||
|
||
def pay_ubi(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should check whether the planner has enough money in its inventory to pay for the UBI, so check that the planner's Coin doesn't go below 0.
You could just remove all the tax-related stuff and only keep the revenue
part. You can have multiple components active (tax, revenue, etc) in an
environment.
Stephan Zheng
Lead Research Scientist, Salesforce Research
www.stephanzheng.com
…On Thu, Mar 11, 2021 at 10:26 AM sarahlc888 ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In ai_economist/foundation/components/simple_revenue.py
<#19 (comment)>
:
> +from copy import deepcopy
+
+import numpy as np
+
+from ai_economist.foundation.base.base_component import (
+ BaseComponent,
+ component_registry,
+)
+from ai_economist.foundation.components.utils import (
+ annealed_tax_limit,
+ annealed_tax_mask,
+)
+
+
***@***.***_registry.add
+class SimpleRevenue(BaseComponent):
It is the same as the existing component but adds tax revenue to the
planner coin endowment rather than redistributing it. (See line 389 for
example.) I realize that the code is very redundant—is there an alternative
approach you had in mind? I was not sure how to go about this.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#19 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB5HGLZB4F3YN3XNOUDBWETTDD4MTANCNFSM4X5EXMWQ>
.
|
Could you elaborate? Sorry, I was not sure how to use the taxation functionality of PeriodicBracketTax without using the redistribution functionality as well, since it's all in the enact_taxes() method. Unless it's alright to expand on that class itself and create a parameter for a new "mode"? |
Yes, we could have the redistribution be optional. @alextrott16? I would make SimpleRevenue -- which would just add Coin to the planner's inventory -- a separate component. |
I created a UBI component and a SimpleRevenue component for use alongside it.
The UBI component distributes a payment amount (set by the planner agent) to each mobile agent every n timesteps, subtracting the sum of all payments from the planner's coin endowment. (Actions are masked when the UBI amount is chosen at the start of each cycle such that the planner can only set payment amounts that its coin endowment can cover.)
The SimpleRevenue component is a modified version of PeriodicBracketTax that adds tax revenue to the planner's coin endowment rather than doing lumpsum redistribution, which is used to provide funds for the UBI component.
Please, let me know if the code looks good and what additions/changes you would suggest. Thank you for your help!