certflow 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. certflow-1.0.1/.gitignore +13 -0
  2. certflow-1.0.1/CHANGELOG.md +54 -0
  3. certflow-1.0.1/CITATION.cff +29 -0
  4. certflow-1.0.1/LICENSE +21 -0
  5. certflow-1.0.1/PKG-INFO +199 -0
  6. certflow-1.0.1/README.md +169 -0
  7. certflow-1.0.1/pyproject.toml +65 -0
  8. certflow-1.0.1/src/certflow/__init__.py +40 -0
  9. certflow-1.0.1/src/certflow/baselines.py +279 -0
  10. certflow-1.0.1/src/certflow/cert.py +1186 -0
  11. certflow-1.0.1/src/certflow/ch.py +1348 -0
  12. certflow-1.0.1/src/certflow/conformal.py +275 -0
  13. certflow-1.0.1/src/certflow/drift.py +472 -0
  14. certflow-1.0.1/src/certflow/egraph.py +371 -0
  15. certflow-1.0.1/src/certflow/episodes.py +176 -0
  16. certflow-1.0.1/src/certflow/fastgraph.py +1032 -0
  17. certflow-1.0.1/src/certflow/graphcore.py +271 -0
  18. certflow-1.0.1/src/certflow/harness.py +534 -0
  19. certflow-1.0.1/src/certflow/movingai.py +673 -0
  20. certflow-1.0.1/src/certflow/oracle.py +222 -0
  21. certflow-1.0.1/src/certflow/realworld.py +375 -0
  22. certflow-1.0.1/src/certflow/roadnet.py +585 -0
  23. certflow-1.0.1/src/certflow/sensing.py +121 -0
  24. certflow-1.0.1/src/certflow/snapshot.py +167 -0
  25. certflow-1.0.1/src/certflow/types.py +119 -0
  26. certflow-1.0.1/tests/test_baselines.py +227 -0
  27. certflow-1.0.1/tests/test_cert.py +307 -0
  28. certflow-1.0.1/tests/test_ch.py +310 -0
  29. certflow-1.0.1/tests/test_conformal.py +126 -0
  30. certflow-1.0.1/tests/test_drift_oracle.py +431 -0
  31. certflow-1.0.1/tests/test_egraph.py +99 -0
  32. certflow-1.0.1/tests/test_episodes.py +39 -0
  33. certflow-1.0.1/tests/test_fastgraph.py +286 -0
  34. certflow-1.0.1/tests/test_graphcore.py +155 -0
  35. certflow-1.0.1/tests/test_harness.py +541 -0
  36. certflow-1.0.1/tests/test_movingai.py +406 -0
  37. certflow-1.0.1/tests/test_movingai_experiment.py +213 -0
  38. certflow-1.0.1/tests/test_realworld.py +56 -0
  39. certflow-1.0.1/tests/test_roadnet.py +232 -0
  40. certflow-1.0.1/tests/test_snapshot.py +108 -0
  41. certflow-1.0.1/tests/test_state_sync.py +169 -0
  42. certflow-1.0.1/tests/test_tier1_smoke.py +130 -0
  43. certflow-1.0.1/tests/test_tier2_smoke.py +104 -0
@@ -0,0 +1,13 @@
1
+ /data/
2
+ cert_env/
3
+ .venv/
4
+ __pycache__/
5
+ *.egg-info/
6
+ .pytest_cache/
7
+ /results/
8
+ paper/*.pdf
9
+ paper/*.aux
10
+ paper/*.log
11
+ paper/*.out
12
+ venue.md
13
+ .claude/
@@ -0,0 +1,54 @@
1
+ # Changelog
2
+
3
+ All notable changes to CERT-FLOW are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [1.0.1] - 2026-06-10
8
+
9
+ First PyPI release (`pip install certflow`).
10
+
11
+ ### Added
12
+ - Top-level package API: `from certflow import CertPlanner, PlannerConfig,
13
+ Certificate, ConformalScorer, ACITracker, EdgeBelief, World`, plus
14
+ `certflow.__version__` (previously `certflow/__init__.py` was empty and
15
+ everything had to be imported from submodules; the old submodule imports
16
+ still work).
17
+ - `CITATION.cff` (validated, concept DOI 10.5281/zenodo.20631475) and this
18
+ changelog.
19
+ - Full PyPI packaging metadata: readme, keywords, classifiers, project URLs.
20
+
21
+ ### Changed
22
+ - README: pip-based 30-second quickstart, static DOI badge pointing at the
23
+ concept DOI, link to the limitations ledger, Python badge corrected to
24
+ 3.10+ (matching `requires-python`).
25
+ - Package version aligned with the release tag (pyproject said 0.1.0 while
26
+ the repository was at v1.0.0).
27
+
28
+ ### Fixed
29
+ - Lint sweep over `src/`: removed unused imports and dead local assignments
30
+ (no behavior change; the full 223-test suite passes bit-identically).
31
+
32
+ ## [1.0.0] - 2026-06-10
33
+
34
+ First public release, accompanying the preprint *CERT: Certified Route
35
+ Planning under Drifting Costs (Extended Version)*.
36
+
37
+ - Conformal route certificates (LB <= OPT <= UB) under drifting edge costs:
38
+ age-weighted non-exchangeable quantiles, staleness correction, honest
39
+ annealing.
40
+ - Certificate-directed sensing (route-critical, churn-aware) and dual
41
+ incremental search on a flat-array engine (numba kernels with pure-Python
42
+ fallback).
43
+ - Certificate-gated preprocessing: all-pairs snapshot oracle and certified
44
+ Contraction Hierarchies (ns-to-microsecond queries that expire under
45
+ drift).
46
+ - 223 tests; 16 reproduction pipelines covering 17 synthetic regimes,
47
+ METR-LA / PEMS-BAY traffic replay, MovingAI maps, and DIMACS road
48
+ networks.
49
+ - Theory T1-T7 documented in `docs/` (coverage, certifiability threshold,
50
+ sum-aware certificate, impossibility of a tighter lower bound,
51
+ decision-uniform validity, churn floor).
52
+
53
+ [1.0.1]: https://github.com/Archerkattri/CERT-FLOW/releases/tag/v1.0.1
54
+ [1.0.0]: https://github.com/Archerkattri/CERT-FLOW/releases/tag/v1.0.0
@@ -0,0 +1,29 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use CERT-FLOW in your research, please cite it as below."
3
+ type: software
4
+ title: "CERT-FLOW: Certified Route Planning under Drifting Costs"
5
+ authors:
6
+ - family-names: Attri
7
+ given-names: Krishi
8
+ email: krishiattriwork@gmail.com
9
+ affiliation: "Seoul National University"
10
+ doi: 10.5281/zenodo.20631475
11
+ url: "https://github.com/Archerkattri/CERT-FLOW"
12
+ repository-code: "https://github.com/Archerkattri/CERT-FLOW"
13
+ license: MIT
14
+ keywords:
15
+ - route planning
16
+ - conformal prediction
17
+ - path planning
18
+ - uncertainty quantification
19
+ - robotics
20
+ - drifting costs
21
+ abstract: >-
22
+ Certified route planning under drifting edge costs. Every replanning round
23
+ emits a high-probability certificate LB <= OPT <= UB on the optimal route
24
+ cost, built from age-weighted non-exchangeable conformal prediction over
25
+ drift-adjusted observation residuals, directs paid sensing at the edges
26
+ that shrink the certified gap fastest, and gates ns-to-microsecond
27
+ preprocessing (all-pairs snapshot oracle, certified Contraction
28
+ Hierarchies) behind the certificate so static-speed queries expire the
29
+ instant drift exceeds tolerance.
certflow-1.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Krishi Attri
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.4
2
+ Name: certflow
3
+ Version: 1.0.1
4
+ Summary: Certified route planning under drifting costs: conformal LB<=OPT<=UB certificates, certificate-directed sensing, proof-gated preprocessing
5
+ Project-URL: Homepage, https://github.com/Archerkattri/CERT-FLOW
6
+ Project-URL: Repository, https://github.com/Archerkattri/CERT-FLOW
7
+ Project-URL: Documentation, https://github.com/Archerkattri/CERT-FLOW/tree/main/docs
8
+ Project-URL: Issues, https://github.com/Archerkattri/CERT-FLOW/issues
9
+ Author-email: Krishi Attri <krishiattriwork@gmail.com>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: conformal-prediction,contraction-hierarchies,d-star-lite,operations-research,path-planning,robotics,route-planning,uncertainty-quantification
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: numpy>=1.24
24
+ Requires-Dist: scipy>=1.10
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == 'dev'
27
+ Provides-Extra: fast
28
+ Requires-Dist: numba; extra == 'fast'
29
+ Description-Content-Type: text/markdown
30
+
31
+ <p align="center"><img src="assets/banner.svg" alt="CERT-FLOW" width="100%"/></p>
32
+
33
+ <p align="center">
34
+ <a href="https://pypi.org/project/certflow/"><img alt="PyPI" src="https://img.shields.io/pypi/v/certflow?color=009E73"></a>
35
+ <a href="#reproducing-every-number"><img alt="tests" src="https://img.shields.io/badge/tests-223%20passing-0072B2"></a>
36
+ <img alt="python" src="https://img.shields.io/badge/python-3.10%2B-56B4E9">
37
+ <img alt="license" src="https://img.shields.io/badge/license-MIT-1a7f37">
38
+ <img alt="coverage claim" src="https://img.shields.io/badge/certificate%20coverage-1.000%20measured-D55E00">
39
+ <a href="https://doi.org/10.5281/zenodo.20631475"><img alt="DOI" src="https://img.shields.io/badge/DOI-10.5281%2Fzenodo.20631475-1f6feb"></a>
40
+ </p>
41
+
42
+ A robot replanning through a world whose costs drift faces a question classical
43
+ planners never answer: **how good is my current route, given that most of the
44
+ map is stale?** CERT-FLOW answers it every round, with a proof: a
45
+ high-probability certificate `LB ≤ OPT ≤ UB` on the optimal route cost, built
46
+ from age-weighted non-exchangeable conformal prediction over drift-adjusted
47
+ observation residuals, and it spends paid sensing exactly where the
48
+ certificate says the gap shrinks fastest.
49
+
50
+ <p align="center"><img src="assets/overview.png" alt="One CERT round" width="92%"/></p>
51
+
52
+ ## Why it's different
53
+
54
+ | | classical replanning (D\* Lite, AD\*) | exchangeable conformal (CIA) | **CERT-FLOW** |
55
+ |---|---|---|---|
56
+ | stale map | silently trusts it | coverage collapses (0.95 → **0.20** measured) | **prices it**: width grows with age, claim degrades visibly |
57
+ | validity under drift | 0.02–0.59 measured | gap-dependent | **0.95–1.00, every condition ever run** |
58
+ | sensing | none / heuristic | none | **certificate-directed** (oracle-level regret) |
59
+ | static regime | fast | tight | **proof-gated preprocessing**: ns–µs queries that self-expire |
60
+
61
+ ## Headline results (all reproducible below)
62
+
63
+ - **Coverage ≥ claimed confidence on every condition ever run**: 17 synthetic
64
+ regimes, off-model worlds, and two real cities (METR-LA, PEMS-BAY) at up to
65
+ 49% drift-model violation rates.
66
+ - **Route quality**: exactly optimal on known maps (≡ Dijkstra, plus the
67
+ certificate); travel-regret −0.12 ≈ a clairvoyant oracle in unknown drifting
68
+ terrain; 2–3× lower regret than freshness/uncertainty/random sensing at
69
+ equal budget.
70
+ - **Speed**: 3.7 ms p50 / 12 ms p95 per fully-certified round at 60×60 (one
71
+ CPU core). Certificate-gated preprocessing answers static queries in
72
+ **269–394 ns** (cost) / 8.7 µs (path), at or below published static-SOTA,
73
+ and at road scale absorbs cost changes in **0.015–0.34 ms vs ~1 s** for
74
+ CRP-style recustomization, exact under ±20% perturbation.
75
+ - **Theory T1–T7**: coverage (observable + latent), a certifiability
76
+ *threshold* (gap ε is sustainable iff sensing rate beats drift, both
77
+ directions), a √L sum-aware upper certificate with a measured
78
+ selection-bias hazard and its gate, an **impossibility theorem** (no uniform
79
+ lower bound can beat Bonferroni by more than log factors, so the certificate's
80
+ asymmetry is optimal), decision-uniform validity, and a churn-measured floor.
81
+ - **Honest negatives, kept**: the corridor-memory speed hypothesis failed
82
+ (documented), a predictor's regime claim was downgraded after its test, and
83
+ the maze negative-control shows exactly where route-critical sensing cannot
84
+ help. Every known limitation and its disposition:
85
+ [docs/results/limitations.md](docs/results/limitations.md).
86
+
87
+ ## Quickstart
88
+
89
+ ```bash
90
+ pip install "certflow[fast]" # "fast" = numba (needed to reproduce the speed numbers)
91
+ python - <<'PY'
92
+ from certflow import CertPlanner, PlannerConfig
93
+ from certflow.drift import grid_world
94
+
95
+ world = grid_world(6, 6, seed=0, kind="bounded", rho=0.02, noise_scale=0.05)
96
+ planner = CertPlanner(world, (0, 0), (5, 5),
97
+ PlannerConfig(epsilon=5.0, alpha_prime=0.2))
98
+ for _ in range(150):
99
+ cert, sensed = planner.round()
100
+ print(f"[{cert.lb:.2f}, {cert.ub:.2f}] @ confidence {cert.confidence:.2f}, "
101
+ f"gap {cert.gap:.2f}")
102
+ PY
103
+ ```
104
+
105
+ To develop or reproduce the paper numbers, work from a clone:
106
+
107
+ ```bash
108
+ git clone https://github.com/Archerkattri/CERT-FLOW && cd CERT-FLOW
109
+ python -m venv cert_env && source cert_env/bin/activate
110
+ pip install -e ".[dev,fast]" pandas h5py tables
111
+ pytest # full suite: 223 with datasets; data-dependent tests skip cleanly without data/
112
+ ```
113
+
114
+ ## Reproducing every number
115
+
116
+ Every quantitative claim traces to a script; the core sweep runs in ~100 s on
117
+ a multicore machine (`CERTFLOW_WORKERS=N` parallelizes seeds bit-identically).
118
+
119
+ | Result | Script | Documented in |
120
+ |---|---|---|
121
+ | Tier-0 coverage (17 conditions, provable + strict modes) | `scripts/run_tier0.py` | `docs/results/tier0-coverage.md` |
122
+ | CERT vs Gaussian (path level) | `scripts/run_tier0_baselines.py` | `docs/results/tier0-coverage.md` |
123
+ | Edge-level audit (Gaussian break) | `scripts/run_gaussian_break.py` | `docs/results/gaussian-break.md` |
124
+ | Incremental repair latency (T3) | `scripts/run_tier1_latency.py` | `docs/results/tier1-latency.md` |
125
+ | Ablations (κ churn, pre-widening) | `scripts/run_ablations.py` | `docs/results/ablations.md` |
126
+ | Travel regret, unknown terrain | `scripts/run_tier2.py` | `docs/results/tier2-regret.md` |
127
+ | Real traffic (METR-LA / PEMS-BAY) | `scripts/run_metr_la.py [--pems-bay]` | `docs/results/metr-la.md` |
128
+ | MovingAI maps + maze negative control | `scripts/run_movingai.py` | `docs/results/movingai.md` |
129
+ | External algorithms (AD\*, VOI, TASP-degenerate) | `scripts/run_extern_baselines.py` | `docs/results/extern-baselines.md` |
130
+ | CIA exchangeability collapse | `scripts/run_cia_comparison.py` | `docs/results/cia-comparison.md` |
131
+ | E-Graphs + networkx anchors | `scripts/run_repeated_queries.py` | `docs/results/extern-baselines.md` |
132
+ | Lifelong missions (memory vs memoryless) | `scripts/run_lifelong.py` | `docs/results/lifelong.md` |
133
+ | Feature regimes (predictor, decision-uniform) | `scripts/run_feature_regimes.py` | `docs/results/feature-regimes.md` |
134
+ | Scale + engine benchmarks | `scripts/run_scale.py` | `docs/results/scale.md` |
135
+ | Road networks (DIMACS NY/FLA, ALT) | `scripts/run_roadnet.py` | `docs/results/published-speed-comparison.md` |
136
+ | Certified Contraction Hierarchies | `scripts/run_ch.py` | `docs/results/published-speed-comparison.md` |
137
+
138
+ All scripts accept `--quick`. Real-data runs need `data/` (sources and loaders
139
+ in `data/README.md`; ~230 MB total, links inside).
140
+
141
+ ## How it works
142
+
143
+ 1. **Score** every paid observation with a drift-adjusted residual; weight by
144
+ age (data-independent geometric weights; exchangeability is *not* assumed).
145
+ 2. **Price** each edge as `ĉ ± (λq + ρ·age)`: the conformal quantile pays for
146
+ noise, the drift term pays for staleness.
147
+ 3. **Bound** the optimum from both sides with two incremental searches
148
+ (optimistic ℓ, conservative u) over a flat-array engine (numba kernels).
149
+ 4. **Claim** `LB ≤ OPT ≤ UB` at an honestly-annealed confidence: weak claims
150
+ during warm-up instead of silence; the claim visibly decays as the map ages.
151
+ 5. **Sense** the edge that shrinks the certified gap fastest (route-critical,
152
+ churn-aware); certification is a *rate*, not a state (T2′).
153
+ 6. **When the certificate proves the map tight**, that proof licenses
154
+ preprocessing: an all-pairs oracle or certified Contraction Hierarchy
155
+ answering in ns–µs, revoked the instant drift exceeds tolerance.
156
+
157
+ ## Layout
158
+
159
+ ```
160
+ src/certflow/
161
+ types.py contracts (World, EdgeBelief, Certificate)
162
+ conformal.py weighted non-exchangeable quantiles, Δ_stale, ACI, blocks
163
+ cert.py the planner: certify → sense → repair loop, gates, annealing
164
+ sensing.py gap-shrink selection + baseline policies
165
+ fastgraph.py flat-array CSR engine (numba D* Lite, Dijkstra kernels)
166
+ snapshot.py certificate-gated all-pairs oracle (ns queries)
167
+ ch.py certified Contraction Hierarchies (231 µs on 264k-node NY)
168
+ roadnet.py DIMACS road graphs + exact ALT on landmark lower-bounds
169
+ drift.py / realworld.py / movingai.py synthetic, traffic-replay, game maps
170
+ episodes.py / harness.py / baselines.py runners, seeds, parametric strawman
171
+ docs/results/ one markdown per experiment: numbers, anomalies, verdicts
172
+ docs/specs/ design spec; docs/theory/ working notes
173
+ ```
174
+
175
+ ## Citation
176
+
177
+ Paper: *CERT: Certified Route Planning under Drifting Costs* (preprint
178
+ forthcoming; the citation entry will be updated once the DOI is live).
179
+
180
+ ```bibtex
181
+ @software{attri2026certflow,
182
+ author = {Attri, Krishi},
183
+ title = {{CERT-FLOW}: Certified Route Planning under Drifting Costs},
184
+ year = {2026},
185
+ doi = {10.5281/zenodo.20631475},
186
+ url = {https://github.com/Archerkattri/CERT-FLOW}
187
+ }
188
+ ```
189
+
190
+ The DOI above is the concept DOI (always resolves to the latest archived
191
+ version); [CITATION.cff](CITATION.cff) carries the same metadata in
192
+ machine-readable form.
193
+
194
+ Paper preprint (extended version): DOI pending engrXiv moderation; this
195
+ section will carry it once posted.
196
+
197
+ ## License
198
+
199
+ MIT, see [LICENSE](LICENSE).
@@ -0,0 +1,169 @@
1
+ <p align="center"><img src="assets/banner.svg" alt="CERT-FLOW" width="100%"/></p>
2
+
3
+ <p align="center">
4
+ <a href="https://pypi.org/project/certflow/"><img alt="PyPI" src="https://img.shields.io/pypi/v/certflow?color=009E73"></a>
5
+ <a href="#reproducing-every-number"><img alt="tests" src="https://img.shields.io/badge/tests-223%20passing-0072B2"></a>
6
+ <img alt="python" src="https://img.shields.io/badge/python-3.10%2B-56B4E9">
7
+ <img alt="license" src="https://img.shields.io/badge/license-MIT-1a7f37">
8
+ <img alt="coverage claim" src="https://img.shields.io/badge/certificate%20coverage-1.000%20measured-D55E00">
9
+ <a href="https://doi.org/10.5281/zenodo.20631475"><img alt="DOI" src="https://img.shields.io/badge/DOI-10.5281%2Fzenodo.20631475-1f6feb"></a>
10
+ </p>
11
+
12
+ A robot replanning through a world whose costs drift faces a question classical
13
+ planners never answer: **how good is my current route, given that most of the
14
+ map is stale?** CERT-FLOW answers it every round, with a proof: a
15
+ high-probability certificate `LB ≤ OPT ≤ UB` on the optimal route cost, built
16
+ from age-weighted non-exchangeable conformal prediction over drift-adjusted
17
+ observation residuals, and it spends paid sensing exactly where the
18
+ certificate says the gap shrinks fastest.
19
+
20
+ <p align="center"><img src="assets/overview.png" alt="One CERT round" width="92%"/></p>
21
+
22
+ ## Why it's different
23
+
24
+ | | classical replanning (D\* Lite, AD\*) | exchangeable conformal (CIA) | **CERT-FLOW** |
25
+ |---|---|---|---|
26
+ | stale map | silently trusts it | coverage collapses (0.95 → **0.20** measured) | **prices it**: width grows with age, claim degrades visibly |
27
+ | validity under drift | 0.02–0.59 measured | gap-dependent | **0.95–1.00, every condition ever run** |
28
+ | sensing | none / heuristic | none | **certificate-directed** (oracle-level regret) |
29
+ | static regime | fast | tight | **proof-gated preprocessing**: ns–µs queries that self-expire |
30
+
31
+ ## Headline results (all reproducible below)
32
+
33
+ - **Coverage ≥ claimed confidence on every condition ever run**: 17 synthetic
34
+ regimes, off-model worlds, and two real cities (METR-LA, PEMS-BAY) at up to
35
+ 49% drift-model violation rates.
36
+ - **Route quality**: exactly optimal on known maps (≡ Dijkstra, plus the
37
+ certificate); travel-regret −0.12 ≈ a clairvoyant oracle in unknown drifting
38
+ terrain; 2–3× lower regret than freshness/uncertainty/random sensing at
39
+ equal budget.
40
+ - **Speed**: 3.7 ms p50 / 12 ms p95 per fully-certified round at 60×60 (one
41
+ CPU core). Certificate-gated preprocessing answers static queries in
42
+ **269–394 ns** (cost) / 8.7 µs (path), at or below published static-SOTA,
43
+ and at road scale absorbs cost changes in **0.015–0.34 ms vs ~1 s** for
44
+ CRP-style recustomization, exact under ±20% perturbation.
45
+ - **Theory T1–T7**: coverage (observable + latent), a certifiability
46
+ *threshold* (gap ε is sustainable iff sensing rate beats drift, both
47
+ directions), a √L sum-aware upper certificate with a measured
48
+ selection-bias hazard and its gate, an **impossibility theorem** (no uniform
49
+ lower bound can beat Bonferroni by more than log factors, so the certificate's
50
+ asymmetry is optimal), decision-uniform validity, and a churn-measured floor.
51
+ - **Honest negatives, kept**: the corridor-memory speed hypothesis failed
52
+ (documented), a predictor's regime claim was downgraded after its test, and
53
+ the maze negative-control shows exactly where route-critical sensing cannot
54
+ help. Every known limitation and its disposition:
55
+ [docs/results/limitations.md](docs/results/limitations.md).
56
+
57
+ ## Quickstart
58
+
59
+ ```bash
60
+ pip install "certflow[fast]" # "fast" = numba (needed to reproduce the speed numbers)
61
+ python - <<'PY'
62
+ from certflow import CertPlanner, PlannerConfig
63
+ from certflow.drift import grid_world
64
+
65
+ world = grid_world(6, 6, seed=0, kind="bounded", rho=0.02, noise_scale=0.05)
66
+ planner = CertPlanner(world, (0, 0), (5, 5),
67
+ PlannerConfig(epsilon=5.0, alpha_prime=0.2))
68
+ for _ in range(150):
69
+ cert, sensed = planner.round()
70
+ print(f"[{cert.lb:.2f}, {cert.ub:.2f}] @ confidence {cert.confidence:.2f}, "
71
+ f"gap {cert.gap:.2f}")
72
+ PY
73
+ ```
74
+
75
+ To develop or reproduce the paper numbers, work from a clone:
76
+
77
+ ```bash
78
+ git clone https://github.com/Archerkattri/CERT-FLOW && cd CERT-FLOW
79
+ python -m venv cert_env && source cert_env/bin/activate
80
+ pip install -e ".[dev,fast]" pandas h5py tables
81
+ pytest # full suite: 223 with datasets; data-dependent tests skip cleanly without data/
82
+ ```
83
+
84
+ ## Reproducing every number
85
+
86
+ Every quantitative claim traces to a script; the core sweep runs in ~100 s on
87
+ a multicore machine (`CERTFLOW_WORKERS=N` parallelizes seeds bit-identically).
88
+
89
+ | Result | Script | Documented in |
90
+ |---|---|---|
91
+ | Tier-0 coverage (17 conditions, provable + strict modes) | `scripts/run_tier0.py` | `docs/results/tier0-coverage.md` |
92
+ | CERT vs Gaussian (path level) | `scripts/run_tier0_baselines.py` | `docs/results/tier0-coverage.md` |
93
+ | Edge-level audit (Gaussian break) | `scripts/run_gaussian_break.py` | `docs/results/gaussian-break.md` |
94
+ | Incremental repair latency (T3) | `scripts/run_tier1_latency.py` | `docs/results/tier1-latency.md` |
95
+ | Ablations (κ churn, pre-widening) | `scripts/run_ablations.py` | `docs/results/ablations.md` |
96
+ | Travel regret, unknown terrain | `scripts/run_tier2.py` | `docs/results/tier2-regret.md` |
97
+ | Real traffic (METR-LA / PEMS-BAY) | `scripts/run_metr_la.py [--pems-bay]` | `docs/results/metr-la.md` |
98
+ | MovingAI maps + maze negative control | `scripts/run_movingai.py` | `docs/results/movingai.md` |
99
+ | External algorithms (AD\*, VOI, TASP-degenerate) | `scripts/run_extern_baselines.py` | `docs/results/extern-baselines.md` |
100
+ | CIA exchangeability collapse | `scripts/run_cia_comparison.py` | `docs/results/cia-comparison.md` |
101
+ | E-Graphs + networkx anchors | `scripts/run_repeated_queries.py` | `docs/results/extern-baselines.md` |
102
+ | Lifelong missions (memory vs memoryless) | `scripts/run_lifelong.py` | `docs/results/lifelong.md` |
103
+ | Feature regimes (predictor, decision-uniform) | `scripts/run_feature_regimes.py` | `docs/results/feature-regimes.md` |
104
+ | Scale + engine benchmarks | `scripts/run_scale.py` | `docs/results/scale.md` |
105
+ | Road networks (DIMACS NY/FLA, ALT) | `scripts/run_roadnet.py` | `docs/results/published-speed-comparison.md` |
106
+ | Certified Contraction Hierarchies | `scripts/run_ch.py` | `docs/results/published-speed-comparison.md` |
107
+
108
+ All scripts accept `--quick`. Real-data runs need `data/` (sources and loaders
109
+ in `data/README.md`; ~230 MB total, links inside).
110
+
111
+ ## How it works
112
+
113
+ 1. **Score** every paid observation with a drift-adjusted residual; weight by
114
+ age (data-independent geometric weights; exchangeability is *not* assumed).
115
+ 2. **Price** each edge as `ĉ ± (λq + ρ·age)`: the conformal quantile pays for
116
+ noise, the drift term pays for staleness.
117
+ 3. **Bound** the optimum from both sides with two incremental searches
118
+ (optimistic ℓ, conservative u) over a flat-array engine (numba kernels).
119
+ 4. **Claim** `LB ≤ OPT ≤ UB` at an honestly-annealed confidence: weak claims
120
+ during warm-up instead of silence; the claim visibly decays as the map ages.
121
+ 5. **Sense** the edge that shrinks the certified gap fastest (route-critical,
122
+ churn-aware); certification is a *rate*, not a state (T2′).
123
+ 6. **When the certificate proves the map tight**, that proof licenses
124
+ preprocessing: an all-pairs oracle or certified Contraction Hierarchy
125
+ answering in ns–µs, revoked the instant drift exceeds tolerance.
126
+
127
+ ## Layout
128
+
129
+ ```
130
+ src/certflow/
131
+ types.py contracts (World, EdgeBelief, Certificate)
132
+ conformal.py weighted non-exchangeable quantiles, Δ_stale, ACI, blocks
133
+ cert.py the planner: certify → sense → repair loop, gates, annealing
134
+ sensing.py gap-shrink selection + baseline policies
135
+ fastgraph.py flat-array CSR engine (numba D* Lite, Dijkstra kernels)
136
+ snapshot.py certificate-gated all-pairs oracle (ns queries)
137
+ ch.py certified Contraction Hierarchies (231 µs on 264k-node NY)
138
+ roadnet.py DIMACS road graphs + exact ALT on landmark lower-bounds
139
+ drift.py / realworld.py / movingai.py synthetic, traffic-replay, game maps
140
+ episodes.py / harness.py / baselines.py runners, seeds, parametric strawman
141
+ docs/results/ one markdown per experiment: numbers, anomalies, verdicts
142
+ docs/specs/ design spec; docs/theory/ working notes
143
+ ```
144
+
145
+ ## Citation
146
+
147
+ Paper: *CERT: Certified Route Planning under Drifting Costs* (preprint
148
+ forthcoming; the citation entry will be updated once the DOI is live).
149
+
150
+ ```bibtex
151
+ @software{attri2026certflow,
152
+ author = {Attri, Krishi},
153
+ title = {{CERT-FLOW}: Certified Route Planning under Drifting Costs},
154
+ year = {2026},
155
+ doi = {10.5281/zenodo.20631475},
156
+ url = {https://github.com/Archerkattri/CERT-FLOW}
157
+ }
158
+ ```
159
+
160
+ The DOI above is the concept DOI (always resolves to the latest archived
161
+ version); [CITATION.cff](CITATION.cff) carries the same metadata in
162
+ machine-readable form.
163
+
164
+ Paper preprint (extended version): DOI pending engrXiv moderation; this
165
+ section will carry it once posted.
166
+
167
+ ## License
168
+
169
+ MIT, see [LICENSE](LICENSE).
@@ -0,0 +1,65 @@
1
+ [project]
2
+ name = "certflow"
3
+ version = "1.0.1"
4
+ authors = [{name = "Krishi Attri", email = "krishiattriwork@gmail.com"}]
5
+ license = {text = "MIT"}
6
+ description = "Certified route planning under drifting costs: conformal LB<=OPT<=UB certificates, certificate-directed sensing, proof-gated preprocessing"
7
+ readme = "README.md"
8
+ requires-python = ">=3.10"
9
+ keywords = [
10
+ "route-planning",
11
+ "conformal-prediction",
12
+ "path-planning",
13
+ "uncertainty-quantification",
14
+ "robotics",
15
+ "d-star-lite",
16
+ "contraction-hierarchies",
17
+ "operations-research",
18
+ ]
19
+ classifiers = [
20
+ "Development Status :: 5 - Production/Stable",
21
+ "Intended Audience :: Science/Research",
22
+ "License :: OSI Approved :: MIT License",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Topic :: Scientific/Engineering",
28
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
29
+ ]
30
+ dependencies = [
31
+ "numpy>=1.24",
32
+ "scipy>=1.10",
33
+ ]
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/Archerkattri/CERT-FLOW"
37
+ Repository = "https://github.com/Archerkattri/CERT-FLOW"
38
+ Documentation = "https://github.com/Archerkattri/CERT-FLOW/tree/main/docs"
39
+ Issues = "https://github.com/Archerkattri/CERT-FLOW/issues"
40
+
41
+ [project.optional-dependencies]
42
+ fast = ["numba"]
43
+ dev = ["pytest>=7.0"]
44
+
45
+ [build-system]
46
+ requires = ["hatchling"]
47
+ build-backend = "hatchling.build"
48
+
49
+ [tool.hatch.build.targets.wheel]
50
+ packages = ["src/certflow"]
51
+
52
+ [tool.hatch.build.targets.sdist]
53
+ include = [
54
+ "src/certflow",
55
+ "tests",
56
+ "README.md",
57
+ "LICENSE",
58
+ "CITATION.cff",
59
+ "CHANGELOG.md",
60
+ "pyproject.toml",
61
+ ]
62
+
63
+ [tool.pytest.ini_options]
64
+ pythonpath = ["."]
65
+ testpaths = ["tests"]
@@ -0,0 +1,40 @@
1
+ """CERT-FLOW: certified route planning under drifting costs.
2
+
3
+ Every replanning round emits a high-probability certificate LB <= OPT <= UB
4
+ on the optimal route cost, built from age-weighted non-exchangeable conformal
5
+ prediction over drift-adjusted observation residuals, and directs paid sensing
6
+ at the edges that shrink the certified gap fastest.
7
+
8
+ Quickstart::
9
+
10
+ from certflow import CertPlanner, PlannerConfig
11
+ from certflow.drift import grid_world
12
+
13
+ world = grid_world(6, 6, seed=0, kind="bounded", rho=0.02, noise_scale=0.05)
14
+ planner = CertPlanner(world, (0, 0), (5, 5),
15
+ PlannerConfig(epsilon=5.0, alpha_prime=0.2))
16
+ for _ in range(150):
17
+ cert, sensed = planner.round()
18
+ print(cert.lb, cert.ub, cert.confidence)
19
+
20
+ Submodules: conformal (quantile machinery), cert (the planner loop), sensing
21
+ (observation selection), fastgraph (flat-array engine), snapshot / ch
22
+ (certificate-gated preprocessing), drift / realworld / movingai / roadnet
23
+ (worlds and graphs), harness / episodes / oracle (experiment infrastructure).
24
+ """
25
+ from certflow.cert import CertPlanner, PlannerConfig
26
+ from certflow.conformal import ACITracker, ConformalScorer
27
+ from certflow.types import Certificate, EdgeBelief, World
28
+
29
+ __version__ = "1.0.1"
30
+
31
+ __all__ = [
32
+ "ACITracker",
33
+ "CertPlanner",
34
+ "Certificate",
35
+ "ConformalScorer",
36
+ "EdgeBelief",
37
+ "PlannerConfig",
38
+ "World",
39
+ "__version__",
40
+ ]