1

I am using the TimeWindowed version of the vehicle routing and I added to the vehicle an endOfShift time. I want to calculate the time of return to depot and make it hard constraint. The returnToDepotTime is calculate in the ArrivalTimeUpdatingVariableListener, and I also changed the drl file I added

rule "returnToDepotBeforeEndOfShift"
when
    Vehicle(endOfShift < returnToDepotTime, $endOfShift : endOfShift, $returnToDepotTime : returnToDepotTime)
then
    scoreHolder.addHardConstraintMatch(kcontext, $endOfShift - $returnToDepotTime.intValue());  end

The problem is that OptaPlanner does not take returnToDepotTime into consideration and it is calculated but not taken by the hard constrains calculation. Any idea what to change?

4

2 に答える 2

0

ArrivalTimeUpdatingVariableListener を調整して、 where isのも調整Vehicleします。returnHomeTimeCustomergetNextCustomer()null

が変更されたことが適切に通知された場合scoreDirector(before/afterVarChanged メソッド) 、ルールはそれに応じて更新されます。VehiclereturnHomeTime

于 2014-10-31T16:14:25.993 に答える