Skip to main content

KAYROS

PyPI SWH

KAYROS is an exact & anytime solver for duration-minimization time-dependent vehicle routing problems, TDVRPTW (with time windows) and TDVRP, benchmarked on the canonical MAMUT-routing TD instance families.

The name is a nod to Kairos, the ancient Greek notion of the right, opportune moment, fitting for a time-dependent solver where when each route departs is itself a decision. It is also a recursive acronym: Kayros Anytime-Yielding Routing Optimization Solver.

Status: beta, developed as part of a PhD. Two solving modes on one exact time-dependent engine: an anytime time-dependent iterated local search that produced the large majority of the MAMUT store's best-known solutions (minimizing Duration or, since 1.2.0, FleetCostDuration — a fleet fixed cost plus duration, as priced by the Blauth2024 family; since 1.3.0 a fleet-descent route-elimination phase contests the fleet size itself, the mechanism behind the first best-known solutions beaten on that family; since 1.4.0 the first solution is published within a fraction of a second at every instance size, where it used to take minutes at n = 1000; since 1.5.0 the search starts from a deliberately over-provisioned fleet and shrinks it, which is worth double-digit percentages where waiting dominates; 1.6.0 adds an opt-in penalty-tolerant time-window squeeze and a K-capped confined search, the campaign tools behind the warm-started refresh that leaves all thirty Blauth2024 records kayros-held), and an audited exact branch-price-and-cut component (kayros.lera) whose multi-gate certification protocol stands behind the store's proven-optimal solutions (704 as of 2026-08-08: one certificate was retracted after a checker-valid counterexample and the pricing defect behind it repaired in 1.5.1, the 2026-08-06 re-certification re-derived 466 of 468 earlier stamps four-way bit-exactly on the repaired build with one withdrawn on a protocol disagreement, and the Poryos2026 families received their first 238 certificates). Every run ends with an honest verdict (optimum, time limit, or resource limit), never a silent kill.

Install

pip install kayros    # or: uv add kayros / uv pip install kayros

This pulls everything, including the benchmark loaders and the reference checker (mamut-routing-lib). For development:

git clone https://github.com/0nyr/kayros && cd kayros
pip install -e . --group dev    # pip >= 25.1 (or: uv pip install -e . --group dev)

Requirements: Python ≥ 3.11. Building from source (sdist or checkout) additionally needs a C++23 compiler, CMake ≥ 3.26 (fetched automatically by the build backend when missing) and Boost.Graph headers+library; the HiGHS LP solver is fetched and built statically by CMake when no install is found.

Usage

Anytime heuristic solve: iterated local search over granular candidate lists, streaming every new incumbent:

import kayros

# Any MAMUT-routing TD instance (.vrp.json with its .atf.json sidecar next to it)
instance_path = "benchmarks/TDVRPTW/Dabia2013/n=25/C101.vrp.json"
solution = kayros.solve(instance_path, time_limit=10.0, seed=42)
print(solution.duration, solution.num_routes, solution.status)

# Anytime: react to every new incumbent while the solve keeps running
def on_incumbent(incumbent, routes):
    print(f"[{incumbent.seconds:7.2f}s] {incumbent.value:.6f} ({incumbent.origin})")

solution = kayros.solve(instance_path, time_limit=60.0, on_incumbent=on_incumbent)

Instances are loaded without re-verifying their artifact digests, because materialization is deterministic and the check costs minutes and gigabytes of peak memory at n = 1000. Pass verify=True (to kayros.solve on a path, or to kayros.io.load_instance) on test runs and on the first run over data you have not used before: it re-derives the sidecar digests and the ATF digest and pins them against what the instance file declares, which is what catches a truncated download or a mismatched sidecar. Without it those failures are silent.

The default strategy is "ils" (single-trajectory iterated local search), picked over the alternatives in a 20,808-run head-to-head across five TD families at n=10..1000, with the margin growing with instance size. A MAX-MIN TD ant colony remains available as Params(strategy="aco"), and Params(num_neighbours=0) restores exhaustive (non-granular) local-search enumeration; both are alternatives for experimentation, not defaults.

Families that price vehicles (a normative fleet_fixed_cost field on the instance, e.g. Blauth2024) can be solved under the FleetCostDuration objective: the same canonical duration fold plus fleet_fixed_cost × num_routes, priced bitwise by the reference checker. The fleet term is part of solution.duration; the local search then trades route dissolves against duration, helped by a route-dissolve perturbation kick.

params = kayros.Params(objective="fleet_cost_duration")
solution = kayros.solve(instance_path, params, time_limit=10.0, seed=42)
print(solution.duration, solution.num_routes)  # cost includes the fleet term

Exact solve: branch-price-and-cut with checker-exact certificates, optionally warm-started from a known solution (the fast path when certifying near-optimal solutions, e.g. stored best-known ones):

from mamut_routing_lib.td import load_td_instance
from kayros.lera import solve_duration

loaded = load_td_instance(instance_path)
result = solve_duration(loaded, time_limit_s=600.0,
                        initial_routes=[list(r) for r in solution.routes])
print(result["exact_log"]["status"], result["value"])
# status == "Optimum" with routes == [] means: the warm-start solution itself
# is proven optimal. On a time limit, result["exact_log"]["best_bound"] is a
# valid global lower bound when the root relaxation finished (absent otherwise).

solution.duration and result["value"] are always values computed by the reference checker (mamut_routing_lib.td.check_td_solution), never an internal approximation.

Resource limits are verdicts, not crashes: besides the hard time-limit deadline, the exact solve carries a memory self-guard: an RSS watermark polled at the same interruption points as the deadline. When pricing would outgrow the machine (full-horizon TDVRP labeling can exceed any node's RAM), the solve unwinds cleanly with exact_log.status == "MemoryLimitReached", honest bounds, and no certificate. The default limit is resolved from the machine (own RSS + ~80% of available memory, capped by the cgroup limit); solve_duration(memory_limit_mb=...) overrides it, 0 disables.

Design

KAYROS is two solving modes on one exact time-dependent engine:

  • The engine (cpp/pwlf, cpp/core) represents arrival times as non-decreasing continuous piecewise-linear functions (NDCPWLF) and evaluates routes by exact function composition: a bit-identical C++ port of the reference checker's arithmetic (gated by an equivalence suite over the full benchmark set).
  • The anytime stack (kayros.solve): greedy construction and a single-trajectory TD iterated local search (granular ruin-and-recreate kicks, late-acceptance hill climbing, restart-to-best), with a TD ant colony as an alternative strategy, over one time-dependent local-search layer using LCA-BST move evaluation (Blauth et al. 2024) with granular candidate lists: tree-ranked relocate/swap/2-opt* where every accepted move is repriced by the checker-identical fold before it counts.
  • The exact component (kayros.lera): the branch-price-and-cut solver of Lera-Romero, Miranda Bront & Soulignac (2020), vendored under cpp/lera/ (see its NOTICE.md) on the open-source HiGHS LP backend, extended with deadline-compliant anytime behavior, warm starts through columns, TDVRP support, honest time-limit gap reporting, and the memory self-guard. Every column entering the master problem is repriced in the checker's arithmetic, so reported values (and optimality certificates) are checker-exact: optimal under checker-exact route costs and standard LP/pricing tolerances, completeness modulo the search engine's epsilon dominance. On stepwise (value-jump) travel-time functions the labeling switches automatically to an exact value-jump path: the steps' verticals travel through the piecewise-linear machinery as tagged first-class objects (jump vs departure-choice verticals, attained values preserved) instead of being smoothed into steep bridges, so pricing stays complete and stepwise certificates are single-run checker-exact certificates like any other. This path was promoted after a validation ladder ending in a 1444-run four-solve re-certification campaign that re-confirmed 93 stored certificates at their exact stored values with zero checker-infeasible priced columns (cpp/lera/NOTICE.md item 9 records the full history). Turning the LP dual bounds themselves into rigorous certificates (safe bounding) is future work.

Core principles

  • The checker is the referee. Every solution and every certificate is priced by the reference checker of mamut-routing-lib; the checker's value is the value.
  • Exact arithmetic. Plain IEEE-754 doubles, no epsilon comparisons in the engine, no FMA contraction (-ffp-contract=off); results are bit-reproducible across machines.
  • Anytime first. Time budgets are hard deadlines honored by every component (heuristics and exact search alike), and incumbents stream out as they are found; a solver that only answers at the end is not a solver you can interrupt.
  • Honest verdicts. A run ends with an answer: optimum, time limit, or resource limit, with valid bounds where they exist. The solver is never OOM-killed mid-certificate, and it never claims more than its arithmetic supports.
  • One-command install, no proprietary dependency. The default build, including the exact component, is pure open source; HiGHS is built statically into the wheels. The faster CPLEX backend for the BPC remains strictly a source-build opt-in (-DLERA_LP_BACKEND=cplex) and never ships in wheels.
  • One run is one thread. No intra-run parallelism; parallelism belongs to the experiment layer above.
  • POD core. The fresh C++ is plain structs, flat arrays and free functions: optimization-kernel style, no framework (the vendored BPC keeps its upstream style, contained under cpp/lera/).

Archival and reproducibility

kayros is archived by Software Heritage; the badge above tracks the archive status of the GitHub origin (archived origin, archival visits). For academic referencing, prefer Software Heritage identifiers (SWHIDs) of the exact archived revision or release tag over the moving repository origin; when reporting computational results, cite both the kayros release used and the MAMUT-routing benchmark artifacts it was run on.

Branches

Development happens on main. One long-lived branch is deliberately not merged: td-time-warp prototypes penalised exploration of the time-infeasible region (time-warp moves in the local search). A controlled head-to-head found it a no-go for the default solver (parity at best, worse on several families at equal time budgets), so it is kept reachable behind Params for reproducibility rather than merged; the negative result is written up in full as a thesis appendix.

Provenance

KAYROS is developed by Florian Rascoussier (Onyr) as part of a PhD in Informatics and Operations Research (IMT Atlantique / INSA Lyon), under the supervision of Romain Billot, Christine Solnon and Lina Fahed. The NDCPWLF composition engine follows Visser & Spliet (2020)'s move-evaluation theorems; the local-search move evaluation follows Blauth et al. (2024); the exact component vendors the branch-price-and-cut solver of Lera-Romero, Miranda Bront & Soulignac (2020, MIT-licensed; provenance and local modifications documented in cpp/lera/NOTICE.md); the TD-ACO is a rewrite of the author's heuristic layer originally built on that same solver. MIT license.

References

  • Gonzalo Lera-Romero, Juan J. Miranda Bront, Francisco J. Soulignac. Linear edge costs and labeling algorithms: The case of the time-dependent vehicle routing problem with time windows. Networks 76(1):24–53, 2020. doi:10.1002/net.21937. Companion code: gleraromero/networks2020 by Gonzalo Lera-Romero, the solver vendored under cpp/lera/. As of 2026-07-18 its only GitHub star is ours: sadly little recognition for such an important project in the time-dependent routing world. Go give it a second one.
  • Thomas R. Visser, Remy Spliet. Efficient move evaluations for time-dependent vehicle routing problems. Transportation Science 54(4):1091–1112, 2020. doi:10.1287/trsc.2019.0938
  • Jannis Blauth, Stephan Held, Dirk Müller, Niklas Schlomberg, Vera Traub, Thorben Tröbst, Jens Vygen. Vehicle routing with time-dependent travel times: Theory, practice, and benchmarks. Discrete Optimization 53:100848, 2024. doi:10.1016/j.disopt.2024.100848

Acknowledgements

Full authorship, supervision, and contributor policy: AUTHORS.md.

  • Romain Billot, Christine Solnon and Lina Fahed, who supervise the PhD this solver is built for. A special mention to Christine for her guidance and for her decade-long involvement around Time-Dependent routing problems that goes as far back as the PhD of Pénélope Aguiar Melgarejo (more info on Christine's page).
  • Adrien Pichon, Marc Sevaux and Alexandru-Liviu Olteanu as members of the ANR-MAMUT project and its MAMUT-routing benchmark catalog.
  • Romain Fontaine, for his help with Grid'5000, where every KAYROS validation and certification campaign runs. This PhD is a multi-vehicle follow-up to his TDTSPTW thesis and his dynamic-programming solver, tdtsptw-ejor23.
  • Gonzalo Lera-Romero, who made his branch-price-and-cut solver open source: a major milestone on the road to this thesis and the direct inspiration for KAYROS's exact component.
  • Leon Lan, Niels Wouda, Wouter Kool and other contributors to PyVRP who made and kept open-source the PyVRP framework, which is another major inspiration for Kayros's anytime heuristic layer, in 3 aspects: the realization that a single-trajectory iterated local search (ILS) is a strong, simple and scalable anytime metaheuristic for vehicle routing (away from Thibaut Vidal's HGS), for the overall C++/Python architecture, and for the additional competitive drive of the day I read this post by Niels. At that time, I was already on this research stream for a year and realized I was not alone on this problem which was very motivating.
  • Thibaut Vidal, who initiated the movement of open-source vehicle routing solvers and whose HGS-CVRP is a reference anytime metaheuristic for vehicle routing. I have learned a lot from his work, and I am grateful for the open-source spirit he has fostered in the community.

Funding

This work is funded by the French National Research Agency (ANR) as part of the MAMUT project, ANR-22-CE22-0016 "Machine learning et matheuristiques pour le transport urbain" (Machine learning And Matheuristics algorithms for Urban Transportation).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kayros-1.6.0.tar.gz (465.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

kayros-1.6.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (22.5 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

kayros-1.6.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (22.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

kayros-1.6.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (22.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

kayros-1.6.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (22.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file kayros-1.6.0.tar.gz.

File metadata

  • Download URL: kayros-1.6.0.tar.gz
  • Upload date:
  • Size: 465.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for kayros-1.6.0.tar.gz
Algorithm Hash digest
SHA256 1e714960d35a6bb6351844f93bbbbe0fe511593c4e676c12ec63939ca1b4d007
MD5 20069f38089a8ff65e8d5320a1127645
BLAKE2b-256 80da29cd982da74664ea73f2b7e6ff2063ec7206bce1c03dec86583fc97dc52a

See more details on using hashes here.

Provenance

The following attestation bundles were made for kayros-1.6.0.tar.gz:

Publisher: publish.yml on 0nyr/kayros

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kayros-1.6.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kayros-1.6.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4a2ca418980483a01a7db0a5abcc8e4af5ff61dd02fb6b97ef24d64f539a2a7d
MD5 ad1da2a74af608e2533285ff4a3b12bf
BLAKE2b-256 2c719dc7d9ba2f6053679eefdc84adabfc8e17f26816e600ca714b42213ef44e

See more details on using hashes here.

Provenance

The following attestation bundles were made for kayros-1.6.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on 0nyr/kayros

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kayros-1.6.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kayros-1.6.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5d9a9bc18046bbae5abc1dd62a199d8ddd3f86ed50c13afec15ca8eac510747b
MD5 2395a82c8228d8b188e30541c2f11a8c
BLAKE2b-256 bf972268958fda3bf7baac67585cb628e618be2b85451440360710d0cde52ca0

See more details on using hashes here.

Provenance

The following attestation bundles were made for kayros-1.6.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on 0nyr/kayros

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kayros-1.6.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kayros-1.6.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d6485c28eebb1194926e322a8eb4b3588366bfa3e2c3f98a8e868ed17856f083
MD5 eaba5ab6fa086dc71794cf8bb9cb6542
BLAKE2b-256 b6bb25c9896a264001b1ebf9ec74cb64f11649e70ec46855023cfbec261cc058

See more details on using hashes here.

Provenance

The following attestation bundles were made for kayros-1.6.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on 0nyr/kayros

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kayros-1.6.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kayros-1.6.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 99c2b8fa76d4f951f4052c2d09fb73a3fac75809bcb90ba02633d3c6afe6c487
MD5 33cb205f732ab263132512bbcbb1d313
BLAKE2b-256 0da92d9b58f80c8209042d887f74d7260b669cd0b6247eae2d1bfe099967341e

See more details on using hashes here.

Provenance

The following attestation bundles were made for kayros-1.6.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on 0nyr/kayros

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.6.0 This release

5 files

1.5.2

5 files

1.5.1

5 files

1.5.0

5 files

1.4.0

5 files

1.3.0

5 files

1.2.1

5 files

1.2.0

5 files

1.1.3

4 files

1.1.2

4 files

1.1.1

4 files

1.1.0

4 files

1.0.0

4 files

0.5.0

4 files

0.4.0

4 files

0.3.0

4 files

0.2.0

4 files

0.1.0

4 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page