-
Notifications
You must be signed in to change notification settings - Fork 165
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
added a new example: city walking behaviour #241
base: main
Are you sure you want to change the base?
added a new example: city walking behaviour #241
Conversation
Looks like quite a serious model! If you could add to the PR description:
|
Thanks for the extended descriptions. Have you profiled the model to identify the main performance bottlenecks? |
@projectmesa/maintainers I’m a bit in doubt on the complexity of this example. On the one hand it shows you can create ABMs with detailed environments and complex behavior, on the other hand I don’t know an example this extended would really benefit our users. I would like to hear some of your stances. |
I haven't, can you tell how can I do that? |
Some starting point: Most IDEs also have a profiler built-in. |
Here is the table I built from the data collected by the profiler running the model 10 times. Performance Analysis Results
|
Okay, this is quite useful already! It shows that most of the runtime is taken up in the Agent You can try to speed that up, but if you want I can also give it a try (hopefully tomorrow or Monday). |
I'll do what I can, but I'm not particularly confident. Can we use caching to prevent duplicate lookups in |
Hypothesis for model results not correlating with the paper:
|
In theory this should work:
|
I have successfully visualized the property layers, and they are functioning as intended. Before moving on to the other points, I reread the paper and realized I had overlooked the concept of households. I will now implement the household concept and check the results again. |
Awesome, that's amazing to hear! Did you figure out what the bug was or what I missed yesterday? |
CC @tpike3, Households sounds like Meta agents. Maybe you could assist here! |
@EwoutH Unfortunately no, but since they are just a bunch of numpy arrays I exported the data and made some graphs based on the values. I can confirm they are implemented as they are intended.
I read a bit about MetaAgents, and from my understanding, they are groups of agents that form during the model runtime based on certain properties. While I can see their usefulness, I don’t think they are particularly relevant to this model. This is because the household system is defined during the human placement, and a household is simply the cell where they spawn. Therefore, in my opinion, this can be handled during initialization. |
Thanks, sounds good! |
@EwoutH I have a question: is it correct to use |
it's better to use |
I have thoroughly reviewed the model in every aspect and believe I have covered everything correctly. In my opinion, the only remaining task is to make the model efficient enough to run on an 800x800 grid or decide to keep this simpler model after applying smaller optimizations. Current Profile: Running the model with 20x20 grid and 1350 humans for 10 steps.
|
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 might be nice to add a high-level overview of the (expected) results in this Readme, and maybe a screenshot or two to support that.
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.
Understood!
Awesome, I will do a full review this weekend. |
Add Walking Behavior Agent-Based Model
Summary
This PR introduces an Agent-Based Model (ABM) for simulating walking behavior in a hypothetical city. The model explores how socioeconomic status (SES), built environment, and social factors dynamically influence walking patterns. The following files and components have been added to the repository:
Files Added
README.md:
Model.py
:SES
valuesAgents.py
:Key Features Added
1. Initialization Parameters
2. Environmental Layers
safety_cell_layer
): Dynamic safety values according to the scenarios influencing route selection.aesthetic_cell_layer
): Center-focused aesthetic value distribution impacting walking preferences.3. Simulation Scenarios
4. Agent Characteristics
5. Behavioral Feedback Mechanisms
Social Influence:
Walking Experience:
Density of Walkers:
Total Distance Walked:
Daily Attitude Update:
6. Data Collection System
Known Shortcomings
to be compared with