Closed nkremerh closed 1 month ago
It looks like the deviation is solely due to the fact that cellsInRange
can be restricted by both vision and movement, not only vision as is suggested by the old calculation. When agents have lower movement than vision, they shouldn't have vision * 4
cells in range; this is already included in the logic for findCellsInRange
. It's an improvement to simulation accuracy, so I think it's a good change.
Some other thoughts on this code:
len(neighbor.cell.neighbors)
will always be the same for every neighbor (4 or 8 depending on neighborhood mode) so it can be calculated outside of the loop to reduce runtime. We saw previously that any len
calls inside the loop drastically increased runtime, and this somewhat extends to other function calls too.len(neighbor.cellsInRange)
is going to be much more expensive. Maybe I can write a function to replace this if needed, or we could store this number when calculating cellsInRange
.extent
or futureExtent
translate well from the felicific calculus and correlate with overall success/happiness in the way we think they do. It's supposed to represent something like "how many agents are affected by the pleasure", but the only agents affected during a move are the agent moving, the agent to be killed (if one exists), and agents who could have benefited more by going to that cell. I'm implementing this in my opportunity cost-based model which should be finished within a few days of starting work (off hours). You could also include debtors and calculate the potential benefit of bringing a child into the world—the latter might fix *Top
models.Resolved by #78.
The
Bentham
class inethics.py
relies upon magic numbers (carried over from the initial implementation) in some crucial lines (not a complete list):It would be preferable to replace these magic numbers with information which can be interrogated from the individual agents. This information did not exist during the initial implementation but has since been included.
As a first pass, consider the inclusion of the following lines in
ethics.py
:These replace the usage of magic numbers and assumed constants with information directly pulled from agents. However, the results of test simulations deviate between the current, magic number based version and these new calculations dropped in. Theoretically, these should be the same if both versions are given the same default configuration (with only the seed value change, such as
12345
).Opening this up for thoughts as we enter the design phase of this update.