Time window constraints not respected

Hi,

I am using a custom cost matrix along with time windows. The travel time from activity A to activity B takes 2670733.642578125 units. The endTime for activity A is 1480497535364. The endTime for activity B is 1480500392000. The operation time for activity B is 300000. The difference between the start time of B and end time of A comes to 2556636.

The constraints used are the default time windows constraints.
ConstraintManager constraintManager = new ConstraintManager(vrp, stateManager); constraintManager.addLoadConstraint();
constraintManager.addTimeWindowConstraint();

I am under the impression that time windows are implemented as a hard constraint and I shouldn’t be getting such a solution.

Thanks,
Nishant.

Why is this related to time window constraints? Is there a time window on activity B? With an earliest start time as 1480500092000? If so, what is the arrival time at activity B?

Maybe there are problems with your big numbers. Maybe you can scale them to lower ones. 1480497535364 is over a Int32 size. In case jsprit uses Float, the range is even smaller.

The time windows are as follows:
activity A:
start:1480444200000,
end:1480530600000

activity B:
start:1480444200000,
end:1480530600000

The problem is that even though the time windows are respected, the theoretical time taken getting from A to B is larger than the time allotted to get from A to B. This also seems to be handled by the same hard constraint com.graphhopper.jsprit.core.problem.constraint.VehicleDependentTimeWindowConstraints

doubles seem to be used for the code that I am looking at.

so the arrival time of activity B is 1480500092000?

hmm, could you check the value of the following?

vrp.getTransportCosts().getTransportTime(actA.getLocation(), actB.getLocation(), 0, null, null)

Since you are using a cost matrix, I suppose departure time, driver and vehicle would not matter.

It turns out that a symmetric costmatrix is being maintained by jsprit - specifying two costs A->B and then B->A sets A->B as B->A as well. I will investigate further in this direction.

Thanks for the help @jie31best

I was passing isSymmetric as true to the costmatrixbuilder - my fault.

Thanks.

1 Like