-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Boltzmann wealth model: Use the new Mesa 2.2 API & some refactors #79
base: main
Are you sure you want to change the base?
Conversation
rht
commented
Jan 7, 2024
•
edited
Loading
edited
- Depends on refactor: Remove dependence on model.schedule, add clock to Model mesa#1942 to be merged.
This is ready for review. |
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.
Thanks! One thing I would like to have changed, otherwise looks good!
Approving assuming the change below is made.
if len(cellmates) > 0: | ||
other = self.random.choice(cellmates) | ||
other.wealth += 1 | ||
self.wealth -= 1 | ||
|
||
def step(self): | ||
self.move() | ||
if self.wealth > 0: | ||
self.give_money() | ||
self.give_money() |
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.
I liked the old check here better, it made it explicit that only money was given when there was any to give.
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.
What about maybe_give_money
?
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.
Yeah renaming the function would also work (consider_giving_money
maybe), but for explicitness I liked the old structure better.
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.
My reasoning is different. The check gives a constraint to the give_money
method that prevents negative wealth.
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.
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.
I am just curious why you said the name choice is based on Haskells Maybe monad. If it's just about maybe doing something, then the dictionary definition of maybe would suffice. What am I missing?
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.
I have already said this
If you are concerned about the connotation with the monad, then there is this usage in Golang.
It's just my first encounter on the usage of the term "maybe" in naming in the context of programming.
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.
And I have already said that I am not concerned but just curious 😅
I have no idea what you want to tell me, but we should probably just leave this conversation. It's not important.
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.
I also think the older version was better, because more explicit.
I agree. It's more explicit and more readable. These are user targeted examples, that show behavior. Not some mission critical application. Let's leave it the old way.
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.
Reverted.
d55d144
to
6256ce4
Compare
The tests are failing is this because the tests are now wrong? (Apologies for the delay) |
Fixed in projectmesa/mesa#2050. |
Looks good to go! |
I agree, this can be merged. |
If this is merged, anyone trying to run the example from the latest stable release will encounter an error. |