-
Notifications
You must be signed in to change notification settings - Fork 182
added a new example: city walking behaviour #241
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
Open
Sahil-Chhoker
wants to merge
13
commits into
projectmesa:main
Choose a base branch
from
Sahil-Chhoker:new_example-city-walking-behaviour
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,542
−0
Open
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0142b18
added a new example: city walking behaviour
Sahil-Chhoker c850d5f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 058453d
added pre-commit suggestions
Sahil-Chhoker 91abe57
added model description
Sahil-Chhoker f405721
updated readme
Sahil-Chhoker 7de1a16
improved the model with faster lookups, better placement and better w…
Sahil-Chhoker 32207b2
fixed leisure walks, improved household logic and placement for Humans.
Sahil-Chhoker 9159ee1
fixed imports in model.py
Sahil-Chhoker 7fd5559
fix: model can pass tests
Sahil-Chhoker f32b04e
updated readme
Sahil-Chhoker d6b1e0f
added pictures
Sahil-Chhoker 859c9f0
Update Readme.md
Sahil-Chhoker ba5a4be
applied reviewed changes
Sahil-Chhoker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# Walking Behavior Agent-Based Model | ||
|
||
An agent-based model (ABM) that simulates how people walk in cities based on socioeconomic status, environment, and social factors. | ||
|
||
## What This Model Shows | ||
|
||
This simulation demonstrates how different city layouts and social factors affect walking patterns. Key insights include: | ||
|
||
- How safety perceptions influence route choices | ||
- Impact of socioeconomic status on walking frequency | ||
- Effects of centralized vs distributed city planning | ||
- Relationship between social networks and walking behavior | ||
|
||
## Features | ||
|
||
- Four simulation scenarios: | ||
|
||
- Random layout with random safety (RR) | ||
- Random layout with core safety gradient (RS) | ||
- Centralized layout with random safety (CR) | ||
- Centralized layout with core safety gradient (CS) | ||
|
||
- Agent behaviors include: | ||
- Work commutes | ||
- Shopping trips | ||
- Social visits | ||
- Leisure walks | ||
|
||
## Outcomes in different scenarios | ||
|
||
#### RR | ||
 | ||
|
||
#### RS | ||
 | ||
|
||
#### CR | ||
 | ||
|
||
#### CS | ||
 | ||
|
||
## Quick Start | ||
|
||
1. Run the simulation: | ||
|
||
```python | ||
solara run app.py | ||
``` | ||
|
||
## Technical Details | ||
|
||
### Model Architecture (`model.py`) | ||
|
||
#### Initialization Parameters | ||
|
||
- Grid dimensions (width and height) | ||
- Number of workplaces (categorized into Grocery Stores, Social Places, etc.) | ||
- Population composition (number of couples and singles) | ||
|
||
#### Environmental Layers | ||
|
||
1. **Safety Layer** (`safety_cell_layer`) | ||
|
||
- Values vary based on selected scenario | ||
- Impacts walking behavior and route choices | ||
|
||
2. **Aesthetic Layer** (`aesthetic_cell_layer`) | ||
- Values decrease with distance from center | ||
- Reflects personal preferences in route selection | ||
|
||
### Agent Implementation (`agents.py`) | ||
|
||
#### Human Class Attributes | ||
|
||
- **Demographics**: Gender, Age (18-87), Family Size (1-2), Pet Ownership (20% probability) | ||
- **Personal**: Walking Ability, Walking Attitude, Employment Status | ||
- **Social**: Network of friends and family members | ||
|
||
#### Behavioral System | ||
|
||
Walking attitude influenced by: | ||
|
||
- Social network (family and friends' attitudes) | ||
- Environmental factors (safety and aesthetics) | ||
- Local pedestrian density | ||
- Cumulative walking distance | ||
|
||
### Data Collection | ||
|
||
Tracks metrics across five SES levels (1-5): | ||
|
||
1. Average daily walking trips | ||
2. Work-related trips | ||
3. Basic needs trips | ||
4. Leisure trips | ||
|
||
## File Structure | ||
|
||
- `city_walking_behaviour/model.py`: Core simulation engine | ||
- `city_walking_behaviour/agents.py`: Agent behavior definitions | ||
|
||
## Based On | ||
|
||
This model extends research from ["A Spatial Agent-Based Model for the Simulation of Adults' Daily Walking Within a City"](https://pmc.ncbi.nlm.nih.gov/articles/PMC3306662/) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.