Repository navigation
coph_golden: G5-G8, the learner's field fit, damping fit, replay and update (C3, part 1) - #195
Merged
Merged
Conversation
…update (C3) grl_snam.tools.coph_golden_learner adds libcvc C3's cases (NAV-COPH-ROADMAP §4.3, §5) to coph_golden.json, at three update snapshots of a scripted crossing run of the demos' learner (CrossingLearner): - G5: Learner._field_fit's normal equations, block by block, its weights and covariance. - G6: _fit_damping's Newton iterates and update's clipped proposal. - G7: stage_prediction.retained_replay for 6 policies per snapshot on the fitted weights and damping: cost, gradient, the plan, eligibility, handoffs, each routed control and the paths. - G8: the update's validation numbers and margins, the policy step and its attempts, accept or reject and its reason, and what is committed or rolled back. The run is scripted so its inputs are the same bytes on every OS: the plant is the exact flow in plain Python, and each update's committed values are rounded to 2^-24. Every update's and replay's decisions are checked against copies nudged by 1e-12 relative, and observe's geometry decisions are kept away from their thresholds, as in G4. One update is rejected (validation_or_feasibility, 0.0062 beyond the slack) and two are accepted. The tests rebuild G5, G6 and G8 from the rules in plain Python and G7's cost from its trace, and check that the learner rebuilt from a snapshot's inputs alone reproduces G5-G8. The committed G3 bits are kept: main's own generator now writes one bound 1 ulp off them on Windows, within tier.
transfix
added a commit
to transfix/libcvc
that referenced
this pull request
Nov 20, 2026
…pdate (C3; G5-G8) (#1386) C3 of docs/roadmap/NAV-COPH-ROADMAP.md (§4.3): the update of the demos' own learner (crossing_demo.CrossingLearner) in the profile, in inc/cvc/nav/coph_learner.h. - coph_field_fit: each kept stage's ridge fit (Cholesky on its 16 x 16 system). - coph_fit_damping: Newton steps on the plant loss, on hyper-duals (coph_dual.h). - coph_maze_route and coph_control: the profile's routed controller is MazeLearner's maze router on the surveyed corridor network, then the CBF projection and the corridor guard. - coph_prepare and coph_replay: the supported_boundary plan and budget, and retained_replay; on coph_dual2 one pass gives the cost and d cost / d policy. - coph_update: the fits, the policy step and its halvings, validation, then commit or rollback. coph_model.cpp gains scalar traits for the duals and instantiates the plant, potential and command on them. The golden (data/coph_golden.json) is CVC-Lab/GRL-SNAM#195's, with G5-G8 added; G1-G4 and G11 are unchanged. On Windows nav_coph_learner_test matches every decision, with values within 0.0069 of the tier's allowance (rtol 1e-9, atol 1e-12). nav_coph_test and nav_coph_model_test still pass. The roadmap's §4.3 records what landed, and corrects its routed-controller text: the profile never reaches the route field's anchors.
This was referenced Nov 20, 2026
transfix
added a commit
that referenced
this pull request
Nov 21, 2026
… (C4) (#201) grl_snam.tools.coph_golden_packets adds libcvc C4's cases (NAV-COPH-ROADMAP §4.4, §5) to coph_golden.json, on G5-G8's scripted crossing run: - G9: CrossingLearner.export at the three snapshots, with both block bootstraps' resample indices recorded from the learner's own generators and injected (D8). CooperativeLearner's candidate anchors and TerrainLearner's risk-ordered anchors, each with its ensemble and covariance; H and V_task; and the packet. - bytes() is BIT on each export's wire form: the anchors' values and gradients, the covariance, H and V_task rounded to 2^-24, so the count is the same on every OS. export 0's JSON text is pinned in full, and repr cases pin the float rule. - G10: a receiver (the last snapshot's learner as agent '1') assimilates 37 packets through MazeLearner, TerrainLearner and CooperativeLearner: every reason the three layers give, route evidence only, evictions past the received cap of 8. Then its field fit with the received packets (the whitened Gauss-Newton step) and its update, which accepts with 8 messages. As in G4-G8, generation keeps every norm decision more than 1e-9 from its threshold and checks the receiver's update against nudged copies. The tests rebuild the bootstraps, anchors, covariances and the Gauss-Newton step from the rules in plain numpy, and the sender and receiver from the file's inputs. The committed G3 bits are kept, as in #195.
transfix
added a commit
that referenced
this pull request
Nov 22, 2026
… part 1) (#202) * coph_golden: G9-G10, packets, their byte count and their assimilation (C4) grl_snam.tools.coph_golden_packets adds libcvc C4's cases (NAV-COPH-ROADMAP §4.4, §5) to coph_golden.json, on G5-G8's scripted crossing run: - G9: CrossingLearner.export at the three snapshots, with both block bootstraps' resample indices recorded from the learner's own generators and injected (D8). CooperativeLearner's candidate anchors and TerrainLearner's risk-ordered anchors, each with its ensemble and covariance; H and V_task; and the packet. - bytes() is BIT on each export's wire form: the anchors' values and gradients, the covariance, H and V_task rounded to 2^-24, so the count is the same on every OS. export 0's JSON text is pinned in full, and repr cases pin the float rule. - G10: a receiver (the last snapshot's learner as agent '1') assimilates 37 packets through MazeLearner, TerrainLearner and CooperativeLearner: every reason the three layers give, route evidence only, evictions past the received cap of 8. Then its field fit with the received packets (the whitened Gauss-Newton step) and its update, which accepts with 8 messages. As in G4-G8, generation keeps every norm decision more than 1e-9 from its threshold and checks the receiver's update against nudged copies. The tests rebuild the bootstraps, anchors, covariances and the Gauss-Newton step from the rules in plain numpy, and the sender and receiver from the file's inputs. The committed G3 bits are kept, as in #195. * coph_golden: G12, an episode of two agents with communication on (C5) grl_snam.tools.coph_golden_episode adds libcvc C5's case (NAV-COPH-ROADMAP section 4.5, 5) to coph_golden.json: the demos' runner (staggered_demo.execute, arm reciprocal_fixed) with two CrossingLearner agents for 60 ticks of the crossing. - The world is CrossingWorld with a fixed rational sensor-noise pattern in place of numpy's draws, so the C++ senses the same readings at its own positions. - In the episode, agent 1 senses the middle door at tick 33 and turns north. Agent 0 learns of it from agent 1's packet at tick 40 and reroutes through the north row. Every update takes the other's packet and accepts. - Decisions are BIT: per tick the stage, version and routed control (reason, route, waypoint, guard steps, route change); per update the packets, attempts and verdict; every send and delivery; and the geometry events. - Positions and forces are FLOAT64 at atol 1e-6. - Each sent packet's bootstrap draws are recorded for the C++ to inject (D8). Generation checks that no decision changes when the world's damping is nudged by 1e-9 relative each way; the decisions hold at 1e-6 too. The tests rebuild each agent's positions from its forces with G2's closed form. The committed G3 bits are kept, as in #195. * coph_golden: G12 traces each update's policy attempts The episode's learners now set decision_tracing, so G12's updates record their policy attempts (power, reason, accepted) as G8's do. Tracing only records: every other decision and value is unchanged.
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.
C3, part 1, of libcvc's
docs/roadmap/NAV-COPH-ROADMAP.md(§4.3, §5): the generator for G5–G8.grl_snam.tools.coph_golden_learneradds the learner's cases tocoph_golden.json, which libcvc's C3 will consume:The run and its three snapshots
One
CrossingLearner(the demos' learner:MazeLearneronTerrainLearneronCooperativeLearneronLearner) runs in the demos' profile and tick order. A script drives it east along the middle row to the door and back. Each case is the update at one tick:near_the_bumpdoor_in_view_rejectedvalidation_or_feasibility): the field validation worsens by 0.0092, against a slack of 0.003back_west_unsupported_entryunsupported_entry; stage 4'ssupported_boundaryhorizon of 18, with a handoff to stage 5 at step 14Per case, the file holds:
updatereads. The rules textlearner_ruleslists it, andcoph_golden_learner.rebuildturns it back into a learner.retained_replayfor six policies on the fitted weights and damping. It records the cost and gradient, the plan, the eligibility, the handoffs, every routed control (reason, route, guard steps, applied force) and the paths.Same bytes on every OS
expandexpm1as fixed Taylor sums. The force and the readings use only+ - * /andsqrt. After each update the script rounds the committed weights, damping, policy and terrain anchors to multiples of 2^-24.--no-checkskips this; the file is the same). Observe's BLAS-dot geometry decisions stay more than 1e-9 from their thresholds, as in G4.outkey are compared at rtol 1e-9, atol 1e-12. Everything else is compared exactly.Tests (
tests/test_coph_golden.py, 22 pass locally)Where the spec met the profile
The routed controller is the maze router. The roadmap's §4.3 says the C++ takes "the route field's anchors". In the demos' profile, a replay step actually runs:
maze_learning.maze_route: Dijkstra on the crossing's surveyed network, with edge costs fromterrain_valuesover the terrain anchors and closures from the reported geometry;navigation.projectwithfast=True;maze_geometry.corridor_clear.So C3 needs those pieces, and their inputs (the network, the reported geometry, the anchors) are in each snapshot.
The design matrix is given as normal equations. With no continuity rows in the profile, the system is block diagonal, so G5 gives each stage's AᵀA + ridge·I and Aᵀy + ridge·w with every row's target, not the rows themselves. That keeps the file small.
G8 never halves. The replay barely depends on the policy here (|∂cost/∂π| ≤ 2.9e-3), so every update accepts its first candidate. No case halves, exhausts the budget or is policy-independent.
The
nonfinitepath can't be reached.MazeLearner.update(x)takes noforce_invalid.No replay control is projected or braked. Once the door is known the maze route turns the replay away before any constraint binds. I also tried sending the carrot to x = 9.1; nothing changed. A direct case set for
navigation.projectand the guard would cover them if C3 wants it.G3 is unchanged in the fixture. On Windows, main's own generator now writes one G3
bound1 ulp off the committed value (within tier), so this PR keeps the committed G3 bits.Cost
Merge is left to Joe. Next: libcvc's C3 (§4.3) consumes this file. It needs the same blob in
src/cvc/tests/data.