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

Is possible to route based on a shortest path but by prioritizing which points to pass first? #692

Open
GabrieleT0 opened this issue Jul 2, 2023 · 1 comment
Labels

Comments

@GabrieleT0
Copy link

Hi there,
I'm currently working on a small university project, I'm building a system for garbage collection where the bin are placed as pins on the map. I want to calculate the route that pass between these bins, but by prioritizing those that are full.
Thank you for your help in advice.

@curtisy1
Copy link
Collaborator

curtisy1 commented Jul 2, 2023

Hey there!

The question is, how much of the data you actually have and how efficient does the route have to be? If you have the coordinates of the bins and information on how full they are, you might be able to do a very naive optimization at first:

const waypoints = bins.sort(b => b.fullness).map(b => b.coordinate);

if you pass this into LRM via setWaypoints(), you should get a route where the fullest bin will be the first stop on your route.

However, that might not always be the most efficient solution, since your starting point might be in the south while the fullest bin is far north. In this case, it would be better to empty all the bins along the way. That is similar to a VRP (vehicle routing problem) with one or possibly more constraints, something that a few providers like Valhalla can probably solve for you. After you have your optimized route though, it should be as simple as feeding the waypoints into LRM.

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

No branches or pull requests

2 participants