问题
I am working on a VRPTW problem where vehicles have availablity constraints. This means that they might not be available the entire period of a day - basically a time windows for vehicles. Is there a way to build this in optaplanner?
Thank you and Brgds, Paul
回答1:
This following should work:
- add 2 fields (start and end) on
(TimeWindowed)Vehicle
- in
ArrivalTimeUpdatingVariableListener
use at least the vehicle's start time before it leaves a depot - add a hard constraint that the vehicle should be back at the depot by it's end time. Make sure to penalize not just -1, but instead, minus the amount of time it's overdue (to avoid a score trap, see docs).
来源:https://stackoverflow.com/questions/21307115/optaplanner-availability-of-vehicles