Repository navigation
grl_snam.coph: CoPH-Stagewise vendored at c1f1ff3; both demos reproduce upstream exactly - #166
Merged
Merged
Conversation
The modules the crossing and hazard demos reach at run time, unmodified, so the next commit's trims and local changes show as a diff against upstream.
- CooperativeLearner subclasses Learner; the InstrumentedLearner hooks become the optional diagnostics.Instrumented mixin. - route_field imports terrain_warning lazily. - Receiver modes other than legacy are refused (receiver_fitting is not vendored); _receiver_acceptance short-circuits exactly as receiver_fitting.acceptance does for a legacy receiver. - Six glue modules keep only the definitions the demos reach. - results.py writes results.json, rows.json and REPORT.md in place of upstream's figure modules; hazard_demo gains --steps and --seeds. - VENDORED.md records the commit, the module list, every local change and the measured gate.
black and ruff skip the vendored files, which keep upstream's formatting.
tests/coph holds 12 upstream test files, trimmed where they reach modules that are not vendored. tests/test_coph.py runs both demos at a short horizon through the CLI, pins the crossing smoke to numbers upstream's code produces at the same horizon, and checks the two untanglings.
Linux CI measured one_way_01 at 80817-80834 bytes against Windows' 79488, with the paths equal to 1e-6. The first export's covariance is round-off (8 identical bootstrap members), and whether np.cov prints exact zeros or ~1e-35 residues depends on numpy's summation order, which moves the packet's compact-JSON size. The smoke now pins each arm's packets (sender, support points, anchors, sources), deliveries and geometry events, and VENDORED.md notes the finding for the goldens.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is T1 of libcvc's CoPH roadmap (transfix/libcvc#1108 and transfix/libcvc#1111,
docs/roadmap/NAV-COPH-ROADMAP.md§3.1). It copies the CoPH-Stagewise core and the crossing and hazard demos from SetasAditya/CoPH-Sense atc1f1ff3intogrl_snam.coph. The copied demos reproduce upstream's numbers exactly. T3 (demo 2a on Ariadne) and T5 (the goldens) build on this.Usage:
grl-snam coph crossing|hazard --out DIR [--seeds N] [--steps N] [--workers N] [--summary-only]. A run writes its episodes, a manifest with the oracle predictions frozen before any episode ran,results.jsonandREPORT.md.The numbers gate
Measured on this branch on Windows 11, with cvcpkg's Python 3.12.10, torch 2.8.0 (CPU) and numpy 2.4.6. That is the stack upstream's own reproduction ran on (2026-11-09).
Crossing (23.6 min, 8 workers): 16/16 goals and 0 collisions.
Hazard (17.8 min, 12 workers): 64/64 goals and 0 collisions. The carrier's worst-case excess cost:
Exact. All 40 episode files (8 crossing, 32 hazard) equal those in upstream's
results/{crossing,hazard}_reproduction/field for field, apart from wall-clock timings. The crossingrows.jsonand report tables match upstream's line for line. Another build was using about half the box's cores during the runs, so the times are not benchmarks.What is copied
There are 25 of upstream's 120 modules;
grl_snam/coph/VENDORED.mdlists them all.model,records,learner,navigation,stage_prediction,replay_budget,world,scenarios,shapes,maze_geometry,maze_learning,terrain_warning,sharing,route_oracleandhazard_oracle.cooperative,route_field,crossing_demoandhazard_demo.staggered_demo(the runner),cooperative_evaluation,maze_family,diagnostics,evaluationandcli.The roadmap estimated about 15 modules. It took 25 because the demos call into
staggered_demo,maze_family,terrain_warning,sharinganddiagnosticsat run time. Reporting, campaigns, figures, diagnostics suites and the other demos stay out. So do the only scipy users. The package needs only torch, numpy and matplotlib.The first commit is the verbatim copy, so the second commit's diff shows exactly what changed locally.
Local changes
Each change carries a
grl_snam.coph:comment in the code.CooperativeLearnernow subclassesLearner. TheInstrumentedLearnerhooks became the optionaldiagnostics.Instrumentedmixin. The demos never read the hooks, so results are unchanged.route_fieldimportsterrain_warninglazily.NotImplementedError, becausereceiver_fittingis not vendored._receiver_acceptanceshort-circuits exactly asreceiver_fitting.acceptancedoes for a legacy receiver.evaluate_packetis removed.crossing_demoandhazard_demowriteresults.json,rows.jsonandREPORT.mdthrough the newresults.pyinstead of upstream's figure modules.results.pycopiescrossing_visuals' metric functions, so the saving arithmetic is upstream's.hazard_demogains--stepsand--seeds.source_hashesandarchive_sourcescovergrl_snam/coph.__init__.py,results.pyand the CLI.Tests and CI
tests/coph/has 12 upstream test files (92 tests), trimmed where they reach modules that are not vendored.VENDORED.mdlists every removed or edited test. Upstream's other 31 test files test modules that stay out.tests/test_coph.pyruns both demos through the CLI at a short horizon.np.covreturns exact0.0or ~1e-35 residues (22 characters each) depends on numpy's summation order. Locally, the same 8 rows give 112 or 132 exact zeros and packets 380 bytes apart.VENDORED.mdnotes this for the goldens: roadmap G9 hasbytes()as BIT.black --checkandruff checkare clean. Under coverage, the tests cover 88.2% ofgrl_snam/coph's 2,493 statements. Main is at 90.3% of 9,580, so the total should stay near 90% against the 80% gate.Open questions
c1f1ff3, andVENDORED.mdhas the steps for re-syncing.c1f1ff3. The MIT basis is the authors' confirmation of 2026-11-09, asVENDORED.mdrecords. A LICENSE file upstream would make that checkable.