- Overview
- Theoretical Framework
- Implementation Details
- Dependencies
- Setup
- Scripts Explanation
- Data
- Usage
- Editing and Customization
- Resources
ithacaDeveloperABM is an agent-based model simulating developer behavior in Ithaca. The model includes parcels of land, developers seeking suitable parcels, and various criteria for parcel suitability.
The code simulates the behavior of developers and parcels in a city using a multi-agent simulation model. Developers and parcels are represented as agents that interact with each other over a series of time steps.
- Developer Behavior: Developers search for suitable parcels for development based on factors like zoning, land use, and proximity to desirable locations.
- Parcel Characteristics: Parcels have attributes like development status, land-to-improvement ratio, and suitability for development.
- Assessment and Decision Making: Developers and parcels use weighted factors to assess suitability and make decisions.
- Spatial Context: The model uses real-world coordinates and spatial data.
- Simulation Over Time: The model runs for a specified number of steps, during which developers assess and move to parcels.
- Initialization: Parcels are read from a GeoJSON file and developers are randomly placed on these parcels.
- Developer Class: Handles developer behavior, including parcel assessment and movement.
- Parcel Class: Handles parcel characteristics and assessment.
- City Model Class: Manages the overall simulation, including agent scheduling and data collection.
- Server and Visualization: Uses Mesa's server and visualization modules for simulation display and data collection.
- Space Class: Manages the spatial aspects of parcels.
To run this project, you'll need the following Python packages:
mesamesa-geoshapelypyproj
Installing mesa-geo should install all other dependencies.
Install using pip:
pip install mesa-geo- Clone the repository:
git clone https://github.com/RealtimeUrbanismLab/ithacaDeveloperABM.git cd ithacaDeveloperABM - Install the required dependencies:
pip install -r requirements.txt
- Ensure you have the correct data files in the
datadirectory.
To set up a Python developer environment:
- Install Python: Ensure Python 3.8 or higher is installed on your system. Download from python.org.
- Create a Virtual Environment:
python -m venv venv
- Activate the Virtual Environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
- Install Dependencies:
pip install -r requirements.txt
This is the main entry point of the application. It launches the server to visualize the agent-based model.
from utils.server import server
server.launch()Defines the Developer and Parcel agent classes. The Developer class represents a developer seeking parcels, while the Parcel class represents parcels of land with various attributes.
-
Developer class:
- Attributes:
unique_id,model,geometry,crs,color,parcel_id - Methods:
step(),is_suitable(),is_not_cemetry(),move_to(),get_color()
- Attributes:
-
Parcel class:
- Attributes:
unique_id,model,geometry,crs,developed,assessed,developer - Methods:
random_point(),color(),assess(),normalize(),convert_lat_lon_to_crs(),get_parcel_improvement2land_ratio(),assess_development_suitability(),assess_proximity_to_desirable_locations()
- Attributes:
Defines the CityModel class, representing the entire simulation model. It includes initialization of developers and parcels, and the simulation step logic.
- Attributes:
num_developers,step_counter,max_steps,schedule,space,datacollector - Methods:
__init__(),step(),count_type()
Configures and launches the Mesa visualization server. It includes agent portrayal for visualization and UI elements for adjusting simulation parameters.
- Functions:
agent_portrayal() - Components:
map_element,chart,server
Defines the IthacaParcels class, managing the spatial aspects of the parcels, including adding and removing developers from parcels.
- Attributes:
_id_parcel_map,num_people,smallest_improvement_land_ratio_value,biggest_improvement_land_ratio_value - Methods:
add_parcels(),update_improvement_land_ratio_values(),normalize_improvement_land_ratio(),add_developer_to_parcel(),remove_developer_from_parcel(),get_random_parcel_id(),get_parcel_by_id()
Ensure the following data files are in the data directory:
Parcel Reference Data.geojson
To run the model, execute the following command:
python run.pyTo add new developers, modify the initialization code in model.py:
for i in range(self.num_developers):
# Your code to create and add developersTo change the criteria for parcel suitability, update the is_suitable() method in agents.py:
def is_suitable(self, parcel):
# Your custom criteriaTo visualize additional data on the map, modify the agent_portrayal() function in server.py:
def agent_portrayal(agent):
# Your custom portrayal code