Page 1 of 1

Preventing Route Violations with ConfigurableWorkingHoursPreset

Posted: Wed Mar 12, 2025 12:27 pm
by CAPcargo
Hi,

I am testing the xRoute/calculateRoute service with TourRestrictions, where I have set the ConfigurableWorkingHoursPreset to EU_DRIVING_TIME_REGULATION_FOR_SINGLE_DAY.

However, in the response, my calculated tour is 12 hours long, which exceeds the maximum daily driving time allowed by the regulation.

I noticed that in the Events list of the RouteResponse, this violation is detected, as I receive the MAXIMUM_DRIVING_TIME_PER_TOUR violation (see attached image).

My Question:
Is there a way to configure the RouteRequest to prevent generating a tour that exceeds this regulation, rather than just detecting and reporting the violation?

From what I understand, the current approach seems to be that the service always generates a tour, regardless of violations, and it is then up to me to decide whether to accept or discard the result based on the reported violations. Is this correct?

I know that in xTour, there is an ignoreRouteViolations property that controls this behavior, but I haven’t found an equivalent setting for xRoute when using a preset.

Re: Preventing Route Violations with ConfigurableWorkingHoursPreset

Posted: Wed Mar 12, 2025 12:45 pm
by Maximilian Vogel
As far as I know it is not possible to configure the request in a way that it generates a tour that does not exceed the regulation.
Is there a way to configure the RouteRequest to prevent generating a tour that exceeds this regulation,
What would be the expected result? Would you want a route that ends at the last waypoint before the exceedance occurs? Or would you want a route that skips as many waypoints as necessary to return to the first waypoint (assuming this is the depot) without exceeding the regulation?
Keep in mind that xRoute.calculateRoute just connects the waypoints in the sequence as they are provided in the request. There is no optimization of the sequence included, even when specifying tour restrictions and also no modification of the waypoints is done. (ETA calculation is somewhat of an exception, of course).
From what I understand, the current approach seems to be that the service always generates a tour, regardless of violations, and it is then up to me to decide whether to accept or discard the result based on the reported violations. Is this correct?
I'd say so, yes. A violated result could also be a trigger to modify the tour and then calculate it again.
I know that in xTour, there is an ignoreRouteViolations property that controls this behavior, but I haven’t found an equivalent setting for xRoute when using a preset.
I have a different understanding of the property. Route violations mean a violation of constraints of the roads, e.g. it was not possible to find a valid route for the given vehicle without violating the maximum weight restriction of a bridge. Or as another example the destination is linked to a road that is forbidden for trucks, hence it would not be allowed to drive there with your configured vehicle. If you set this property to true, then also such violated routes will be considered in the planning and might end up in the final tours.

Re: Preventing Route Violations with ConfigurableWorkingHoursPreset

Posted: Wed Mar 12, 2025 2:38 pm
by CAPcargo
Hi Max,

Thank you for your prompt response.

We were expecting the route calculation to fail in the event of a tour violation and provide an explanation—or allow us to tweak the behavior through parameters. However, your approach works for us, since it lets us decide whether to proceed with the violated tour.

Please consider this issue resolved.

Best regards,
Marko Arsovski

Re: Preventing Route Violations with ConfigurableWorkingHoursPreset

Posted: Wed Mar 12, 2025 2:55 pm
by Bernd Welter
Let me add some statements which hopefully bring light into darkness - @Max: please feel free to correct me if I write garbage:
  • a routing violation occurs if a segment appears in the result which is not "allowed" for a vehicles properties, e.g.
    • if 40t truck passes a "maxWeight=12000" segment (in the middle of a leg)
    • if a heavy vehicle enters a pedestrian zone (typically at beginning or end of a relation).
  • In PTV xServer 1 and xServer 2 it is possible to allow or forbid routing violations.
  • If violations are forbidden the routing engine looks for alternative / valid paths including detours around critical segments. If no valid path exists an exception occurs.
  • If violations are allowed such segments produce additional abstract costs and if a dpotential detour version is "cheaper" than the violated path it is returned (minimized abstract costs).
  • In any case a routing reflects the input sequence of waypoints - it won't remove stops, it won't change any subsequence.
  • Violations will be reported and typically the user has to determin how to tackle the violation (use different vehicle, assign different driver with better logbook...)
Now in the context of Tour Optimization there are the following meta categories of violations due to the split of the overall process into two sub-steps:
  • Dima creation: for an optimization (no matter whether it is a sequencing of a single vehicle or a complex fleet optimization based on one or more DIMAs) - for each vehicle routing type a distance matrix is created (congrats: in xDima2 YOU are in charge of this step!) and contains the following info for each relation (relations: all combinations of all [tour planing route locations]²):
    • traveltime
    • traveldistance
    • violated
    • estimatedByDirectDistance
  • Tour optimization: the tour optimization step reads from the distance matrices hundreds or often milliions of times and plays with combinations of relations. It then checks:
    • for route violations if mentioned in the DIMA information
    • tour violations if further restrictions (vehicle capa exceeded, ...)
  • If your tour planning request does not contain an input plan the structures returned by xTour will not show up tour violations. If we can't schedule all orders due to tour restrictions we sacrifice some of them but ensure to return proper tours.
  • If you work with input tour / plan we first verify the input tours: if an input tour contains tour violations we do not consider this vehicle in the optimization step. We simple return such vehicles and report the tour violations.
  • But as you already mentioned: route violations can be enabled which means a "relation which is violated in the dima" can appear in a result or not


In xtour there are two meta categories of "violations":