メインコンテンツまでスキップ

CVRPTW vs. PDP Scheduling Modes

The Stateless Optimization API is designed to solve two primary classes of Vehicle Routing Problems (VRP) by offering two distinct scheduling modes: prebook_cvrptw and prebook (PDP). Each mode is tailored for different operational workflows, and choosing the correct one is crucial for achieving an efficient and accurate optimization result.

These modes are configured in the engine_settings.calculation_parameters.scheduling_mode field of your request.

PDP (Pickup and Drop off mode)

The prebook mode models the Pickup and Delivery Problem with Time Windows (PDPTW). This is the most flexible and general-purpose mode.

Workflow

In a PDP model, a vehicle's route can consist of a mixed sequence of pickups and drop-offs. A vehicle can start empty, pick up goods from multiple locations, make some deliveries, pick up more goods, and so on. This accurately models complex logistics scenarios like courier services, on-demand transport, or less-than-truckload (LTL) shipping where a vehicle's load changes dynamically throughout its route.

Demand Modeling

To correctly model the changing load on the vehicle, demand is treated as follows:

  • Pickup Nodes: Have a positive demand value, representing items being loaded onto the vehicle and increasing its load.
  • Drop-off Nodes: Have a negative demand value, representing items being unloaded and decreasing the vehicle's load.

Benefits and Limitations

  • Benefits:
    • High Flexibility: Can model complex, multi-trip routes with interleaved pickups and drop-offs.
    • Versatile: Suitable for a wide range of use cases, from logistics to passenger transport.
  • Limitations:
    • Computationally Intensive: The high degree of flexibility means the solver has a much larger problem space to explore, which can lead to longer calculation times, especially for problems with many nodes.

CVRPTW mode

The prebook_cvrptw mode is a highly optimized model for the classic Capacitated Vehicle Routing Problem with Time Windows (CVRPTW).

Workflow

This mode is designed for a simpler, more common distribution model: a vehicle starts at a single central location (like a depot or distribution center), picks up all its goods for the day, and then executes a route consisting only of drop-offs. It can also model the reverse: a vehicle starting empty and making multiple pickups before returning to a single destination.

classDef subgraphStyle fill:#fafafa,stroke:#2b303a,stroke-width:1px,color:#f9603a; class sg2 subgraphStyle; linkStyle 0,1,2 stroke:#f9603a,stroke-width:2px;

Each vehicle is limited to a single trip per optimization run.

Important Requirement

For prebook_cvrptw mode to function correctly, each vehicle must have a partial_route defined that explicitly sets the depot node (a point node) as the starting point of the route. Without this, the solver will not assume a depot start and may produce invalid or unexpected routes.

"vehicles": [
{
"agent_id": "vehicle-1",
"partial_route": ["node-depot"],
...
}
]

Demand Modeling

In this mode, the demand logic is simplified:

  • All Nodes: Have a positive demand value.
  • The solver assumes the vehicle starts its route from the depot fully loaded with the total demand of all assigned drop-off nodes. The vehicle's load then decreases at each stop.

Benefits and Limitations

  • Benefits:
    • Highly Optimized: The solver combines all pickup requests into a single conceptual point, significantly reducing the problem's complexity.
    • Fast Performance: This reduction in complexity leads to much faster calculation times compared to PDP mode, making it ideal for large-scale last-mile delivery scenarios.
    • Feature Support: Certain advanced features, like groups_order for delivery prioritization, are specifically designed for and only work in this mode.
  • Limitations:
    • Limited Flexibility: Only supports single-trip, depot-to-drop-off (or pickup-to-depot) workflows. It cannot model interleaved pickups and drop-offs.

Key Differences at a Glance

Featureprebook (PDP)prebook_cvrptw (CVRPTW)
WorkflowMultiple pickups and drop-offs in any sequenceSingle depot start, followed by multiple drop-offs
Vehicle TripsCan perform multiple tripsLimited to a single trip per vehicle
Demand Model+ for pickup, - for drop-offAlways +; vehicle starts full
PerformanceSlower, more complexFaster, highly optimized
partial_routeOptionalRequired to define the starting depot
Feature CompatibilityGeneral purposeRequired for features like groups_order prioritization

By understanding these differences, you can select the appropriate scheduling_mode to best match your operational needs and achieve the most efficient results from the optimization engine.

Playground

PDP Mode

You can try out the PDP scheduling mode using the playground below.

Loading...

CVRPTW Mode

You can try out the CVRPTW scheduling mode using the playground below.

Loading...