Skip to content

TQrouting

High-performance vehicle routing SDK for Python.

TQrouting is a Python SDK for solving Vehicle Routing Problems (VRP). It computes optimized routes for a fleet of vehicles serving a set of customers, while respecting operational constraints such as vehicle capacity, customer time windows, vehicle shifts, and route duration or distance limits.


Key Features

  • Fast solver — powered by advanced machine learning and optimization techniques, with multi-threaded execution
  • Rich constraint support — vehicle capacity (one- or two-dimensional: weight + volume), customer time windows, vehicle shifts, route duration and distance limits, pickup and delivery, multiple depots, heterogeneous fleet
  • Soft or hard constraints — treat chosen limits as soft (priced into the objective) instead of hard, so tight problems still return a usable solution
  • Fleet minimization — per-vehicle fixed costs let the solver trade travel against the number of vehicles used
  • Flexible input — build instances in code, or load from dicts / JSON files
  • Distance matrix providers — built-in integrations with OSRM and Google Maps

Quick Example

from tqrouting import TQRouter, VRPInstance, Customer, VehicleType, Location

router = TQRouter()

instance = VRPInstance(
    customers=[
        Customer(location=Location(matrix_id=1), delivery_load=9),
        Customer(location=Location(matrix_id=2), delivery_load=4),
        Customer(location=Location(matrix_id=3), delivery_load=10),
    ],
    fleet=[
        VehicleType(
            start_location=Location(matrix_id=0),
            end_location=Location(matrix_id=0),
            capacity_load=20,
            n_vehicles=3,
        ),
    ],
    distance_matrix=[
        [0, 2, 5, 8],
        [2, 0, 7, 6],
        [5, 7, 0, 4],
        [8, 6, 4, 0],
    ],
)

solution = router.solve(instance)

print(solution.is_feasible)           # True
print(solution.total_route_duration)  # 21.0
for route in solution.routes:
    customers = [v.customer_id for v in route.visits]
    print(f"Route {route.id}: {customers}")

What Problems Can TQrouting Solve?

Problem Type Description
CVRP Capacitated Vehicle Routing Problem
VRPTW VRP with Customer Time Windows
MDVRP Multi-Depot VRP
HFVRP Heterogeneous Fleet VRP
OVRP Open VRP (routes may end at the last customer or at a different location)
VRPPD VRP with Pickup and Delivery
TOP Team Orienteering Problem (prize-collecting)
Duration/Distance Constrained VRP VRP with route duration and/or distance limits
Combinations Any mix of the above constraints

Next Steps