Calculation of ready/due data

I’m trying to calculate some routes, but it seems as if the calculation does not take the ready/due data into account in the calculation. Is there a reason this data is neglected? I added the ready/due data as explained in docs, as ints and passed through [‘restrictions’][‘ready’] & [‘restrictions’][‘due’]

Route 1
I have 4 addresses:
address 1 is set to visit anywhere between 09:00 and 17:00
address 2 is set to visit BEFORE 12:00
address 3 is set to visit AFTER 12:00
address 4 (same as start address) is set to visit anywhere between 09:00 and 17:00

I expected a returned route something like this:
start 11:45
address 1 visit: 11:55
address 2 visit 12:05
end 12:15

However, it seems that the ready/due data is not taken into account, the tour i get returned is:
start 09:00
address 1 visit 09:10
address 2 visit 09:20
end 09:30

Route 2 (intentionally added unfeasible data)
I have 4 addresses:
address 1 is set to visit anywhere between 09:00 and 17:00
address 2 is set to visit BEFORE 12:00 AFTER 13:00
address 3 is set to visit AFTER 12:00 BEFORE 11:00
address 4 (same as start address) is set to visit anywhere between 09:00 and 17:00

I expected this to return an unfeasible route, but the ready/due data is just neglected it seems

To check that, we’d need your input. It may very well be that the ready and due time are not found in your input and they are not used. But it may also have other reasons.

If you can share your full request we’ll go into the details. If you’re hesitant to share your data here, you can also email to info@routexl.com

This is an example of data we send for optimizing routes:

[{“address”:“depotStart”,“lat”:“50.7798396”,“lng”:“5.4627461”},{“address”:“assignment-id-691”,“lat”:“51.1040436”,“lng”:“3.2844236”,“servicetime”:5,“restrictions”:{“ready”:300,“due”:240}},{“address”:“assignment-id-692”,“lat”:“50.7754521”,“lng”:“5.45731”,“servicetime”:5,“restrictions”:{“ready”:240,“due”:180}},{“address”:“assignment-id-687”,“lat”:“50.7754521”,“lng”:“5.45731”,“servicetime”:5,“restrictions”:{“ready”:240,“due”:540}},{“address”:“assignment-id-688”,“lat”:“50.7754521”,“lng”:“5.45731”,“servicetime”:5,“restrictions”:{“ready”:60,“due”:240}},{“address”:“depotStop”,“lat”:“50.7798396”,“lng”:“5.4627461”}]

Note that the first 2 addresses should give not feasible result as the ready is after the due data (i combined the route data of previous posts for this)

If the result from the API is marked to be not feasible, you can not trust the resulting route or draw any conclusions. The algorithm may have used different weightings as you might expect. Inversed time windows (that is, the ready time is after the due time) can be used as two single-sided time windows, or an excluded time windows. So the location can be visited before the due time or after the ready time.

I adjusted the code so ready can not be after due, but I still get some strange results. I start a route at 08:00. These are the addresses I pass to the calculation:

[
{“address”:“depotStart”,“lat”:“50.7798396”,“lng”:“5.4627461”},
{“address”:“assignment-id-698”,“lat”:“50.7754521”,“lng”:“5.45731”,“servicetime”:5,“restrictions”:{“ready”:60,“due”:240}},
{“address”:“assignment-id-701”,“lat”:“51.0069184”,“lng”:“5.220094”,“servicetime”:5,“restrictions”:{“ready”:240,“due”:360}},
{“address”:“assignment-id-699”,“lat”:“50.774446”,“lng”:“5.458401”,“servicetime”:5,“restrictions”:{“ready”:240,“due”:540}},
{“address”:“depotStop”,“lat”:“50.7798396”,“lng”:“5.4627461”}
]

for the 4th address, the ready/due data is now respected, however, for the 3rd address, the arrival should be somewhere between 12:00 and 14:00, the returned arrival is calculated at 09:36. Do you have an idea why this is?

These locations have ready times, but rather late, and locations are not far away. So there is a lot of waiting time in this route. The waiting time is added between arrival and ready time. E.g.

t=0: departure from location #1
t=2: arrival at location #2, start waiting time
t=60: start service location #2
t=65: end service #2, departure to #3
t=96: arrival at #3, start waiting time
t=240: start service #3
t=245: end service #3, departure to #4
t=275: arrival at #4, start service immediately
t=280: end service #4, departure to #5
t=282: arrival at #5

The bold arrival times are in the output of the API, so these are without waiting time. If you need the start time of the service at a location, you could consider using something like:

startTime = max( arrivalTime , readyTime );

Please note: you can import the locations as JSON on the route planning website, to check the input and the results visually.

Thank you for your reply, I will discuss the proposed max() solution to my team.