Update extend distance matrix

deals with computation of distance matrices
Post Reply
igorb
Posts: 6
Joined: Thu Apr 13, 2023 7:17 pm

Update extend distance matrix

Post by igorb »

Hi,

when trying to update the matrix for which the HRPN has since been recreated DataNotAvailableFault is returned.

To recreate:
1. Create HPRN

Code: Select all

{
  "label": "LuxVan1",
  "scope": "testupdate",
  "storedProfile": "van",
  "highPerformanceRoutingNetworkOptions": {
    "geographicRestrictions": {
      "allowedCountries": [
        "LU"
      ]
    }
  }
}
Created HPRN id is `6b3fac0c-5bd4-4a22-a3f2-150bfe1ab04d`

2. Create distance matrix

Code: Select all

{
  "scope": "testupdate",
  "storedProfile": "van",
  "distanceMatrixOptions": {
    "highPerformanceRoutingNetworkId": "6b3fac0c-5bd4-4a22-a3f2-150bfe1ab04d",
    "routingType": "HIGH_PERFORMANCE_ROUTING"
  },
  "startLocations": [
    {
      "$type": "OffRoadRouteLocation",
      "offRoadCoordinate": {
        "x": 6.22029,
        "y": 49.61513
      }
    },
    {
      "$type": "OffRoadRouteLocation",
      "offRoadCoordinate": {
        "x": 6.1029,
        "y": 49.6432
      }
    }
  ]
}
Created matrix is `6a39fd69-9110-468a-b418-e29ea4b6d754`

3. Delete and recreate HPRN

New HPRN id: `870ec9a2-9647-4a7f-a8c1-6fbf3baad78f`

4. Update matrix

Code: Select all

{
  "$type": "ExtendDistanceMatrixRequest",
  "scope": "testupdate",
  "storedProfile": "van",
  "id": "6a39fd69-9110-468a-b418-e29ea4b6d754",
  "startLocations": [
    {
      "$type": "OffRoadRouteLocation",
      "offRoadCoordinate": {
        "x": 6.32029,
        "y": 49.5152
      }
    },
    {
      "$type": "OffRoadRouteLocation",
      "offRoadCoordinate": {
        "x": 6.1029,
        "y": 49.6432
      }
    }
  ]
}
Response to update matrix:

Code: Select all

{
  "faultInfo": {
    "$type": "DataNotAvailableFault",
    "hint": "No suitable high performance routing network found. The available networks can be retrieved by the listHighPerformanceRoutingNetworks operation of the xData module. See also the technical concept on high performance routing.",
    "parameter": "/createDistanceMatrixRequest/distanceMatrixOptions/@routingType",
    "value": "HIGH_PERFORMANCE_ROUTING"
  },
  "message": "Due to a specific parameter of the request certain data is required to calculate the response but the data is not available."
}
The responses when listing attributes of individual HPRN are the same:
`6b3fac0c-5bd4-4a22-a3f2-150bfe1ab04d`

Code: Select all

{
  "$type": "HighPerformanceRoutingNetworksListResponse",
  "highPerformanceRoutingNetworkInformation": [
    {
      "highPerformanceRoutingNetworkDescription": {
        "id": "6b3fac0c-5bd4-4a22-a3f2-150bfe1ab04d",
        "label": "LuxVan1",
        "highPerformanceRoutingNetworkOptions": {
          "geographicRestrictions": {
            "allowedCountries": [
              "LU"
            ]
          }
        },
        "profile": {
          "vehicleProfile": {
            "engine": {
              "lowEmissionZoneTypes": "DE_GREEN",
              "lowEmissionZoneExemptions": "NONE"
            },
            "weight": {
              "emptyWeight": 2100,
              "loadWeight": 1390,
              "totalPermittedWeight": 3490
            },
            "dimensions": {
              "height": 254,
              "length": 600,
              "width": 200,
              "kingpinToRearAxle": 0
            },
            "axle": {
              "axleLoad": 1800
            },
            "legalCondition": {
              "isEmergency": false,
              "isDelivery": true
            },
            "load": {
              "hazardousGoodsTypes": "NONE",
              "loadType": "GOODS",
              "tunnelRestrictionCode": "NONE"
            },
            "speeds": {
              "speedRangesByNetworkClass": {
                "maximumSpeeds": [
                  135,
                  122,
                  105,
                  100,
                  95,
                  50,
                  20,
                  9
                ],
                "minimumSpeeds": [
                  70,
                  38,
                  30,
                  25,
                  20,
                  10,
                  5,
                  4
                ]
              },
              "maximumSpeed": 255
            },
            "driveType": "MOTOR_VEHICLE",
            "numberOfTrailers": 0,
            "preferredRouteTypes": "NONE",
            "unrestrictedRouteTypes": "NONE",
            "restrictedRouteTypes": "NONE",
            "highlyRestrictedRouteTypes": "NONE",
            "prohibitedRouteTypes": "NONE"
          },
          "routingProfile": {
            "course": {
              "violations": {
                "enabled": true
              },
              "network": {
                "penaltiesByNetworkClass": {
                  "penalties": [
                    0,
                    0,
                    10,
                    20,
                    30,
                    50,
                    100,
                    100
                  ]
                },
                "rampPenalty": 10
              },
              "toll": {
                "tollPenalty": 0
              },
              "specialAreas": {
                "residentsOnlyPenalty": 2500,
                "urbanPenalty": 0,
                "minimumUrbanNetworkClass": 2,
                "forbiddenLowEmissionZonePenalty": 2501,
                "deliveryOnlyPenalty": 2501,
                "deliveryOnlyGateCost": 150000,
                "seasonalClosurePenalty": 0
              },
              "combinedTransport": {
                "boatPenalty": 100,
                "railPenalty": 100
              },
              "maneuver": {
                "highPerformanceRoutingUTurnCost": 500,
                "considerTurningBans": true,
                "intersectionTurnCosts": {
                  "turnStrategy": "NONE"
                }
              },
              "distanceTimeWeighting": 80
            }
          }
        },
        "tenant": "globaltenant",
        "scope": "testupdate",
        "lastUsedAt": "2024-09-16T12:17:59.000Z",
        "size": 3263123
      }
    }
  ]
}
`870ec9a2-9647-4a7f-a8c1-6fbf3baad78f`

Code: Select all

{
  "$type": "HighPerformanceRoutingNetworksListResponse",
  "highPerformanceRoutingNetworkInformation": [
    {
      "highPerformanceRoutingNetworkDescription": {
        "id": "870ec9a2-9647-4a7f-a8c1-6fbf3baad78f",
        "label": "LuxVan1",
        "highPerformanceRoutingNetworkOptions": {
          "geographicRestrictions": {
            "allowedCountries": [
              "LU"
            ]
          }
        },
        "profile": {
          "vehicleProfile": {
            "engine": {
              "lowEmissionZoneTypes": "DE_GREEN",
              "lowEmissionZoneExemptions": "NONE"
            },
            "weight": {
              "emptyWeight": 2100,
              "loadWeight": 1390,
              "totalPermittedWeight": 3490
            },
            "dimensions": {
              "height": 254,
              "length": 600,
              "width": 200,
              "kingpinToRearAxle": 0
            },
            "axle": {
              "axleLoad": 1800
            },
            "legalCondition": {
              "isEmergency": false,
              "isDelivery": true
            },
            "load": {
              "hazardousGoodsTypes": "NONE",
              "loadType": "GOODS",
              "tunnelRestrictionCode": "NONE"
            },
            "speeds": {
              "speedRangesByNetworkClass": {
                "maximumSpeeds": [
                  135,
                  122,
                  105,
                  100,
                  95,
                  50,
                  20,
                  9
                ],
                "minimumSpeeds": [
                  70,
                  38,
                  30,
                  25,
                  20,
                  10,
                  5,
                  4
                ]
              },
              "maximumSpeed": 255
            },
            "driveType": "MOTOR_VEHICLE",
            "numberOfTrailers": 0,
            "preferredRouteTypes": "NONE",
            "unrestrictedRouteTypes": "NONE",
            "restrictedRouteTypes": "NONE",
            "highlyRestrictedRouteTypes": "NONE",
            "prohibitedRouteTypes": "NONE"
          },
          "routingProfile": {
            "course": {
              "violations": {
                "enabled": true
              },
              "network": {
                "penaltiesByNetworkClass": {
                  "penalties": [
                    0,
                    0,
                    10,
                    20,
                    30,
                    50,
                    100,
                    100
                  ]
                },
                "rampPenalty": 10
              },
              "toll": {
                "tollPenalty": 0
              },
              "specialAreas": {
                "residentsOnlyPenalty": 2500,
                "urbanPenalty": 0,
                "minimumUrbanNetworkClass": 2,
                "forbiddenLowEmissionZonePenalty": 2501,
                "deliveryOnlyPenalty": 2501,
                "deliveryOnlyGateCost": 150000,
                "seasonalClosurePenalty": 0
              },
              "combinedTransport": {
                "boatPenalty": 100,
                "railPenalty": 100
              },
              "maneuver": {
                "highPerformanceRoutingUTurnCost": 500,
                "considerTurningBans": true,
                "intersectionTurnCosts": {
                  "turnStrategy": "NONE"
                }
              },
              "distanceTimeWeighting": 80
            }
          }
        },
        "tenant": "globaltenant",
        "scope": "testupdate",
        "lastUsedAt": "2024-09-16T12:21:14.000Z",
        "size": 3263123
      }
    }
  ]
}

Is there a hidden attribute of distance matrix, or HPRN that determines if it is viable for updating said matrix, and is there a way to determine if a valid HPRN for matrix update exists, before running matrix update?

Thank you and looking forward to your reply
Igor
User avatar
Bernd Welter
Site Admin
Posts: 2703
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Update extend distance matrix

Post by Bernd Welter »

Hello Igor,

in fact the ID of the HPR is stored within the DIMA.INI file of the dima when you create it, some kind of

Code: Select all

[DIMA]
DESCRIPTION=9.....
ROUTINGTYPE=CH
HPRNETWORKID=6b3fac0c-5bd4-4a22-a3f2-150bfe1ab04d
NETPATH=C:\ptv-xserver\maps\PTV_World_City_Map_Premium_2024_2H
.....
As you can see: also the path of the underlying map path is stored in the INI file.

:!: Therefore changing the dsata that was used to create the DIMA cannot be changed.

What triggers the changed options of the HPR calculation?

Let's check this topic 1:1 to develop a proper strategy for your story,

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:
igorb
Posts: 6
Joined: Thu Apr 13, 2023 7:17 pm

Re: Update extend distance matrix

Post by igorb »

Hello,

my question was more in regards to correct exception/error handling procedure, in case HPRN goes missing/is updated for any reason. I think you anwsered my question.

Thank you for prompt response

Kind regards,
Igor
Maximilian Vogel
Posts: 16
Joined: Fri Dec 29, 2017 9:00 am

Re: Update extend distance matrix

Post by Maximilian Vogel »

Hi,

there are two ways to use HPR:
  • Specifying the HPRN id explicitly as you did. In that case, the HPRN id is stored in the meta information of the distance matrix just like Bernd showed. If the HPRN is deleted, that reference no longer works. And currently, there is no way to change that reference in existing distance matrices.
  • Setting the request profile and the distance matrix options such that they match the parameters of a HPRN. In that case, the engine checks the request settings against the available HPRN and if there is one that matches the settings, it will be used (given that the specified routing type includes HPR). In that case, the HPRN id is not stored as meta information and the engine will use the recreated HPRN to extend the distance matrix.
Best regards,
Max
Maximilian Vogel
Developer
PTV Logistics
Post Reply