Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set suboptimal minutes to 0 when shortest_path = TRUE in detailed_itineraries #153

Closed
mvpsaraiva opened this issue Feb 25, 2021 · 2 comments
Assignees

Comments

@mvpsaraiva
Copy link
Collaborator

R5's PointToPointQuery has a suboptimalMinutes parameter that allows it to generate additional path options, that are used by r5r's detailed_itineraries. That parameter is not necessary when the user requests only the shortest path, so it can be set to 0 to speed up the process.

@mvpsaraiva mvpsaraiva self-assigned this Feb 25, 2021
mvpsaraiva added a commit that referenced this issue Feb 25, 2021
…ries when shortest_path = TRUE. This significantly increases the function's performance. Closes issue #153.
@mvpsaraiva
Copy link
Collaborator Author

Done in 778343a
A simple test using the Porto Alegre sample data showed a query that took 2 seconds now takes 0.25 seconds when shortest_path = TRUE.

@rafapereirabr
Copy link
Member

This is great. Thanks, Marcus. I also ran a quick test routing from 1 origin to 800 destinations (reprex below), and computation time dropped from 92 to 21 seconds.

reprex

utils::remove.packages('r5r')
devtools::install_github("ipeaGIT/r5r", subdir = "r-package")
library(r5r)


# build transport network
data_path <- system.file("extdata/poa", package = "r5r")
r5r_core <- setup_r5(data_path = data_path)

# load origin/destination points
orig <- read.csv(file.path(data_path, "poa_points_of_interest.csv"))
orig <- orig[1,]
points <- read.csv(file.path(data_path, "poa_hexgrid.csv"))
points <- points[1:800,]

# inputs
departure_datetime <- as.POSIXct("13-05-2019 14:00:00", format = "%d-%m-%Y %H:%M:%S")

system.time(dit <- detailed_itineraries(r5r_core,
                            origins = orig,
                            destinations = points,
                            mode = c("WALK", "TRANSIT"),
                            departure_datetime = departure_datetime,
                            max_walk_dist = 1000,
                            max_trip_duration = 120L))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants