reinterpretcat / vrp

A Vehicle Routing Problem solver
https://reinterpretcat.github.io/vrp/
Apache License 2.0
331 stars 68 forks source link

Units of distance and duration #62

Closed iedmrc closed 11 months ago

iedmrc commented 2 years ago

Hi, what's the default (expected) unit for distance and duration across all the project? For example, in costs, what's the unit for distance? Is it in meters, kilometers, feet etc..?

costs (required): specifies how expensive is vehicle usage. It has three properties:

fixed: a fixed cost per vehicle tour
time: a cost per time unit
distance: a cost per distance unit
reinterpretcat commented 2 years ago

Hi,

it depends.

The solver itself doesn't assume any specific units when routing matrix is used: it should be just consistent. So, if you have meters and seconds in the routing matrix, then costs should be specified per second and meter.

If no matrix supplied, then the solver uses some approximation algorithm to calculate distance and duration between any two locations and it assumes that costs are defined using standard distance and time units: meters and seconds.

iedmrc commented 2 years ago

I needed that part

If no matrix supplied, then the solver uses some approximation algorithm to calculate distance and duration between any two locations and it assumes that costs are defined using standard distance and time units: meters and seconds.

Thank you for answer! But I've one more question, how does it check time windows and shifts when I provide a custom route matrix without any unit specified?

reinterpretcat commented 2 years ago

I've rechecked implementation and actually, seconds are assumed by default:

https://github.com/reinterpretcat/vrp/blob/master/vrp-pragmatic/src/lib.rs#L58

So, I need to update documentation