Giter Site home page Giter Site logo

munterfi / drtplanr Goto Github PK

View Code? Open in Web Editor NEW
5.0 4.0 0.0 19.1 MB

Tool for planning and optimizing virtual stations in demand-responsive transport systems by defining and minimizing a global energy.

Home Page: https://munterfi.github.io/drtplanr/

License: GNU General Public License v3.0

R 88.86% Shell 11.14%
demand-responsive-transport on-demand optimization-algorithms transport-planning virtual-stations shuttle-bus

drtplanr's Introduction

Demand-responsive transport planner

Lifecycle: experimental R build status pkgdown Codecov test coverage

Tool for placing virtual stations in demand-responsive transport systems in villages by defining and minimizing a global energy (drtplanr, name is inspired by stplanr). The station locations are randomly initialized in the street network and iteratively optimized based on the reachable population in combination with walking and driving times.

The model in the package example optimizes the positions of virtual stations in an assumed on-demand shuttle service for the community of Jegenstorf in Bern, Switzerland.

Getting started

Install the development version from GitHub with:

remotes::install_github("munterfi/drtplanr")

Load example data

Load the package example data sets of a village in Switzerland:

  • aoi: Area of Interest - 3 min driving time isochrone around the station of Jegenstorf, Bern.
  • pop: Centroids of population and structural business hectare grid statistis, where the variable 'n' is the sum of full-time equivalence jobs and residents per hectare (BfS).
aoi <-
  sf::st_read(system.file("example.gpkg", package="drtplanr"), layer = "aoi")

pop <-
  sf::st_read(system.file("example.gpkg", package="drtplanr"), layer = "pop")

To create the datasets for a different region in Switzerland use the create.sh and adjust the geocoded address:

./create.sh -k <YOUR HERE API KEY>

Note: A HERE API key is required and has to be passed as with the option -k.

Run a model

Create a new demand reponsive transport model for the aoi 'Jegenstorf', with 10 randomly initialized virtual on-demand stations.

m <- drt_drtm(
  model_name = "Jegenstorf",  # Name of the drtm (used when exporting the model)
  aoi = aoi,                  # Area of interest (sf with geometry type POLYGON)
  pop = pop,                  # Population layer (sf with geometry type POINT)
  n_vir = 15,                 # Number of virtual stations to place (numeric)
  m_seg = 100                 # Resolution of the segments on the street network
)

Iterate the model 100 times, where every iteration consists of:

  1. Relocate a virtual station randomly on the road segments.
  2. Calculate the new global energy of the model using the routing graphs.
  3. If the energy is lower than previuos iteration: Keep the new location of the virtual station; otherwise: Reset to the previous location.
m1 <- drt_iterate(m, 100)

Visualize results

Plot the energy optimization curve and the station map of the model:

drt_plot(m)                 # Energy plot showing progress of iterations
drt_map(m)                  # Map with the inital and final station locations

Authors

  • Merlin Unterfinger - munterfi
  • Oliver Hofer (ideas and feedback) - nebucaz

References

  • hereR: R interface to the HERE REST APIs
  • BfS: Population data for Switzerland
  • OSM: Street network data for routing purposes.

Licence

  • This repository is licensed under the GNU General Public License v3.0 - see the LICENSE.md file for details.

drtplanr's People

Contributors

munterfi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.