Strict Time Window constraint - update solution?

Hello,

I’m implementing a strict time window which means that each activity inserted on the route must finish servicing before the end of the time windows date. Otherwise, the departure time from the current activity must be less or equal to the LatestOperationStartTime.

Down is my code :
`@Override
public ConstraintsStatus fulfilled(JobInsertionContext iFacts, TourActivity prevAct, TourActivity newAct, TourActivity nextAct, double prevActDepTime) {
double newActArrivalTime = prevActDepTime + getTravelTime(prevAct, newAct);
double newActStartTime, newActDepartureTime;
double nextActArrivalTime;
double nextActStartTime;
if (newActArrivalTime < newAct.getTheoreticalEarliestOperationStartTime()) {
newActStartTime = newAct.getTheoreticalEarliestOperationStartTime();
} else {
if (newActArrivalTime >= newAct.getTheoreticalEarliestOperationStartTime() && newActArrivalTime <= newAct.getTheoreticalLatestOperationStartTime()) {
newActStartTime = newActArrivalTime;
} else {
return ConstraintsStatus.NOT_FULFILLED;
}
}
newActDepartureTime = newActStartTime + newAct.getOperationTime();
if (newActDepartureTime <= newAct.getTheoreticalLatestOperationStartTime()) {
nextActArrivalTime = newActDepartureTime + getTravelTime(newAct, nextAct);
if (nextActArrivalTime <= nextAct.getTheoreticalEarliestOperationStartTime()) {
nextActStartTime = nextAct.getTheoreticalEarliestOperationStartTime();
} else {
if (nextActArrivalTime > nextAct.getTheoreticalEarliestOperationStartTime() && nextActArrivalTime <= nextAct.getTheoreticalLatestOperationStartTime()) {
nextActStartTime = nextActArrivalTime;
} else {
return ConstraintsStatus.NOT_FULFILLED;
}

            }
            if (nextActStartTime + nextAct.getOperationTime() > nextAct.getTheoreticalLatestOperationStartTime()) {
                return ConstraintsStatus.NOT_FULFILLED;
            } else {

                return ConstraintsStatus.FULFILLED;
            }

        } else {
            return ConstraintsStatus.NOT_FULFILLED;
        }
        
    }`

Results provided by the constraint are not correct and it’s violated on benchmarks that I used for testing. I didn’t implement any updateclass as i have a problem to make it. I used UpdateVehicleDependentPracticalTimeWindows but results still not correct.

Any idea how to do it? Thank you!

Hi,

You should have a look to this commit :

which is on the branch jsprit-mv.
It was a proposition from @stefan to set a strict definition of time windows.