Calculating and Planning Routes with openingIntervals

This forum deals with any kind of routing computation whether it is simple A:B-routing, calculation of isochrones, simple matrix computation or nearest search.
JBlack
Posts: 10
Joined: Thu Jan 17, 2019 3:10 pm

Calculating and Planning Routes with openingIntervals

Post by JBlack »

Hi,

we are using the calculateExtendedRoute method from xRoute to calculate our tour. I have some questions about that, I hope someone could help me:

1. Is there a way to get a route from it where the durations of each waypoint like servicePeriod will be noticed and so the route time will be calculated depending on every servicePeriod?
2. What will be needed to use openingIntervals (from, till) known by TransportPoint Class (extends LogisticPoint -> LogisticPoint.openingIntervals[].from...) the right way. Does the START_TIME RoutingParameter has to be set? (Second parameter of calculateExtendedRoute (options) RoutingOption[].RoutingParameter.START_TIME)

we are also using the planSequence method of xTour to optimize our tour:

1. How to use openingIntervals here the right way? There is no option to define a START_TIME I think.
2. How to process the following situation:
There are two main cities with many addresses in the tour. Both cities are many kilometres away from each other, so the addresses from city 2 could only be reached earliest on the next day.
One TransportPoint of city 1 has the openingInterval from = 36000 till = 43200 (10:00 to 12:00 o'clock if 00:00 is my "zero-point") and by chance a TransportPoint of city 2 has the same openingInterval (from = 36000 till = 43200). How the optimizer then knows, that the TransportPoint of city 2 couldn't be reached on the same day between 10:00 to 12:00 o'clock?

Thanks in advance!
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Calculating and Planning Routes with openingIntervals

Post by Bernd Welter »

Hello Jonas,

I moved your post to the xRoute subforum because it deals with the usecase of routing.
The subforum xServer internet deals with topics that are related to architecture of xServer INTERNET.
As each subforum is checked by specific experts it is helpful for you and us to drop topics into the proper chanel ;-)


Now getting back to the usecase:

That's quite tricky. Looks like you want to combine "service periods and intervals" with "dynamic routing (time dependent segment state)". Unfortunately you have to choose between one of those features because they do not work ar the same time. This is also described in https://xserver.ptvgroup.com/forum/view ... =855#p2511
You might take a look at the method xRoute1.calculateAdvancedTour but be aware that this won't apply DYNAMIC routing as explained in the post above.

Now let's look at planSequence. In Tour 1 you have to consider that the distance matrix (required for sequencing and tuor optimization) is calculated before any optimization algorithm takes place. This means the distance matrix does not know at what point in time a specific relation is used. Without the current time: no dynamic routing possible.

We will approach this "time dependent optimization" in xServer2 but it is still under development.
Anyhow: if you want to define the start time of a tour (usually this is a result of the optimization: what is the best time to start?) you can use the departureTimeFixed property of a vehicle.
Once more: this would be a topic for the xTour forum.

PS: I recommend that you participate in the webinar which deals with time dependency in xServer 2 (30.1.2019, participation free of cost).
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
JBlack
Posts: 10
Joined: Thu Jan 17, 2019 3:10 pm

Re: Calculating and Planning Routes with openingIntervals

Post by JBlack »

Hello Bernd,

but how the optimizer optimizes TourPoints if they have the same openingIntervals but are far away from each other, so that it wouldn't be possible to drive to them on the same day?

Thanks in Advance!
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Calculating and Planning Routes with openingIntervals

Post by Bernd Welter »

Hello,

if the optimizer isn't able to schedule each order incl. considering the restrictions some of them remain unscheduled.
Let me return the question:
What kind of a result would you expect if the task "schedule every order" isn't possible?

Best regards,
Bernd

PS:
Please ensure to read the following core articles about tour optimization:
https://xserver.ptvgroup.com/forum/view ... ?f=6&t=489
https://xserver.ptvgroup.com/forum/view ... p?f=6&t=75
https://xserver.ptvgroup.com/forum/view ... ?f=6&t=143
These articles contain very valuable info about tour optimization principles in xTour 1!
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
JBlack
Posts: 10
Joined: Thu Jan 17, 2019 3:10 pm

Re: Calculating and Planning Routes with openingIntervals

Post by JBlack »

Hello,

A quick question before: We define a start and end time for our the tour (e.g. 9:00 - 19:00). Could this information also used by the PTV Api?

Back to your question: our start and endtime of the tour is defined from 7 o'clock to 19 o'clock. Then I would expect the result, that the optimizer moves the TourPoints which can't be reached inside of the defined start and end time to the "next day". This should also dependent of the timeframes which were defined before as openingIntervals.

So back to my example of my first post: If there are some TourPoints in city 1 where one has the openingInterval from = 36000 till = 43200 (10:00 to 12:00 o'clock if 00:00 is my "zero-point") and by chance a TransportPoint of city 2 has the same openingInterval (from = 36000 till = 43200), I would expect the optimizer puts the TransportPoint of city 2 somewhere in the end of the TourPoint sequence, because it should be reachable then on the next day between 10 o'clock and 12 o'clock.

Is there a way to do it like mentioned above?

Best Regards,
Jonas
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Calculating and Planning Routes with openingIntervals

Post by Bernd Welter »

Hello Jonas,

attention: be aware that this is the xRoute forum but when we talk about optimizer this is based on xTour! :!:

for a single vehicle you have to decide between the following two approaches:
  • vehicle.departureTimeFixed (optional Integer): start time is fixed (single point in time, not an interval). Then we will create the first tour of the vehicle in a way that the vehice starts at this point int time. Not earlier, not later.
  • If you do not specify a departureTimeFixed we will start the vehicles first tour somewhere within the operating interval of the vehicle.
Once again:
if you want us to take care of several days then you need to specify several operating intervals, e.g. [09:00-19:00, 33:00-43:00] (where 33:00 means 9:00 of the second day).
If your transaction deals only with day #1 we create a structure that follows the constraints and optimizes just the scope of the first day. Of course this could lead to results that are suboptimal input for a single planning of day #2.
I recommend to get in touch with your assigned consultant team 1:1 to discuss the proper strategy for your current usecase.

Best regards,
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
JBlack
Posts: 10
Joined: Thu Jan 17, 2019 3:10 pm

Re: Calculating and Planning Routes with openingIntervals

Post by JBlack »

Hello Bernd,

some time has passed by and now I have a new question about planning tours with openingIntervals.
You said, if I want you to take care of several days then I have to specifiy several operating intervals, e.g. [09:00-19:00, 33:00-43:00] (where 33:00 means 9:00 of the second day). That worked for me then. But now I want to specifiy not only one openingInterval per waypoint but up to three openingIntervals per day per waypoint. Currently with your solution like described above, I have one openingInterval per day per waypoint. Now I need three a day.

Could it be that a possible solution will be to simply add the second and third openingIntervals like the first one too?
So e. g. this are my operating intervals for my first waypoint:
1. 09:00 - 11:00
2. 13:00 - 16:00
3. 18:00 - 19:00

Then I will have to add the following operating Intervals to the openingIntervals array of the first waypoint:
Day 1: 09:00 - 11:00, 13:00 - 16:00, 18:00 - 19:00
Day 2: 33:00 - 35:00, 37:00 - 40:00, 42:00 - 43:00
... and so on?

And if this is a correct solution, what will happen, if the openingIntervals will overlap each other? Do I have to prevent it to get it to work properly?

Best regards,
Jonas Schwartz
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Calculating and Planning Routes with openingIntervals

Post by Bernd Welter »

Hello Jonas
You got it... for the server the intervals are just numbers, so you could cut the working hours into pieces. What is important
- intervals should not overlap (otherwise you get an error) for a single vehicle or a stop
- within planOvernight each interval is seen as a day break. This means if xou specify (8-12)+(13-17)+(32-36)+(37-41)-... the overnight periods are between the intervals. Furthermore the number of intervals in plan Overnight is restricted to 7
- be aware of a vehicles "tours must fit into single interval" property. If your car has 5x3 intervals you might get 15 tours...
15 intervals - tours must fit into single intervals = TRUE
15 intervals - tours must fit into single intervals = TRUE
Ok with that info?
Best regards
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
JBlack
Posts: 10
Joined: Thu Jan 17, 2019 3:10 pm

Re: Calculating and Planning Routes with openingIntervals

Post by JBlack »

Hello Bernd,

thanks, yes I'm ok with that, but what exactly you mean about planOvernight? Like I described above I already do have multiple intervals, because I always add 24 hours for about 30 times, so that I can plan the tour for about a month in advance. For the vehicle I also specified the tourbegintime and tourendtime for about 30 days in advance.
So do I will get a problem if I only add the operatingIntervals for the other two intervals to the specifiy waypoint?

Best regards,
Jonas Schwartz
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Calculating and Planning Routes with openingIntervals

Post by Bernd Welter »

Hello Jonas,

overnight planning is the usecase where the server determines the stay in hotel depending on the cost per km, per hour and hotel, e.g. it is possible that we produce a structure such as
"(mon-tue-wed)-(thu-fri)" which means
  • start the first tour on monday
  • return to the home depot on tuesday
  • start a 2nd tour on wednesday
  • return to the homedepot on friday
This could be an option if the return to the homebase on MON, WED, THU is more expensive than a night in a hotel.
Tour 1 : MON to TUE,<br />Tour 2 : WED to FRI
Tour 1 : MON to TUE,
Tour 2 : WED to FRI
Quite common in optimization of sales teams where the sales rep optimizes his own workload.

About the number of intervals: Usually such a number of intervals leads to a simple question:
does it make sense to reduce the large total problem into weekly smaller ones? Otherwise performance and quality suffer...

Best regards,
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Post Reply