Improving performance of distance matrix computation

deals with computation of distance matrices

Improving performance of distance matrix computation

Postby jakubkurchan » Tue Mar 17, 2020 9:38 am

Hello,

I'm trying to compute a square matrix of 3951 locations. I'm sending a request to XDima with parameters:
  1. startLocations - list of all 3951 locations
  2. destinationLocations - same list of all 3951 locations
  3. label - just some random name

All the other parameters are default ones. The computation took well over one hour on my server. Can you perhaps offer a suggestion as to how I could speed it up?
jakubkurchan
 
Posts: 2
Joined: Tue Mar 17, 2020 9:00 am

Re: Improving performance of distance matrix computation

Postby Bernd Welter » Tue Mar 17, 2020 11:23 am

Hi Jakub,
( samples in C# )

this is a brilliant usecase for the high performance routing. For this you need a proper routing profile which supports HIGH_PERFORMANCE_ROUTING:
If you work with the cloud services you can gather the profiles through XData2.listHighPerformanceRoutingNetworks:
csharp code
HighPerformanceRoutingNetworksListResponse res = svcData.listHighPerformanceRoutingNetworks(new ListHighPerformanceRoutingNetworksRequest()
{
resultFields = new ListHighPerformanceRoutingNetworksResultFields() {
profilesSpecified = true,
profiles = true,
highPerformanceRoutingNetworkOptionsSpecified = true,
highPerformanceRoutingNetworkOptions = true
}
}) ;


Then apply this to the xDima2.dimaRequest and its requestProfile. Ensure to set proper values for the distanceMatrixOptions, too. This refers to RoutingType.HIGH_PERFORMANCE_ROUTING but also to the
DistanceMatrixOptions.geographicRestrictions
DistanceMatrixOptions.timeConsideration
DistanceMatrixOptions.contentSnapshotId
Look at this:
csharp code
CreateDistanceMatrixRequest dimaRequest = new CreateDistanceMatrixRequest()
{
startLocations = dictLocation.Values.Select(l => l.routeLocation).ToArray(),
distanceMatrixOptions = new DistanceMatrixOptions()
{
routingTypeSpecified = true,
routingType = RoutingType.HIGH_PERFORMANCE_ROUTING,
},
requestProfile = info.highPerformanceRoutingNetworkDescription.profile
};
if (info.highPerformanceRoutingNetworkDescription != null)
{
dimaRequest.distanceMatrixOptions.geographicRestrictions = info.highPerformanceRoutingNetworkDescription?.highPerformanceRoutingNetworkOptions?.geographicRestrictions;
dimaRequest.distanceMatrixOptions.timeConsideration = info.highPerformanceRoutingNetworkDescription?.highPerformanceRoutingNetworkOptions?.timeConsideration;
dimaRequest.distanceMatrixOptions.contentSnapshotId = info.highPerformanceRoutingNetworkDescription?.highPerformanceRoutingNetworkOptions?.contentSnapshotId;
}


Attention: you can't create own searchgraphs in the cloud.
If you work on premise you might need xData.startCreateHighPerformanceRoutingNetwork.

Best regards,
Bernd
Bernd Welter
Senior Technical Consultant Developer Components
PTV GROUP - Germany

Bernd at Youtube
User avatar
Bernd Welter
Site Admin
 
Posts: 1545
Joined: Mon Apr 14, 2014 10:28 am


Return to PTV xDimaServer

cron