reinterpretcat / vrp

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

Why cannot set time and duration costs to zeros? #139

Open ilibar-zpt opened 7 months ago

ilibar-zpt commented 7 months ago

Is it just a default assumption or is there a computational problem? How does one model a problem where only fixed cost matters?

reinterpretcat commented 7 months ago

Initially, cost minimization objective was required to be present and setting costs to zero would lead that serving any location will be considered as having the same cost. Later I've added distance/duration objectives, so this requirement can be seen as deprecated. This could be done, I guess, just some validation rules have to be adapted

ilibar-zpt commented 7 months ago

@reinterpretcat would that be sufficient (aside from doc/cleanup)? I'm willing to look into it

diff --git a/vrp-pragmatic/src/validation/vehicles.rs b/vrp-pragmatic/src/validation/vehicles.rs
index cb561e39..61699b11 100644
--- a/vrp-pragmatic/src/validation/vehicles.rs
+++ b/vrp-pragmatic/src/validation/vehicles.rs
@@ -344,7 +344,7 @@ pub fn validate_vehicles(ctx: &ValidationContext) -> Result<(), MultiFormatError
         check_e1303_vehicle_breaks_time_is_correct(ctx),
         check_e1304_vehicle_reload_time_is_correct(ctx),
         check_e1305_vehicle_dispatch_is_correct(ctx),
-        check_e1306_vehicle_has_no_zero_costs(ctx),
+        // check_e1306_vehicle_has_no_zero_costs(ctx),
         check_e1307_vehicle_required_break_rescheduling(ctx),
         check_e1308_vehicle_reload_resources(ctx),
     ])
reinterpretcat commented 7 months ago

It should be sufficient to make it work, but for bringing it to master branch more steps are needed:

As workaround, you can simply specify a very small costs (0.0000000...001) for distance and duration.