Tours and Trips


Short description | Tour

The PTV xTour service allows you to create tours to execute a set of orders. These created tours respect preexisting boundary conditions. Those boundary conditions incorporate a fleet of a finite capacity and size, restricted opening intervals of sites, driving times between the sites as well as service times at the sites.


This page describes technical concepts which are necessary to understand the structure of the calculated tours, as well as parameters affecting this structure.

Detailed Consideration

Relevant Terms

The following terms are important to understand the whole use case. See Orders, Locations, and Stops for more details.

vehicle location Geographical location where the used vehicle is located at the beginning of the tour or must be located at the end of the tour.
customer site, depot site Geographical location where some task needs to be carried out.
task A certain service action to be performed at a site as requested by an order. The task can be to pickup some goods, deliver some goods, or to just visit a customer.
order Either an order to visit a customer site or to transport goods from one site to another.
fleet Vehicle resources available to process the orders.
leg Ride between two successive sites of a tour. The leg report contains information about a leg.


A tour is linked to a specific vehicle, and a specific vehicle can be linked to at most one tour. A tour provides the information which tasks are carried out in which order by the specified vehicle and its driver within the planning horizon and within the driver's operating intervals. Consecutive tasks at the same site are grouped to stops. That would make a tour a sequence of stops and rides in between. But that is not the whole story: A vehicle may specify a vehicle start location and/or a vehicle end location. If specified, a vehicle start/end location is the start of the ride at the beginning of a tour and the end of the ride at the end of a tour, respectively. No tasks are carried out at the vehicle start or end location. So there is no stop at the vehicle location in the list of stops because a stop implies a task at a site. So a tour is a sequence of stops, possibly with a vehicle location in the front and/or in the back, and rides between the locations.


The trips of a tour do not overlap: A stop is always part of exactly one trip. And a ride can only be part of at most one trip. The following parts of the tour are not part of any trip:

All other rides belong to a trip. The effect can be seen in the tour events of a response: Each ride of a trip corresponds to a leg report. A leg contains at least one tour event with the tour event type DRIVING. A leg might contain additional tour events with the type BREAK or DAILY_REST.

Valid tour structures

Trip start and end are implicitly defined by the stops within a tour. At trip start and trip end there are no orders in execution. A trip always comprises both the pickup and the delivery task of a transport order. Tours planned with a PlanToursRequest always satisfy these tour structures. If the tour structure of an input plan is invalid or if a ChangeToursRequest would make a tour invalid, a TourStructureFault is thrown.

Start and end of a tour

Cases for the start of a tour:

  • vehicle start location followed by a depot stop
  • vehicle start location followed by a customer stop
  • first stop of the tour (either at a depot or a customer site)

A vehicle start location can be any type of location.

The first trip starts at the

  • vehicle start location if a vehicle location is defined and the first stop is a customer.
  • first stop if there is no vehicle location defined or if the first stop is at a depot.

The cases for the tour end are symmetrical to the described ones, i.e. the tour ends at its vehicle end location or at its last stop.

Transition to next trip

A trip ends whenever there are no more orders in execution after a delivery task at a depot. In this case the trip ends at this depot and the last stop of this trip is at this depot.

A trip also ends after a ride to a depot when there are no orders in execution. In this case the trip ends with an empty ride to this depot. The last stop of this trip however is at the previous site.

Cases between trips:

  • delivery and pickup tasks at depot
  • only delivery tasks at depot
  • only pickup tasks at depot
  • empty ride between trips

If both pickup and delivery tasks are performed at a depot, the delivery tasks form the last stop of their trip. The first stop of the next trip is formed by the pickup tasks at that depot.

If only tasks for one of the adjacent trips are performed at a depot, then there is no corresponding stop in the other trip as stops must have at least one task.

Empty rides that belong to no trip are depicted with gray dashed arrows. Empty rides within trips are depicted as colored dashed arrows.

Valid loading sequence

Tour structures where a site is visited multiple times for loading or for unloading are undesired. To avoid such tour structures, xTour restricts the possible tour structures to certain loading sequences. The following is not allowed for valid loading sequences:

  • A site is left although there is still load for it on the vehicle.
  • A site is reached again although there is still load from it on the vehicle.
If the loading sequence of an input plan tour is not valid, an InvalidLoadingSequenceFault is thrown. An InvalidLoadingSequenceFault is also thrown if a ChangeToursRequest would make the loading sequence invalid.


Example 1


  • The vehicle starts and ends its tour at the same vehicle location which differs from the depot and customer sites.
  • A transport order from Depot A to Customer 1.
  • A transport order from Depot B to Customer 2.
  • A transport order from Customer 3 to Depot A.
  • Two transport orders from Depot B to Customers 4 and 5.


The tour begins at the vehicle start location. The empty ride to Depot A does not belong to any trip.

The goods of the first order are picked up at Depot A. Here, the first trip starts. The next stop is Depot B where the goods of the second order are picked up. The subsequent stops are for the deliveries of the goods on the vehicle, followed by a pick-up stop at Customer 3. The ride between Customer 2 and Customer 3 is an empty ride but the current trip cannot end here because neither Customer 2 nor Customer 3 is a depot, and only depots act as trip delimiters. The vehicle returns to Depot A to deliver the goods from Customer 3. Since the vehicle has arrived at a depot where the vehicle becomes empty, the first trip ends here.

The remaining orders are to be picked up at Depot B. Therefore, the vehicle heads towards Depot B. The empty ride between the depots is not a part of any trip, but only part of the tour.

The second trip starts with the pick-up stop at Depot B, followed by two delivery stops. Since there are no pick-up orders in the second trip, there is no reason to approach a depot after the delivery at Customer 5. Therefore, the vehicle heads towards the vehicle location. The empty ride between Customer 5 and the vehicle location is a part of the second trip because a trip can only end at a depot or at a vehicle end location. The second trip ends as soon as the vehicle arrives at its end location.


Example 2


  • The vehicle starts and ends its tour at the same vehicle location which differs from the depot and customer sites.
  • Two transport orders between customers. One from customer 1 to customer 2 and one from customer 2 to customer 4.
  • Two transport orders from customers 3 and 6 to the depot.
  • Three transport orders from the depot to customers 5, 6 and 7


The tour starts at the vehicle location just like the first trip because the first site along the tour is a customer site. The goods from Customer 1 are delivered to Customer 2. The goods from Customer 2 are delivered to Customer 4. In between, goods are picked up at Customer 3 that need to be returned to the depot. The first trip ends after unloading these goods at Depot A.

Immediately after that, the second trip starts with the loading of the goods for customers 5,6 and 7. At Customer 6, goods are picked up to be returned to the depot. As soon as these goods are delivered at Depot A, the second trip ends.

The empty ride from the depot to the vehicle location is not a part of any trip but only part of the tour.


Good to know: Tour-structure control

PTV xTour service provides two main fields that are part of the TourRestrictions, by which a user can control the structure of the resulting tours for a given input data:

The restriction singleTripPerTour controls the permission of vehicle assignment to multiple trips. By applying singleTripPerTour PTV xTour algorithm will be forced to build tours consisting of one single trip only. So every available vehicle executes one trip at maximum. The default setting allows tours to consist of multiple trips and, therefore, leads to a more efficient use of resources.

The restriction singleDepotPerTour controls whether more than one depot site is allowed to be approached within a tour. The default setting allows a more efficient use of resources, since a vehicle assignment is not limited to the orders of a single depot. However, in some situations this kind of restriction is useful to keep orders for different depot sites separated. This can be achieved by the setting singleDepotPerTour to true.

When setting the restriction singleDepotPerTour it can still appear that there are two (or three) depots contained in a tour. The only reason for that situation is if the vehicle start and/or end location is a depot. Since there are no orders carried out at the vehicle start and end location those depots are not part of the singleDepotPerTour restriction.

Consider following situation: There are two depot sites "Depot A" and "Depot B". Each of those depots has a fleet consisting of two vehicles and a set of pickup and delivery orders assigned to it.

Starting position | Depot A and Depot B

Following figures illustrate possible resulting tour plans depending on the tour restriction settings of the algorithm:


This setting ensures that each vehicle is assigned to only one trip at maximum. Further, the orders referring to different depots are executed by different vehicles.


Orders referring to different depots are strictly separated by the vehicles, which are used to process them. Vehicles are allowed to process multiple consecutive trips.


Vehicles are restricted to one single trip each at maximum. However, multiple different depots are allowed to be served within the tour.

No restrictions

There are no restrictions on the amount of trips within the tour, or depots to be served by one vehicle.

Additionaly, the resulting tour structure is affected by the type of the given sites. Depot sites are subject to a tighter restrictions compared to customer sites. A delivery task at a depot site cannot be followed by any other task than a depot site delivery within the same trip. Otherwise the current trip ends. So, when modelling for example a logistic hub, which is approached multiple times within a trip, using a customer site instead of a depot site would be a feasible solution.