Skip to main content

Compound Zones: Setting Entry and Exit Time Penalties

Certain delivery or pickup areas, like large industrial parks, gated communities, or restricted city centers, require additional time simply to enter or exit the area, regardless of the specific stop location within it. These "compound zones" might involve navigating security gates, internal road networks, or specific traffic patterns. This model is supported by SWAT APIs using a compound_zones parameter to add these time penalties.

Compound zones significantly enhance the modeling of vehicle routing problems by incorporating a fixed, aggregate service time for all orders within a specified geographical area. This aggregate service time, applied in addition to the individual service times for each individual order, accurately reflects real-world scenarios where vehicles require a substantial amount of time at a location regardless of the number of individual pickups or drop-offs. A prime example of this is the docking time needed at a warehouse or distribution center. Instead of simply summing the individual service times for each package picked up or dropped off, the compound zone model accounts for the overhead associated with entering, operating within, and exiting the zone. This overhead might include time spent navigating the facility, interacting with personnel, or performing necessary logistical tasks before and after individual order processing. The fixed service time associated with the compound zone provides a more realistic and comprehensive representation of the total time commitment required at that location, leading to more accurate and efficient route optimization. This feature is particularly valuable when dealing with complex logistics networks where fixed operational constraints, such as loading dock availability or mandated security procedures, significantly impact overall vehicle routing efficiency.

Compound Zone Penalties:

Compound zone penalties define a fixed time cost incurred when a vehicle's route transitions into or out of a designated zone. Enter and exit time required for a compound zone are applied to the travel time required to reach out the drop off or pickup location.

  • Entry Time: A time penalty added when a vehicle arrives at the first stop (or order) within a specific zone sequence, having come from outside that zone.
  • Exit Time: A time penalty added after the vehicle completes service at the last (or order) within that specific zone sequence, before proceeding to a destination outside the zone.

These penalties apply once per contiguous sequence of stops within the zone. If a vehicle enters a zone, visits multiple stops inside, and then leaves, it incurs one entry penalty and one exit penalty for that sequence.

Examples:

  • Gated Community: A driver might spend 5 minutes waiting/clearing security at the entrance (entry time) and 3 minutes navigating back to the main road upon leaving (exit time).
  • Large Industrial Park: Navigating the internal road network to reach the first delivery point might take 10 minutes (entry time), and leaving the park from the final pickup point takes another 8 minutes (exit time).
  • Restricted Downtown Area: Entering a pedestrian-priority or low-emission zone might involve specific access procedures taking 5 minutes (entry time), with similar time needed to exit.
  • Docking time for a vehicle: Time required to dock or undock a vehicle before or after load operations can occur.

Conceptual Example:

A delivery company has stops within a large campus (Zone A) and outside it.

  • Stop 1: Outside Zone A
  • Stop 2: Inside Zone A
  • Stop 3: Inside Zone A
  • Stop 4: Outside Zone A

A possible route sequence: Depot -> Stop 1 -> Enter Zone A (Add Entry Time Penalty) -> Stop 2 -> Stop 3 -> Exit Zone A (Add Exit Time Penalty) -> Stop 4 -> Depot.

The entry penalty is added before arriving at Stop 2, and the exit penalty is added after departing from Stop 3.

Implementation

Compound zones and their associated entry/exit times are configured within the model_parameters.compound_zones section of the API request. Nodes (stops) are associated with a zone by assigning them a specific group.

compound_zones is an array where each object defines:

  • group: The identifier linking nodes to this specific compound zone.
  • entry_time: The time penalty (in seconds) added when entering the zone.
  • exit_time: The time penalty (in seconds) added when exiting the zone.

Nodes intended to be part of a compound zone must include the corresponding group identifier in their groups list.

Instead of using groups it is also possible to explicitly set node_uids to be assigned to a compound zone for a more granular control in cases groups are used for other settings like

"model_parameters": {
"compound_zones": [
{
"groups": ["IndustrialParkA","IndustrialParkB"],
"enter_time": 600, // 10 minutes
"exit_time": 480 // 8 minutes
},
{
"node_uids": ["45188b13-e91d-4d41-95fa-9cde22767231"],
"enter_time": 300, // 5 minutes
"exit_time": 180 // 3 minutes
}
]
},
"nodes": [
{
"uid": "stop1_park",
"groups": ["IndustrialParkA", "priority_deliveries"],
"lat": ..., "lon": ..., "service_time": 300, ...
},
{
"uid": "stop2_park",
"groups": ["IndustrialParkA"],
"lat": ..., "lon": ..., "service_time": 450, ...
},
{
"uid": "stop3_gated",
"groups": ["GatedCommunityX"],
"lat": ..., "lon": ..., "service_time": 200, ...
},
{
"uid": "45188b13-e91d-4d41-95fa-9cde22767231",
"groups": ["priority_deliveries"],
"lat": ..., "lon": ..., "service_time": 150, ...
}
]

The routing engine automatically identifies sequences of nodes belonging to the same compound zone group within a vehicle's route. When a vehicle travels from a node not in group X to a node in group X, the entry_time for group X is added to the travel time before arriving at the first node in that group X sequence. When a vehicle travels from a node in group X to a node not in group X, the exit_time for group X is added to the travel time after departing the last node in that group X sequence.

Special Cases and Considerations

Travel time includes entry and exit penalties. This can affect feasibility if a vehicle's arrival at a zone's first stop, including the entry penalty, falls outside the stop's time window. The penalties are not shown separately in the optimization results; they're implicitly added to the travel time between stops.

Modeling Fixed Service Time at a Location

A powerful use case for compound zones is to model a fixed service time for an entire location (like a warehouse or distribution center) that is independent of the number of orders being picked up or dropped off. This is useful for scenarios like vehicle docking, security checks, or administrative procedures that take a set amount of time, no matter how many packages are handled.

  • Using exit_time: The exit_time is added to the travel time after the vehicle has completed its service at the last node in the zone and departs. This means it does not affect the scheduled_ts of the nodes within the zone. It correctly models a fixed duration activity (like undocking or paperwork) that happens before the vehicle leaves for its next destination.

  • Using enter_time: The enter_time is added to the travel time before the vehicle arrives at the first node in the zone. This directly impacts the scheduled_ts of that node and can cause a cascading delay for all subsequent nodes in the route. This can make it harder to meet time windows and may not accurately reflect an activity that occurs upon arrival but before service begins.

tip

While both enter_time and exit_time can be used for this, exit_time is the recommended approach since it is not impacting calculation of the scheduled arrival time to the consequent node.

Example: Warehouse Docking Time

Imagine a warehouse requires a fixed 15-minute period for a truck to dock before any unloading can begin. This can be modeled as a compound zone with a single node (the warehouse).

By setting exit_time: 900 (15 minutes), the optimizer will account for this fixed time after the vehicle has finished its service at the warehouse, just before it departs. This ensures the vehicle's schedule remains accurate without artificially shifting the arrival time.

The diagram below illustrates how enter_time and exit_time affect the schedule. Notice how exit_time is added after the node's service is complete, preserving the scheduled arrival time.