I'm trying to implement a peculiar constraint with jsprit: a conditional time window. Some jobs can only be done by certain types of vehicles at certain times. The use case comes from some cities which allow light vehicles during the whole day but only allow heavy trucks at night, and many variations of this rule.
So for mixed fleets, we have to check the type of vehicle to know if the time window must be applied or not.
Sadly this is not a simple hard route constraint, since it has impacts on the insertion algorithm itself - the hard constraint itself prevents forbidden solutions, but it cannot say "and please retry at this time". Exactly as time windows in base jsprit are a combination of an insertion algorithm and a hard constraint.
So if I understand jsprit correctly, we need to modify the ServiceInsertionCalculator
(and its brother ShipmentInsertionCalculator
) to force it to consider the optional time slots (and basically add them to the time slots considered by the default time window constraint).
But I cannot see how to inject my own insertion calculator. Is it an extension point? is there an easy way to do what I want without this? Worst case, do I have to fork the library?
Thanks!