I basically want to create a rule that helps me solve VRP in a certain way (I'm optimizing for distance):
I want it to have Time Windows, these rules work OK:
// TIME WINDOW &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
rule "arrivalAfterDueTime"
salience -1
when
$customer: TimeWindowedCustomer(dueTime < arrivalTime,
$dueTime : dueTime,
$arrivalTime : arrivalTime)
then
scoreHolder.addHardConstraintMatch(kcontext,
(int)(10*($dueTime - $arrivalTime.intValue())) );
end
// ******************
rule "Delivery in time window"
salience -2
when
$customer:TimeWindowedCustomer(nextCustomer != null,
$arrivalTimeCustomer: arrivalTime)
$actual: TimeWindowedCustomer( previousStandstill == $customer,
$arrivalTimeCustomer>arrivalTime,
$arrival:arrivalTime )
then
scoreHolder.addHardConstraintMatch(kcontext,
(int)(10*($arrival-$arrivalTimeCustomer)) );
end
But I want the vehicles to choose to deliver on more than one option of a day. Example: Time window is 8:00 am to 2:00 pm Monday through Thursday, so if a solution comes up that delivers on 3:00 pm on Monday, I want to have the rule consider Tuesday at 8:00 am instead if it's a better choice, and switch route order accordingly between days and vehicles without going off the time windows, but still making sequenced deliveries efficient (let OP 'choose' the best way to deliver while optimizing distance).
I hope I explained myself well, I don't know if the question is addressed correctly, if not please let me know so I can fix it.
Thank you very much!