# Waypoint sorting, optional Pickup and Opening Times

Following waypoint parameters enable advanced route planning use cases.

## Waypoint Opening Times

For each waypoint, an earliest arrival time can be set by the "opening" parameter.

• &waypoint1=...;opening:600
• &waypoint2=...;opening:2018-05-12T09:30:00

The waypoint opens 10 minutes (600 seconds) after departure, or at the specified (local) time. If routing arrives there earlier it waits. It automatically combines wait time with legal driver rest time where it makes sense.

• &waypoint3=...;closing:900

• &waypoint4=...;closing:2018-05-15T18:20:00

The waypoint closes 15 minutes (900 seconds) after departure, or at the specified (local) time. Routing will either find a route that meets this deadline or return an error. Routing will try to shift legal driver rest times, re-order the sequence of (sortable) waypoints, skip optional waypoints or increase the cost (by taking toll roads or faster fuel wasting paths) accordingly, to meet deadlines.

Note that the stopOver delay at a waypoint (see below) cannot start before the opening time and must be finished before the closing time. E.g. if the truck shall arrive exactly at 12:00 and then spend 30 minutes there, then set opening=12:00, stopOver=1800! and closing=12:30.

• &waypoint5=...;openingHours:mo-fr12:00-18:00,sa-sa13:00-16:00

The waypoint has weekly reoccurring opening hours. If routing arrives there too early or too late then it waits for the next opening slot. It automatically combines wait time with legal driver rest time where it makes sense.

• &waypoint6=stopOver,3600!...;stopOverDelayRestTime:1800

The vehicle has to stop at the waypoint for 1 hour (3600 seconds). 30 minutes (1800 seconds) of this time may be used as legal driver rest time. Per default (no stopOverDelayRestTime specified) time at the waypoint cannot be used as or combined with a legal driver rest time. Routing automatically combines the allowed part of the wait time with legal driver rest time where it makes sense.

## Sorting Waypoints (Travelling Salesman Problem)

Routing can find the optimal sequence order for the waypoints. Activate this feature by following waypoint parameters:

• &waypoint1=...;sort

All sections of waypoints flagged with "sort" can be rearranged by the router for cost optimization. For example, in the waypoint list of WP0, WP1;sort, WP2;sort, WP3;sort, WP4, WP5;sort, WP6;sort, WP7 the router can change the sequence order among WP1, WP2 and WP3, and it can change the sequence order among WP5 and WP6. If the last waypoint is "sort"able then the route may end at any of the sortable waypoints. Use this if the driver does his overnight stay simply at/after the last waypoint he visited throughout the day.

• &waypoint1=...;before:3,5

Enforces that the route meets waypoint 1 before the waypoints 3 and 5. Use it in combination with either "sort" or "optional".

• &waypoint1=...;implies:4,8

Enforces that if waypoint 1 is part of the route then also waypoints 4 and 8 must be part of the route. Use it in combination with "optional" waypoints.

## Picking optional Waypoints along the Route

To increase vehicle's payload utilization, some optional waypoints can be passed to the router. The router creates a cost optimized route and will choose which of the optional waypoints to include (and in which sequence within the route) and which ones to skip. The router can skip optional waypoints to meet deadlines or because the detour from the route costs more than meeting this waypoint yields.

Optional waypoints can be individual (go there to gain value) or pairs (pick something up here and drop it there). Activate this feature by following waypoint parameters:

• &waypoint1=...;optional

Router can take this waypoint but doesn't have to. Also the waypoint is unordered (can be reordered). As the router always cost optimizes, it minimizes the sum of the cost factors given in the request, which can be (all or part of) driver cost per hour, vehicle cost per kilometer, energy consumption cost, road toll cost and value gained from meeting optional waypoints.

• &waypoint1=...;taketo:7

Makes this waypoint optional, unordered and specifies that the router must meet waypoint 1 and then later on waypoint 7. If an optional waypoint is just "visit" and not a pick-drop pair then define &waypoint77=...;taketo:77.

• &waypoint1=...;value:30

Meeting this optional waypoint yields the specific "money". The currency unit must be the same as used for other cost factors (driver cost, vehicle cost, energy cost). If toll cost is also considered, then the currency unit must be the one specified in the &currency=... parameter (which is generally needed as soon as the router has to convert between 2 currencies to add up cost).

## Truck Capacity and Load Items

Vehicles can have a limited capacity, defined by the routing parameter &capacity=30,13000,6. Vehicle capacity is a vector whose components are user defined, e.g. number of palettes, payload kilograms and number of passengers. For each waypoint, a capacity change can be specified by the waypoint parameter ;load:-3,-1200,1. Using the above example it means that at the waypoint 3 palettes get dropped, weighing 1200 kg altogether and 1 passenger will enter.

The router ensures that the vehicle capacities are never exceeded. This is important for unsorted and for optional waypoints, because the router then finds the best route while considering the vehicle capacity.