osm-router / osmprob

R package for probabilistic routing
https://osm-router.github.io/osmprob/
Other
7 stars 1 forks source link

impelement test for ill-formed networks #30

Open mpadge opened 7 years ago

mpadge commented 7 years ago

plus adress the possibly separate issue of finding out why some distances give huge (integer) values

karpfen commented 7 years ago

Just as a thought on that: I tried a few things today and stumbled on this:

devtools::load_all (export_all = FALSE)
start_pt <- c (10.5350035429,47.6034937672)
end_pt <- c (10.5384796858,47.6071612749)
graph <- download_graph (start_pt, end_pt)
pts <- select_vertices_by_coordinates (graph, start_pt, end_pt)
route_start <- pts[1]
route_end <- pts [2]

prob <- get_probability (graph, route_start, route_end, eta = 0.1)
prob$d # 0.3704895

prob <- get_probability (graph, route_start, route_end, eta = 0.0001)
prob$d # 6.148642

sum (prob$probability$d) # 4.128129

If you set eta really low, the estimated mean length is longer than the sum of all edges present in the graph. Does this mean that they can potentially be counted more than once? If so, maybe that is the cause for those cases where d is so high.

mpadge commented 7 years ago

That's a great thought. Check this out

start_pt <- c (10.5350035429,47.6034937672)
end_pt <- c (10.5384796858,47.6071612749)
graph <- download_graph (start_pt, end_pt)
pts <- select_vertices_by_coordinates (graph, start_pt, end_pt)
route_start <- pts[1]
route_end <- pts [2]

eta <- 10 ^ (-40:15 / 10)
d <- sapply (eta, function (i) get_probability (graph, route_start, route_end,
                                                eta = i)$d)
plot (eta, d, "l", log = 'xy')

junk

It's fine that values exceed the total sum of absolute distances, because random paths can include (potentially infinite) loops and circles. Even then, the end points of this graph seem perfectly sensible.

Only problem is the graphs that give extreme values do decrease with increasing eta, but nowhere near enough. And then my routing code crashes before they drop down to sensible levels, so i still have to investigate further. But feel free to ignore all of this (as well as the new #31) until after you're done writing.

karpfen commented 7 years ago

Alright, that makes sense then!