Route calculation time

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.
Post Reply
mnawias
Posts: 13
Joined: Fri Nov 06, 2020 12:15 pm

Route calculation time

Post by mnawias »

Calculate route with 6 waypoints takes 10 seconds. Is it normal time or we need to change something in server configuration or in sended request?

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <calculateRoute xmlns="http://xroute.xserver.ptvgroup.com">
         <request xmlns="">
            <requestProfile>
               <vehicleProfile driveType="MOTOR_VEHICLE">
                  <engine />
                  <weight />
                  <dimensions />
                  <legalCondition isDelivery="false" />
                  <load />
               </vehicleProfile>
               <featureLayerProfile>
                  <themes id="PTV_TruckAttributes" enabled="true" />
               </featureLayerProfile>
               <routingProfile>
                  <course distanceTimeWeighting="30" />
               </routingProfile>
            </requestProfile>
            <geometryOptions>
               <responseGeometryTypes>PLAIN</responseGeometryTypes>
            </geometryOptions>
            <waypoints xmlns:q1="http://xroute.xserver.ptvgroup.com" xsi:type="q1:OnRoadWaypoint">
               <location>
                  <coordinate x="19.265819599" y="50.358009298" />
               </location>
            </waypoints>
            <waypoints xmlns:q2="http://xroute.xserver.ptvgroup.com" xsi:type="q2:OnRoadWaypoint">
               <location>
                  <coordinate x="19.095579163" y="50.258018503" />
               </location>
            </waypoints>
            <waypoints xmlns:q3="http://xroute.xserver.ptvgroup.com" xsi:type="q3:OnRoadWaypoint">
               <location>
                  <coordinate x="20.731729497" y="52.375209841" />
               </location>
            </waypoints>
            <waypoints xmlns:q4="http://xroute.xserver.ptvgroup.com" xsi:type="q4:OnRoadWaypoint">
               <location>
                  <coordinate x="19.171760486" y="50.3043213" />
               </location>
            </waypoints>
            <waypoints xmlns:q5="http://xroute.xserver.ptvgroup.com" xsi:type="q5:OnRoadWaypoint">
               <location>
                  <coordinate x="18.695640604" y="50.276458731" />
               </location>
            </waypoints>
            <waypoints xmlns:q6="http://xroute.xserver.ptvgroup.com" xsi:type="q6:OnRoadWaypoint">
               <location>
                  <coordinate x="16.238300277" y="49.529289214" />
               </location>
            </waypoints>
            <routeOptions currency="PLN">
               <timeConsideration xmlns:q7="http://timeconsideration.xserver.ptvgroup.com" xsi:type="q7:ExactTimeConsiderationAtArrival" referenceTime="2021-05-11T10:15:58.6398915+02:00" />
               <polylineOptions elevations="true" />
               <tollOptions returnZeroCosts="true" />
               <monetaryCostOptions costPerKilometer="10" workingCostPerHour="40" />
            </routeOptions>
            <resultFields waypoints="true" nodes="true" polyline="true" monetaryCostsReport="true">
               <toll enabled="true" sections="true" systems="true" />
            </resultFields>
         </request>
      </calculateRoute>
   </s:Body>
</s:Envelope>
User avatar
Bernd Welter
Site Admin
Posts: 2684
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Route calculation time

Post by Bernd Welter »

Hello Matheusz,

your routing requests a time consideration mode which has an impact on performance - at least for such a long total distance. So from this point of view I am not surprised.

Your request took me about 2 seconds on TEST and PROD (quite stable on all my 10 calls).
By adding PTV_TruckSpeedPatterns it took roughly 3seconds.

Did you test on a local environment?

Bernd

PS: are the prices you used the final ones? Looks like they are not realistic
<monetaryCostOptions costPerKilometer="10" workingCostPerHour="40" />
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:
mnawias
Posts: 13
Joined: Fri Nov 06, 2020 12:15 pm

Re: Route calculation time

Post by mnawias »

Hello Bernd,

We add time consideration mode in request to get toll roads in Czech Republic. Is there another way to get toll roads in Czech Repeblic without time consideration mode? I tested it in an on premise system but i conntected via Internet.

PS: The prices we used are only for test.
User avatar
Bernd Welter
Site Admin
Posts: 2684
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Route calculation time

Post by Bernd Welter »

Well, in fact the ExactAt-modes are the most precise ones and require more time than the others.
There's a less time consuming mode called SnapshotTimeConsideration which would return toll prices for countries such as Czech Republic.

I think you have to find the proper balance between quality and performance.
At least I didn't see a fundamental fault in your request.

PS: Do you need all the result field elements that you requested?
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:
mnawias
Posts: 13
Joined: Fri Nov 06, 2020 12:15 pm

Re: Route calculation time

Post by mnawias »

Hello Bernd

We changed Time Consideration Mode to mode called SnapshotTimeConsideration. Now calculate route with 6 waypoints takes 6 seconds.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <calculateRoute xmlns="http://xroute.xserver.ptvgroup.com">
         <request xmlns="">
            <requestProfile>
               <vehicleProfile driveType="MOTOR_VEHICLE">
                  <engine />
                  <weight />
                  <dimensions />
                  <legalCondition isDelivery="false" />
                  <load />
               </vehicleProfile>
               <featureLayerProfile>
                  <themes id="PTV_TruckAttributes" enabled="true" />
               </featureLayerProfile>
               <routingProfile>
                  <course distanceTimeWeighting="30" />
               </routingProfile>
            </requestProfile>
            <geometryOptions>
               <responseGeometryTypes>PLAIN</responseGeometryTypes>
            </geometryOptions>
            <waypoints xmlns:q1="http://xroute.xserver.ptvgroup.com" xsi:type="q1:OnRoadWaypoint">
               <location>
                  <coordinate x="19.265819599" y="50.358009298" />
               </location>
            </waypoints>
            <waypoints xmlns:q2="http://xroute.xserver.ptvgroup.com" xsi:type="q2:OnRoadWaypoint">
               <location>
                  <coordinate x="19.095579163" y="50.258018503" />
               </location>
            </waypoints>
            <waypoints xmlns:q3="http://xroute.xserver.ptvgroup.com" xsi:type="q3:OnRoadWaypoint">
               <location>
                  <coordinate x="16.238300277" y="49.529289214" />
               </location>
            </waypoints>
            <waypoints xmlns:q4="http://xroute.xserver.ptvgroup.com" xsi:type="q4:OnRoadWaypoint">
               <location>
                  <coordinate x="19.171760486" y="50.3043213" />
               </location>
            </waypoints>
            <waypoints xmlns:q5="http://xroute.xserver.ptvgroup.com" xsi:type="q5:OnRoadWaypoint">
               <location>
                  <coordinate x="18.695640604" y="50.276458731" />
               </location>
            </waypoints>
            <waypoints xmlns:q6="http://xroute.xserver.ptvgroup.com" xsi:type="q6:OnRoadWaypoint">
               <location>
                  <coordinate x="20.731729497" y="52.375209841" />
               </location>
            </waypoints>
            <routeOptions currency="PLN">
               <timeConsideration xmlns:q7="http://timeconsideration.xserver.ptvgroup.com" xsi:type="q7:SnapshotTimeConsideration" referenceTime="2021-05-13T08:00:00+02:00" />
               <monetaryCostOptions costPerKilometer="10" workingCostPerHour="40" />
            </routeOptions>
            <resultFields waypoints="true" nodes="true" polyline="true" monetaryCostsReport="true">
               <toll enabled="true" sections="true" systems="true" />
            </resultFields>
         </request>
      </calculateRoute>
   </s:Body>
</s:Envelope>
User avatar
Bernd Welter
Site Admin
Posts: 2684
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Route calculation time

Post by Bernd Welter »

OK, so there's improvement, though it is still slower than one would expect.
That's the price for quality ;-)
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