Skip to main content

A simulation tool to find as many as carpool-able trips given drive-alone trips

Project description

CarpoolSim: A simulation framework to find carpool trips given Single Occupancy Trips

One can refer to the GitHub repository for source code and more information about this package.

How to cite?

If you use the tool, it is strongly recommended to cite the tool using the following link:

@inproceedings{
   title={Evaluating Potential SOC Commuter Home-to-Work Carpool Using a Scalable and Practical Simulation Framework}
   author={Liu, Diyi and Fan, Huiying and Guin, Angshuman and Guensler, Randall}
   year={2024}
   booktitle={Journal of Transport Geography}
}

Or,

@inproceedings{
   title={CarpoolSim: A Computational Framework Measuring Carpool Potentials Given Travel Demands}
   author={Liu, Diyi and Fan, Huiying and Guin, Angshuman and Guensler, Randall}
   year={2024}
   booktitle={SoftwareX}
}

Or,

@article{liu2022evaluating,
  title={Evaluating the Sustainability Impacts of Intelligent Carpooling Systems for SOV Commuters in the Atlanta Region},
  author={Liu, Diyi and Guin, Angshuman},
  year={2022}
}

Two different kinds of carpooling

Between two travelers, there are two possible schemes of direct carpool

A screenshot of direct carpool plans

Between two travelers, given a middle point to meet, there are two possible schemes of carpooling (i.e., Park-and-Ride Carpool)

A screenshot of park and ride carpool

The required data classes for modeling traffic network is listed as follows

Three datasets or shapefiles are necessary to represent a traffic network:

  • TrafficNetworkNode
  • TrafficNetworkLink
  • TrafficAnalysisZone
classDiagram
    TrafficNetworkNode: +int nid
    TrafficNetworkNode: +float lon
    TrafficNetworkNode: +float lat
    TrafficNetworkNode: +float x
    TrafficNetworkNode: +float y
    TrafficNetworkNode: +Point geometry
    
    TrafficNetworkLink: +int a
    TrafficNetworkLink: +int b
    TrafficNetworkLink: +str a_b
    TrafficNetworkLink: +str name
    TrafficNetworkLink: +float distance
    TrafficNetworkLink: +float factype
    TrafficNetworkLink: +float speed_limit
    TrafficNetworkLink: +LineString geometry
    
    TrafficAnalysisZone: +int taz_id
    TrafficAnalysisZone: +str group_id
    TrafficAnalysisZone: +Polygon geometry

Another dataset is necessary to define the travel demands by providing the following minimal required set of information.

classDiagram
    TripDemand: +int trip_id
    TripDemand: +float orig_lon
    TripDemand: +float orig_lat
    TripDemand: +float dest_lon
    TripDemand: +float dest_lat
    TripDemand: +float new_min
    TripDemand: +Point geometry

The geometry field of "TripDemand" corresponds to the origin of the trip. Finally, some parking lots can be identified and represented to consider park and ride carpool.

classDiagram
    ParkAndRideStation: +int station_id
    ParkAndRideStation: +str name
    ParkAndRideStation: +float lon
    ParkAndRideStation: +float lat
    ParkAndRideStation: +int capacity
    ParkAndRideStation: +Point geometry

By default, all geometry fields are using "EPSG:4326" (WGS84) projection as inputs.

The structure of the project is shown as follows.

.
├── carpoolsim  # contains Python code (called by Jupyter Notebooks)
│   ├── basic_settings.py  # IMPORTANT: set up basic information of the project (modify based on your need)
│   ├── carpool  # the core pipeline of running the carpool "simulation"
│   │   ├── __init__.py
│   │   ├── trip_cluster.py
│   │   └── trip_cluster_with_time.py
│   ├── carpool_solver   # the core algorithm (i.e., bipartite) to solve the problem
│   │   ├── __init__.py
│   │   └── bipartite_solver.py
│   ├── database  # code to prepare and interact with the database (e.g., SQLite)
│   │   ├── __init__.py
│   │   ├── prepare_database.py
│   │   └── query_database.py
│   ├── dataclass  # an interface of all data objects to standardize input data
│   │   ├── __init__.py
│   │   ├── parking_lots.py
│   │   ├── traffic_network.py
│   │   └── travel_demands.py
│   ├── network_prepare.py
│   ├── prepare_input.py
│   └── visualization  # visualization tool for plotting results
│       ├── __init__.py
│       ├── carpool_viz.py
│       └── carpool_viz_seq.py
├── data_inputs  # all input data (example of the notebooks)
│   ├── ABM2020 203K
│   │   ├── 2020 links  # traffic network link file
│   │   ├── 2020 nodes with latlon  # traffic network node file
│   │   └── taz  # traffic analysis zone
│   ├── Park_and_Ride_locations  # a shapefile/csv of parking lots
│   ├── gt_survey  # trip demands (survey data in this case)
│   └── cleaned  # cleaned dataset (for all intermediate results before runnig simulation)
├── data_outputs  # store the outputs (and intermediate results)
└── notebooks # all Jupyter notebooks to run the program

You can move those files to "data_inputs" folder. The files within the "data_inputs" folder are just an example of our own project. You can set up any folder structure, but remember to reset the paths parameters in basic_settings.py.

Require inputs

  1. Three network files:
    1. traffic networks shapefile: a shapefile of traffic links
    2. traffic nodes shapefile: a shapefile of traffic nodes
    3. taz: traffic analysis zone that splits a metropolitan region to many small parts
  2. One file for PNR stations of Park-and-ride mode:
    1. Park_and_Ride_locations: Parking lots that can be used for Park and Ride trip
  3. One file for traffic demand:
    1. gt_survey: a survey of trip demands providing origin, destination, depart time, etc.

Use notebooks to run the analysis pipeline

Four Jupyter notebooks are provided to run the package. Users are obligated to modify those notebooks to align with their own analysis purpose. The code talks by itself in those notebooks.

  • step0_prepare_data_inputs.ipynb
  • step1_prepare_path_retention_database.ipynb
  • step2_prepare_traffic_demands.ipynb
  • step3_run_carpoolsim.ipynb

Configure the quality of carpools

The tool provides a rich set of parameters as a filtering "safe net" of the tool.

kwargs = {
    # use bipartite method. If not, may try to use linear optimization
    'rt_bipartite': True,
    # setup print options
    'verbose': False, 'print_mat': False, 'plot_all': True,
    # coordinate filters
    'mu1': 1.5, 'mu2': 0.1, 'dst_max': 5*5280,
    # reroute filters
    'delta': 10, 'gamma': 1.3, 'ita': 0.9, 'ita_pnr': 0.5,  # reroute filters
    # Delta1: control passenger/driver's departure time difference
    # Delta2: control driver's maximum waiting time
    'Delta1': 15, 'Delta2': 10, 'Gamma': 0.2,
    # carpool mode 
    #   0: direct carpool only;
    #   1: pnr carpool only; 
    #   2: both at the same time
    'mode':0
}

A slightly more detailed explaination is given as follows:

A table describing the meaning of each parameter in the tool

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

carpoolsim-0.2.0.tar.gz (41.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

carpoolsim-0.2.0-py3-none-any.whl (53.2 kB view details)

Uploaded Python 3

File details

Details for the file carpoolsim-0.2.0.tar.gz.

File metadata

  • Download URL: carpoolsim-0.2.0.tar.gz
  • Upload date:
  • Size: 41.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.7 Darwin/24.5.0

File hashes

Hashes for carpoolsim-0.2.0.tar.gz
Algorithm Hash digest
SHA256 254b1334ba535a22104889ae44ab63f2a547310050bbd4ee92f41dc60a294b94
MD5 8f79de0c442c8d4abc32524cc8b8f545
BLAKE2b-256 30e5126b95a95ad117a53b1607643ba4877f7c247faff6da60c4d1545769191d

See more details on using hashes here.

File details

Details for the file carpoolsim-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: carpoolsim-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 53.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.7 Darwin/24.5.0

File hashes

Hashes for carpoolsim-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 688d5a6e3bb16ae9b23306c430cf5d6dca6c96f9a84b63770bb908fcc101f976
MD5 49fc1fb5b99b5b0d49e0b5d886587915
BLAKE2b-256 5acfe4b84bbb5030c4eb3ed9f916fb199396c221ca52b95f4f9b87f482dd5287

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page