-
Notifications
You must be signed in to change notification settings - Fork 125
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
OSM Doc + route length minor improvements #629
Conversation
Datseris
commented
Jun 5, 2022
•
edited
Loading
edited
- Small improvements to docstrings in OSM
- Closes [FR] Obtain total route length in OSM #628 (Currently WIP + needs tests)
- Updates to LightOSM 0.2
- Closes CompatHelper: bump compat for LightOSM to 0.2, (keep existing compat) #631
Codecov Report
@@ Coverage Diff @@
## master #629 +/- ##
==========================================
- Coverage 91.04% 90.55% -0.50%
==========================================
Files 24 24
Lines 1631 1641 +10
==========================================
+ Hits 1485 1486 +1
- Misses 146 155 +9
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
@AayushSabharwal its obviously wrong the way I've coded len = sum(LightOSM.weights_from_path(
model.space.map,
reverse([model.space.map.index_to_node[i] for i in model.space.routes[1].route]),
)) We need to better document the struct |
Sorry for the delay, I've been really busy
Sure. Each node has a node ID from the OpenStreetMap. The map is stored as a
|
No worries, open source = very low response rate is acceptable!
OOF, is there a reason these two things aren't the same thing? I don't see a reason, given that both are the integers from 1 to the total number of nodes...
Okay, but why do we do that this way, instead of storing them in the order they are visited and using EDIT: Also, to clarify: the source code comment said that the field stores the indices from start to destianation, which is not reverse order. So, to be sure, what is the order that the indices are currently stored in the struct? The one you told me here, or the one that was in the original comment in the source code (which said from start to destination)? I'll utilize the docstring of |
Aaaaah the "OpenStreetMap ID" is like the global ID for the whole globe I guess, which is why the vertex node index is different. |
Yeah. They're defined by OpenStreetMap, and are same for the same node in two different maps. The vertex node index varies.
What I've said here. I think why I wrote it that way in the comment is because the path is calculated from |
In this PR let's also try to update LightOSM to 0.2, https://github.com/DeloitteDigitalAPAC/LightOSM.jl/releases/tag/v0.2.0 . At the moment I'm busy with another project at DynamicalSystems.jl, but i'll try to get around doing this here when possible. Feel free to add commits here if you have time, but no stress.
Where did you find this information? |
I think the statement is generally correct from a theoretical viewpoint on operation complexity because of the required memory movement when using popfirst. But I'm not so sure if using it is really slower because it is likely a highly optimised operation by the compiler. I was intrigued to try this out and quick (admittedly crude) tests confirmed @AayushSabharwal 's approach to be the faster one: # small array
julia> @btime (a = collect(1:100); for _ in 1:100; popfirst!(a); end)
563.196 ns (1 allocation: 896 bytes)
julia> @btime (a = collect(1:100); reverse!(a); for _ in 1:100; pop!(a); end)
416.166 ns (1 allocation: 896 bytes)
# bigger array
julia> @btime (a = collect(1:1_000_000); for _ in 1:1_000_000; popfirst!(a); end)
6.016 ms (2 allocations: 7.63 MiB)
julia> @btime (a = collect(1:1_000_000); reverse!(a); for _ in 1:1_000_000; pop!(a); end)
4.987 ms (2 allocations: 7.63 MiB) |
This fixes the TODO we had with Also, LightOSM also exports |
thanks a lot for the help. now we just have to finish the docs and ensure tests are passable. |
@AayushSabharwal that is odd, it seems like that all failing tests are about the pathfinding (like, our own Astar, not the OSM stuff) |
The issues:
|
haha sorry you had to fix my tests breakages! I wanted to redesign the tests to follow more #634 , but then I got busy for a deadline for Thursday!!! I'll have a look at the documentation failing test and then merge! |
I'm happy to have helped :) |
Note to self: still needs test for the new function |
So docs fail because interactive dynamics needs to be updated to latest Makie 0.17, which I hope to do this sunday... |
(Tests pass, they were passing before, and I just added another passing one. We haven't merged so far because docs weren't building because of some missmatch in versions) |