vrp
vrp copied to clipboard
Make capacity/demand optional to support non-capacitated VRP variants
It seems reasonable to have demand/capacity optional. At the moment, there is no validation rule to check empty capacity, so the solver fails in fleet_reader.rs
I'd like to tackle this issue, but to be honest, I'm not sure how to solve it. Can we discuss the solution?
My initial motivation of the ticket was to avoid adding capacity constraint into constrain pipeline when no demand/capacity is needed. At the moment, it is added all the time and some logic is triggered all the time. I would say implementing the enhancement would require some refactoring inside and outside, but benefits, probably, not so high. So, I'm not sure that it still makes sense to do. When implemented, it might block some problem definitions returning validation error, while simply working in current implementation.
List of possible changes:
- add logic to skip capacity constraint for non-capacitated VRP use case
capacityproperty on vehicle type should be changed to optional. Empty vector is not good for API design- add extra validation rules, e.g. only service type job should be allowed when no capacity specified on all vehicle types
- properly handle use case for mixed fleet: vehicles with capacity constraint and not
- ..?
Good starting point is to comment this line and then pass problem with no demand specified and empty capacity: https://github.com/reinterpretcat/vrp/blob/master/vrp-pragmatic/src/format/problem/reader.rs#L273