VROOM-Project / vroom

Vehicle Routing Open-source Optimization Machine
http://vroom-project.org/
BSD 2-Clause "Simplified" License
1.27k stars 328 forks source link

Add penalties to duration #347

Closed johnjinwoua closed 4 years ago

johnjinwoua commented 4 years ago

Hello,

I am working on a project in which I'd like to include live time traffic in the route and job calculation.

How is it possible to do this in Vroom ?

An alternative way of doing this is to add a weighting coefficient to the output of the routing calculator (ors) depending on the traffic status on the route.

Does anyone have an advice ?

Thanks

jcoupey commented 4 years ago

If you mean using travel costs that change across the day depending on start time after a given job, then it's not currently possible to do that.

The reason is that it would require to change significantly the current approach. For example in order to evaluate the potential gain when moving a job from one route to another, we're currently able to do this in constant time because it only affects the surrounding edges in both routes. As soon as you have time-dependent travel times, then removing/adding a job at some point would have an impact for all arrival times down the line, and would require to recompute all travel times, adding one level of algorithmic complexity for simple operations.

An alternative way of doing this is to add a weighting coefficient to the output of the routing calculator (ors) depending on the traffic status on the route.

Do you mean applying a single weighting coefficient to the whole matrix retrieved using the routing engine?

johnjinwoua commented 4 years ago

Do you mean applying a single weighting coefficient to the whole matrix retrieved using the routing engine?

For example : if the duration calculated by ORS from A to B is 10 minutes (without live traffic information) and I know that due to rush hour, the trip will last 3 extra minutes (+30%). Is there a way to specify that either in ORS or in Vroom ? Because I saw that vroom uses the output matrix from ORS to do compute the sequencing... So if we can specify that on the output of ORS before feeding it to Vroom's input, I think the problem will be solved.

jcoupey commented 4 years ago

OK, so this is would only be time-dependant in the sense that at the time you fire the request, you use a specific scaling factor for durations?

In that case, you'd still have a static view of durations within each request, and the same factor applies to all durations in the matrix?

johnjinwoua commented 4 years ago

OK, so this is would only be time-dependant in the sense that at the time you fire the request, you use a specific scaling factor for durations?

for example yes !

In that case, you'd still have a static view of durations within each request, and the same factor applies to all durations in the matrix?

Not to all the durations in the matrix... Just for the routes we have some extra informations on the traffic status.

If I succeed to modify the output of ORS before feeding VROOM, it might work ?

nilsnolde commented 4 years ago

He wants to consider live traffic while routing. Actually nothing to do with vroom. See here, same question: https://ask.openrouteservice.org/t/live-time-traffic/1756

Like I said @johnjinwoua, OSRM can do it and it works with vroom out-of-the-box. Exactly how to implement that in OSRM is rather a question for that repository. If you want a static scaling depending on the time of the day and you don't care that live traffic doesn't influence the routing, then I'd just fire a Matrix request to ORS, scale the response and then a custom matrix to vroom. Will work

johnjinwoua commented 4 years ago

I'd just fire a Matrix request to ORS, scale the response and then a custom matrix to vroom.

This is exactly what I am saying. Each time that I fire a request to ORS, I can scale the output before feeding vroom with. But How can I do that in the source code ?

Thanks

nilsnolde commented 4 years ago

ORS source code? You'd do that in the app that's requesting ORS and vroom, a whole lot easier.

johnjinwoua commented 4 years ago

The request in Vroom (I am using Docker) sends automatically a request to ORS. How can I scale the output of the matrix provided by ORS as it is send directly to vroom ?

jcoupey commented 4 years ago

@johnjinwoua if you want to make your own custom adjustments to the matrix, then you can:

  1. perform the ORS request yourself
  2. scale the resulting matrix
  3. add the modified matrix as input for vroom

For that last step, see the documentation on using custom matrices.

nilsnolde commented 4 years ago

If you used the default docker-compose ORS is exposed on localhost:8080 and accepts matrix requests at localhost:8080/ors/v2/matrix/<profile>: https://openrouteservice.org/dev/#/api-docs/v2/matrix/{profile}/post

johnjinwoua commented 4 years ago

Thanks, I'll try it out and come back to you guys.

Closing for now.