Page 1 of 1

How to allow segment violations during routing?

Posted: Wed Apr 27, 2016 2:54 pm
by Bernd Welter
Hello outer world,

these days a customer asked me whether the routing is able to reflect the following constraints:
  • Basically we need to consider additional TruckAttributes during the routings, e.g. MAX_WEIGHT, MAX_HEIGHT, ...
  • Some of our waypoints are located in areas where we are normally not allowed to enter due to these attributes. Applying the TruckAttributes causes errors.
  • Due to some special documents we are allowed to enter those areas.
  • Disabling TruckAttributes in general isn't an option because we only want to "disable" hem near the start / destinations
Now the question is: is there a mechanism available within routing that helps us to modell this usecase?

Well, the answer is: take a look at the following RoutingOptions:
  • ALLOW_SEGMENT_VIOLATIONS: This parameter controls if routing through blocking segments is possible. If the value is "true", for every violated blocked segment violation a cost is added to the base cost value. The cost value is defined by the RoutingParameter COST_OF_SEGMENT_VIOLATIONS.
    Legal values are "true" and "false". Default value is "false". RouteInfo will return a new attribute hasViolations if this parameter is true.
  • COST_OF_SEGMENT_VIOLATIONS: The cost for a segment blocking violation. This value is for all types of violations. Only relevant if the RoutingParameter ALLOW_SEGMENT_VIOLATIONS is set to "true".
    Legal values are between 0 and 1000000. The default value is 50000.
Setting these COSTSs to a high value will prevent the server from using restricted segments in the wide area.
But they will be used if there is no other alternative to reach waypoints.
Example situation near Leverkusen. The street is restricted due to max weight 3.5t. The vehicle's weight is set to MAX_WEIGHT=7500.<br />Applying the TruckAttributes without accepting violations (ALLOW_SEGMENT_VIOLATIONS=false) causes errors. Setting the ALLOW_SEGMENT_VIOLATIONS=true and COST_OF_SEGMENT_VIOLATIONS=100000 finds a way to the start / destination and returns &quot;there have been violations!&quot; in the response.
Example situation near Leverkusen. The street is restricted due to max weight 3.5t. The vehicle's weight is set to MAX_WEIGHT=7500.
Applying the TruckAttributes without accepting violations (ALLOW_SEGMENT_VIOLATIONS=false) causes errors. Setting the ALLOW_SEGMENT_VIOLATIONS=true and COST_OF_SEGMENT_VIOLATIONS=100000 finds a way to the start / destination and returns "there have been violations!" in the response.
Best regards,
Bernd