Skip to content

RealtimeUrbanismLab/ithacaDeveloperABM

Repository files navigation

Ithaca Developer ABM

Table of Contents

Overview

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.

Theoretical Framework

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.

Implementation Details

  • 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.

Dependencies

To run this project, you'll need the following Python packages:

  • mesa
  • mesa-geo
  • shapely
  • pyproj

Installing mesa-geo should install all other dependencies.

Install using pip:

pip install mesa-geo

Setup

  1. Clone the repository:
    git clone https://github.com/RealtimeUrbanismLab/ithacaDeveloperABM.git
    cd ithacaDeveloperABM
  2. Install the required dependencies:
    pip install -r requirements.txt
  3. Ensure you have the correct data files in the data directory.

Python Developer Environment

To set up a Python developer environment:

  1. Install Python: Ensure Python 3.8 or higher is installed on your system. Download from python.org.
  2. Create a Virtual Environment:
    python -m venv venv
  3. Activate the Virtual Environment:
    • On Windows:
      venv\Scripts\activate
    • On macOS/Linux:
      source venv/bin/activate
  4. Install Dependencies:
    pip install -r requirements.txt

Scripts Explanation

run.py

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()

agents.py

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()
  • 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()

model.py

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()

server.py

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

space.py

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()

Data

Ensure the following data files are in the data directory:

  • Parcel Reference Data.geojson

Usage

To run the model, execute the following command:

python run.py

Editing and Customization

Adding New Developers

To add new developers, modify the initialization code in model.py:

for i in range(self.num_developers):
    # Your code to create and add developers

Customizing Parcel Suitability

To change the criteria for parcel suitability, update the is_suitable() method in agents.py:

def is_suitable(self, parcel):
    # Your custom criteria

Visualizing Additional Data

To visualize additional data on the map, modify the agent_portrayal() function in server.py:

def agent_portrayal(agent):
    # Your custom portrayal code

Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •