Tool for placing bicycle sharing stations by iteratively minimizing a global energy of a model that reflects the station-based bicycle sharing system. 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. Initially forked from munterfi/drtplanr.
The model in the package example optimizes the positions of stations in an assumed bicycle sharing service for the municipality Bülach in Zurich, Switzerland.
![]() |
![]() |
---|
Install the development version from GitHub with:
remotes::install_github("munterfi/sbplanr")
Create an example model:
# Example data
aoi <-
sf::st_read(system.file("example.gpkg", package = "sbplanr"), layer = "aoi")
pop <-
sf::st_read(system.file("example.gpkg", package = "sbplanr"), layer = "pop")
poi <-
sf::st_read(system.file("example.gpkg", package = "sbplanr"), layer = "poi")[1,]
# Create model
m <- sb_sbm(
model_name = "Buelach",
aoi = aoi, pop = pop, poi = poi,
n_sta = 15, m_seg = 100
)
# Iterate the model
m <- sb_iterate(m, 100)
# Visualize results
sb_plot(m)
sb_map(m)
The model is set up with the following inputs:
- Spatial layer:
- Area of Interest (POLYGON).
- Population raster centroids (POINT).
- Point(s) of Interest (POINT).
- Parameters:
- A model name.
- Distance in meters to segment the street network for candidate creation: default = 100m (The value is equivalent to the minimum possible distance between two stations on the street network).
- Number of stations to place.
Function that calculates the global energy of the current model state. The aim is to place the station in a way, that the residents and workers around them have to walk as short as possible to the station and that the station is connected as well as possible to other attractive stations in the network. An attractive station is a station with many people in the catchment area that can be quickly reached by bicycle.
When the direct walking time between to populations is faster than the travel using the bicycle (walk to station, cycle, walk from station), than the direct walking travel is chosen.
The global energy of the model is optimized in iterations. In every iteration one station is randomly selected and moved to another position on the segmented street network. The global energy of the model state with the new candidate is calculated. If the global energy is lower as befor, the candidate is accepted and the next iteration starts. If the global energy is higher, the candidate is rejected with the probability
The concept of sometimes allowing a bad candidate to be accepted is known as annealing. This technique prevents the optimization from being captured in a local minimum before the global minimum is reached.
- Merlin Unterfinger (inital idea, package implementation) - munterfi
- Thomas Hettinger (energy definition) - thetti
- David Masson (ideas and feedback on model optimization, annealing) - panhypersebastos
- Initially forked from munterfi/drtplanr
- hereR: R interface to the HERE REST APIs
- BfS: Population data for Switzerland
- OSM: Street network data for routing purposes.
- This repository is licensed under the GNU General Public License v3.0 - see the LICENSE.md file for details.