Tour period xTour vs xRoute

This forum deals with any kind of trip optimization whether it is automatic planning or manual dispatching, refering to transport orders or service planning.
Post Reply
Gerhard
Posts: 11
Joined: Thu Aug 11, 2016 6:41 pm

Tour period xTour vs xRoute

Post by Gerhard »

Hi,

I've got a pretty basic question regarding the differences in time calculation between xTour and xRoute. Our use case is as follows:

1) We have several tour stops which we want to optimize/sort with xTour's planBasicTours method (we only have one vehicle and one tour ... therefore we used to use planSequence but due to the fact that we had unscheduled events with status "FEASIBLE" in a certain use case, we switched to planBasicTours to solve this problem).

2) After we have the stops in the optimized order, we use xRoute's calculateRoute method to get the route between the stops.

In both requests we use the profile "carslow" in the caller context variable. For the planBasicTours method we use a Dima with profile name "dimaCar".

The thing that confuses me is that in a test scenario ...
- xTour.planBasicTours gives me result.totalTourDrivingPeriod = 14102
- xRoute.calculateRoute gives me info.time = 17128

Interestingly if I use the profile "carfast" I get almost equal results ...
- xTour.planBasicTours gives me result.totalTourDrivingPeriod = 14102
- xRoute.calculateRoute gives me info.time = 14103

So from my point of view, xTour seems to use the "carfast" setting, even if I set the "carslow" profile, whereas xRoute makes use of the "carslow" profile set. The problem with that is that xTour includes destinations in the tour that can't be reached in time.

Same behaviour applies with "truckfast" and "truckslow" (with Dima "dimaTruck"): Whenever I use "truckfast", xTour and xRoute give the same time result (with 1 second difference). As soon as I switch to "truckslow" I get different results (xTour gives the same time for both requests).

Do you have any idea what I'm doing wrong based on the information given or do you want me to provide sample code?

One last question as I have the feeling that "carfast" is probably a bit too fast and "carslow" might be too slow. Is there any way to fine tune these profiles to get something like the middle of these two profiles?

Thank you in advance and kind regards,
Gerhard
Gerhard
Posts: 11
Joined: Thu Aug 11, 2016 6:41 pm

Re: Tour period xTour vs xRoute

Post by Gerhard »

I created a simple example for the Raw Request Runner at https://xtour-eu-n-test.cloud.ptvgroup. ... quest.html

Changing "carslow" to "carfast" makes no difference in the result. Am I missing something somewhere?

{
"transportOrders": [
{
"$type": "TransportDepot",
"id": 101,
"transportPoint": {
"id": 1010,
"location": {
"point": {
"x": 675000,
"y": 6380000
}
},
"servicePeriod": 0,
"useServicePeriodForRecreation": false,
"openingIntervalConstraint": "START_OF_SERVICE"
}
},
{
"$type": "TransportDepot",
"id": 102,
"transportPoint": {
"id": 1020,
"location": {
"point": {
"x": 671006,
"y": 6382294
}
},
"servicePeriod": 0,
"useServicePeriodForRecreation": false,
"openingIntervalConstraint": "START_OF_SERVICE"
}
}
],
"depots": [
{
"id": 201,
"location": {
"point": {
"x": 681812,
"y": 6375071
}
},
"openingIntervals": [
{
"from": 0,
"till": 86400
}
]
}
],
"fleet": {
"vehicles": [
{
"depotIdStart": 201,
"depotIdEnd": 201,
"dimaId": 1,
"id": 301
}
]
},
"planningParams": {
"$type": "StandardParams",
"distanceMatrixCalculation": [
{
"$type": "DistanceMatrixByRoad",
"dimaId": 1,
"deleteBeforeUsage": true,
"deleteAfterUsage": true,
"profileName": "dimaCar"
}
]
},
"inputPlan": null,
"callerContext": {
"properties": [
{
"key": "TransactionId",
"value": "Test-Request"
},
{
"key": "Profile",
"value": "carslow"
}
]
}
}
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Tour period xTour vs xRoute

Post by Bernd Welter »

Hello Gerhard,

let me sum up some info first:
  • carFast / default / dimaCar has speed values such as 135,70,125,35,85,25,...
    carSlow has speed values such as 105,65,100,33,75,25,...
  • if you set the profile of a dima in DistanceMatrixByRoad.dimaProfile it overrides the one mentioned in the CallerContext. This probably explains why your request with {"key": "Profile","value": "carslow"} returns same results as with {"key": "Profile","value": "carfast"}
  • There is a recent post dealing with profiles, maybe it helps: http://xserver.ptvgroup.com/forum/viewt ... ?f=9&t=583
About the second part "profile speed values are not realistic":
You can configure those values in the server side XML files as you want. If you don't have acccess to server profiles (e.g. because you work with xServer INTERNET) you have to use the SNIPPET approach.

I hope these answers are sufficient.

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:
Gerhard
Posts: 11
Joined: Thu Aug 11, 2016 6:41 pm

Re: Tour period xTour vs xRoute

Post by Gerhard »

Hello Bernd,

thank you very much for the fast response, that's very much appreciated! We're using xServer INTERNET, just to clarify. I think I was able to solve it with the information you provided. But just to make sure that I got everything right (and probably in order to help others in the future), let's get a little bit into the details:

I understand that the dimaProfile overwrites the CallerContext in xTour.planBasicTours, so that's the reason why I get the same results for the code in my second post, no matter if I use "carfast" or "carslow" (totalTourDrivingPeriod is always 2360).

Using the following code with xRoute.calculateRoute (at https://xroute-eu-n-test.cloud.ptvgroup ... quest.html ) I basically get almost the same result (time = 2363), which is perfect (the 3 seconds difference are negligible):

Code: Select all

{  
   "waypoints":[  
      {  
         "coords":[  
            {  
               "point":{  
                  "x":681812,
                  "y":6375071
               }
            }
         ],
         "linkType":"NEXT_SEGMENT"
      },
      {  
         "coords":[  
            {  
               "point":{  
                  "x":671006,
                  "y":6382294
               }
            }
         ],
         "linkType":"NEXT_SEGMENT",
         "viaType":{  
            "viaType":"VIA_STOP"
         }
      },
      {  
         "coords":[  
            {  
               "point":{  
                  "x":675000,
                  "y":6380000
               }
            }
         ],
         "linkType":"NEXT_SEGMENT",
         "viaType":{  
            "viaType":"VIA_STOP"
         }
      },
      {  
         "coords":[  
            {  
               "point":{  
                  "x":681812,
                  "y":6375071
               }
            }
         ],
         "linkType":"NEXT_SEGMENT"
      }
   ],
   "options":[  

   ],
   "exceptionPaths":[  

   ],
   "details":{  
      "binaryPathDesc":false,
      "boundingRectanglesC":5,
      "boundingRectanglesOffset":300,
      "brunnelManoeuvres":false,
      "detailLevel":"STANDARD",
      "dynamicInfo":false,
      "manoeuvreAttributes":false,
      "manoeuvreGroupRatio":1,
      "manoeuvreGroups":true,
      "manoeuvres":true,
      "nodes":false,
      "polygon":true,
      "segmentAttributes":false,
      "segments":true,
      "texts":true,
      "totalRectangle":true,
      "urbanManoeuvres":false
   },
   "callerContext":{  
      "properties":[  
         {  
            "key":"CoordFormat",
            "value":"PTV_MERCATOR"
         },
         {  
            "key":"ResponseGeometry",
            "value":"PLAIN"
         },
         {  
            "key":"Profile",
            "value":"carfast"
         }
      ]
   }
}
Using the same code with profile "carslow", i get time = 2473.

So now the question is, how can I get this "carslow" result of ~2473 when using xTour.planBasicTours? If I remove the "dimaCar" profile, I get a totalTourDrivingPeriod of 3045, which is obviously the same as if I used "dimaTruck".

Is the only way to edit the profile values? In order to give that a try I added the following code to the callerContext.properties (containing the speed values of the "carslow" profile):

Code: Select all

{  
   "key":"ProfileXMLSnippet",
   "value":"
<Profile xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://localhost:50090/xtour/schema/XTourProfile.xsd'> 
<Routing majorVersion=\"2\" minorVersion=\"0\">
<Vehicle>
<Speed>
<SpeedRangeByNetworkClass minimumSpeed=\"65\" maximumSpeed=\"105\"/>
<SpeedRangeByNetworkClass minimumSpeed=\"33\" maximumSpeed=\"100\"/>
<SpeedRangeByNetworkClass minimumSpeed=\"25\" maximumSpeed=\"75\"/>
<SpeedRangeByNetworkClass minimumSpeed=\"25\" maximumSpeed=\"55\"/>
<SpeedRangeByNetworkClass minimumSpeed=\"20\" maximumSpeed=\"48\"/>
<SpeedRangeByNetworkClass minimumSpeed=\"18\" maximumSpeed=\"40\"/>
<SpeedRangeByNetworkClass minimumSpeed=\"9\" maximumSpeed=\"16\"/>
<SpeedRangeByNetworkClass minimumSpeed=\"4\" maximumSpeed=\"6\"/>
</Speed>
</Vehicle>
</Routing>
</Profile>"
}
This way I get totalTourPeriod = 2469 from xTour.planBasicTours, which is definitely close enough to the 2473 returned by xRoute.calculateRoute. So I think for our use case we can go without the profile (carfast, carslow, truckfast, truckslow) and just create/fine-tune a set of speed profiles on our own.

As far as I could figure out the speed settings of the various profiles are as follows:

carfast
[70,135],[35,125],[25,85],[25,60],[20,50],[18,40],[9,16],[4,6]

carslow
[65,105],[33,100],[25,75],[25,55],[20,48],[18,40],[9,16],[4,6]

truckfast
[55,80],[30,65],[23,55],[20,45],[18,40],[15,30],[7,12],[4,6]

truckslow
[50,70],[28,60],[23,52],[20,42],[18,38],[15,28],[7,12],[4,6]

... and the 8 street types are:

1) Motorways
2) Highways
3) Trunk roads
4) Country roads
5) City roads
6) Residential roads
7) Drivable but normally blocked roads (for cars).
8) Cycle lanes and walkways

Could you just confirm that all the information above is correct?
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Tour period xTour vs xRoute

Post by Bernd Welter »

Hello Gerhard,

without checking each and every property in detail the answer on a meta level is simple:
  • As your setting of routing parameters isn't available on the server and you can't edit it you have to use the snippet approach.
  • You can send the complete XML content of xRoute's carSlow profile as snippet
  • Make sure to delete the dima before!
Should work fine,

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