Repository navigation
coph_golden: G9-G10, packets, their byte count and their assimilation (C4, part 1) - #201
Merged
Merged
Conversation
… (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.
This was referenced Nov 20, 2026
transfix
added a commit
to transfix/libcvc
that referenced
this pull request
Nov 21, 2026
…1410) C4 of docs/roadmap/NAV-COPH-ROADMAP.md (section 4.4), additive and default-off: nothing calls it yet; C5's fleet driver will. - coph_packet.h: the demos' packet (cooperative.Packet, then MazePacket's geometry), and bytes(): the length of its compact, key-sorted JSON, with Python's repr for floats (coph_repr, from std::to_chars's shortest digits) (D9). coph_exchange_state holds the received packets, the route evidence and its cells, and the reported geometry. - coph_exchange.h: - coph_export: CooperativeLearner's bootstrap and candidate anchors, TerrainLearner's risk-ordered anchors and second bootstrap, MazeLearner's geometry. The resample indices are injected, or drawn from a seeded std::mt19937 through detail::pick_below (D8). - coph_assimilate: MazeLearner's geometry checks; CooperativeLearner's schema, provenance, age, order, payload and received cap; TerrainLearner's route evidence. - coph_expire and the two refreshes. - coph_fit_messages: the legacy receiver's whitened Gauss-Newton step, which coph_update now commits when packets are held. - coph_channel.h: the transport interface and coph_ideal_channel (seeded delay and jitter, drops, duplicates, an optional range). - detail/coph_math.h: the features, Cholesky and slab distance that coph_learner.cpp and coph_exchange.cpp share (moved out of coph_learner.cpp unchanged). nav_coph_exchange_test reproduces GRL-SNAM's G9 and G10 (CVC-Lab/GRL-SNAM#201; data/coph_golden.json is its fixture). Every decision and byte count matches exactly, and the values come within 0.074 of the tier's allowance on Windows. It also checks the channel's statistics, production draws and JSON escapes.
transfix
added a commit
to transfix/libcvc
that referenced
this pull request
Nov 22, 2026
…1413) * nav: CoPH's packets, their assimilation and the channel (C4; G9-G10) C4 of docs/roadmap/NAV-COPH-ROADMAP.md (section 4.4), additive and default-off: nothing calls it yet; C5's fleet driver will. - coph_packet.h: the demos' packet (cooperative.Packet, then MazePacket's geometry), and bytes(): the length of its compact, key-sorted JSON, with Python's repr for floats (coph_repr, from std::to_chars's shortest digits) (D9). coph_exchange_state holds the received packets, the route evidence and its cells, and the reported geometry. - coph_exchange.h: - coph_export: CooperativeLearner's bootstrap and candidate anchors, TerrainLearner's risk-ordered anchors and second bootstrap, MazeLearner's geometry. The resample indices are injected, or drawn from a seeded std::mt19937 through detail::pick_below (D8). - coph_assimilate: MazeLearner's geometry checks; CooperativeLearner's schema, provenance, age, order, payload and received cap; TerrainLearner's route evidence. - coph_expire and the two refreshes. - coph_fit_messages: the legacy receiver's whitened Gauss-Newton step, which coph_update now commits when packets are held. - coph_channel.h: the transport interface and coph_ideal_channel (seeded delay and jitter, drops, duplicates, an optional range). - detail/coph_math.h: the features, Cholesky and slab distance that coph_learner.cpp and coph_exchange.cpp share (moved out of coph_learner.cpp unchanged). nav_coph_exchange_test reproduces GRL-SNAM's G9 and G10 (CVC-Lab/GRL-SNAM#201; data/coph_golden.json is its fixture). Every decision and byte count matches exactly, and the values come within 0.074 of the tier's allowance on Windows. It also checks the channel's statistics, production draws and JSON escapes. * nav: CoPH's agent and fleet, and the crossing world (C5 part 1; G12) C5 part 1 of docs/roadmap/NAV-COPH-ROADMAP.md (section 4.5), additive and default-off. - coph_agent.h: the demos' whole learner (CrossingLearner) over C1-C4. - observe: CooperativeLearner's uids, navigation.observe_geometry's store, C1's ledger, the expiries, MazeLearner's geometry reports. - advance. - action: the routed control in the live navigation context. - update: CooperativeLearner's diagnostic controls around C3's update, then TerrainLearner's own anchors. - export and assimilate, with the received-geometry events. - coph_fleet.h: - coph_fleet: the demos' runner (staggered_demo.execute) for agents that start together, over a coph_channel. Its boundaries observe and advance, export on the update cadence, deliver, update and act. It keeps records and each agent's energy account. - coph_crossing_world: the crossing demo's world, with its plant, its door and corridor hits and its sensing. - C1-C3 gain the hooks it needs: - coph_ledger::commit; - the route change and the raw command in coph_control_meta; - coph_corridor_clear and coph_slab_sweep; - coph_field_vector; - TerrainLearner's local cells in the exchange state. nav_coph_fleet_test reproduces GRL-SNAM's G12 (CVC-Lab/GRL-SNAM#202; data/coph_golden.json is its fixture). Every decision matches, and positions and forces are within 2.8e-16 against an atol of 1e-6. The C++-only tests cover: - refusals outside the profile; - packets arriving after a channel's delay; - a run of the whole crossing, which both agents finish (agent 0 in 92.0 s, the demo's reciprocal finish time) with each energy account's residual at 7e-15. The vehicle driver and the plant_ledger items (D11) are part 2.
transfix
added a commit
to transfix/libcvc
that referenced
this pull request
Nov 23, 2026
* nav: CoPH's packets, their assimilation and the channel (C4; G9-G10)
C4 of docs/roadmap/NAV-COPH-ROADMAP.md (section 4.4), additive and default-off: nothing calls it
yet; C5's fleet driver will.
- coph_packet.h: the demos' packet (cooperative.Packet, then MazePacket's geometry), and bytes():
the length of its compact, key-sorted JSON, with Python's repr for floats (coph_repr, from
std::to_chars's shortest digits) (D9). coph_exchange_state holds the received packets, the
route evidence and its cells, and the reported geometry.
- coph_exchange.h:
- coph_export: CooperativeLearner's bootstrap and candidate anchors, TerrainLearner's
risk-ordered anchors and second bootstrap, MazeLearner's geometry. The resample indices are
injected, or drawn from a seeded std::mt19937 through detail::pick_below (D8).
- coph_assimilate: MazeLearner's geometry checks; CooperativeLearner's schema, provenance, age,
order, payload and received cap; TerrainLearner's route evidence.
- coph_expire and the two refreshes.
- coph_fit_messages: the legacy receiver's whitened Gauss-Newton step, which coph_update now
commits when packets are held.
- coph_channel.h: the transport interface and coph_ideal_channel (seeded delay and jitter, drops,
duplicates, an optional range).
- detail/coph_math.h: the features, Cholesky and slab distance that coph_learner.cpp and
coph_exchange.cpp share (moved out of coph_learner.cpp unchanged).
nav_coph_exchange_test reproduces GRL-SNAM's G9 and G10 (CVC-Lab/GRL-SNAM#201;
data/coph_golden.json is its fixture). Every decision and byte count matches exactly, and the
values come within 0.074 of the tier's allowance on Windows. It also checks the channel's
statistics, production draws and JSON escapes.
* nav: CoPH's agent and fleet, and the crossing world (C5 part 1; G12)
C5 part 1 of docs/roadmap/NAV-COPH-ROADMAP.md (section 4.5), additive and default-off.
- coph_agent.h: the demos' whole learner (CrossingLearner) over C1-C4.
- observe: CooperativeLearner's uids, navigation.observe_geometry's store, C1's ledger, the
expiries, MazeLearner's geometry reports.
- advance.
- action: the routed control in the live navigation context.
- update: CooperativeLearner's diagnostic controls around C3's update, then TerrainLearner's
own anchors.
- export and assimilate, with the received-geometry events.
- coph_fleet.h:
- coph_fleet: the demos' runner (staggered_demo.execute) for agents that start together, over
a coph_channel. Its boundaries observe and advance, export on the update cadence, deliver,
update and act. It keeps records and each agent's energy account.
- coph_crossing_world: the crossing demo's world, with its plant, its door and corridor hits
and its sensing.
- C1-C3 gain the hooks it needs:
- coph_ledger::commit;
- the route change and the raw command in coph_control_meta;
- coph_corridor_clear and coph_slab_sweep;
- coph_field_vector;
- TerrainLearner's local cells in the exchange state.
nav_coph_fleet_test reproduces GRL-SNAM's G12 (CVC-Lab/GRL-SNAM#202; data/coph_golden.json is its
fixture). Every decision matches, and positions and forces are within 2.8e-16 against an atol of
1e-6. The C++-only tests cover:
- refusals outside the profile;
- packets arriving after a channel's delay;
- a run of the whole crossing, which both agents finish (agent 0 in 92.0 s, the demo's
reciprocal finish time) with each energy account's residual at 7e-15.
The vehicle driver and the plant_ledger items (D11) are part 2.
* nav: CoPH's cars' learner, the profile's router (C5 part 2a; G13)
C5 part 2a of docs/roadmap/NAV-COPH-ROADMAP.md (section 4.5), additive and default-off. A car carries
the cars controller's learner (GRL-SNAM's CarLearner, demo 2b), not the crossing's: a bare
CooperativeLearner whose stages advance by MazeLearner's rule, routing with the profile's own planner
since a car's world has no surveyed network, and sending packets without maze or terrain layers.
- coph_learner.h:
- coph_profile_route and coph_edge_clear port navigation.route without a maze graph: A* through
the sensor footprints on a 0.1 m grid, with edges priced by the stages' risk, replanning on
stagnation, the update cadence, a blocked waypoint or a newly sensed disk.
- coph_control dispatches on the learner's network: an empty one takes the profile's router
and drops the guard's corridor checks.
- Each kept stage keeps its entry context, from which the replay and the pilot start.
- coph_agent with an empty network runs CooperativeLearner on Learner: no geometry reports, no
terrain anchors, and CooperativeLearner's packet (coph_packet::maze false: no geometry keys in
its JSON).
- coph_can_export: whether an export makes a packet, so the fleet asks a draw source only then.
- coph_crossing_world with no network and risk patches is CooperativeWorld's open field.
nav_coph_cars_test reproduces GRL-SNAM's G13 (CVC-Lab/GRL-SNAM#203; data/coph_golden.json is its
fixture). Every decision matches, including each planned route and every delivery, and positions
are within 5.6e-16 against an atol of 1e-6. G1 to G12 are unchanged.
The vehicle driver on sim_world and the plant_ledger items (D11) are part 2b.
* nav: CoPH drives a sim_world's vehicles (C5 part 2b)
C5 part 2b of docs/roadmap/NAV-COPH-ROADMAP.md (section 4.5), additive and default-off:
coph_driver, the twin of GRL-SNAM's cars controller (T4), outside sim_world as route_follower is
(D10).
- coph_driver.h: attach agents, then apply() before each sim step.
- Every ticks_per_step() ticks (0.12 sqrt(s) over veh.dt; D6) a CoPH step: each car's state in
CoPH's frame (Froude scaling, D4), its local goal 30 m along the line (D12), its readings of
the material plane's risk at CoPH's 21 sensor points, and the occupied cells within the
scaled sensor radius as disks (visible_obstacles). Then the fleet's boundary.
- Every tick each car allocates its held force (coph_allocate) and drives through
override_command; a car that has arrived brakes.
- Each car's ledger in CoPH's frame: the work of the force it took, its own kinetic change, the
closed-form heat, their residual, the unallocated work, the risk cost and the allocation
residual.
- coph_fleet::input gains the force the plant took (the transition carries it, D5), the world's
arrival, and a new goal; coph_agent and coph_ledger gain set_goal.
nav_coph_driver_test (C++ only):
- with nothing attached, a 400-tick run is byte-unchanged;
- CoPH's cadence under Froude scaling, and the refusals;
- two RoboRacer-sized cars (s = 1) pass each other across a 20 m field and both arrive in 29.1 s,
with packets between them (allocation residuals 0.11 and 0.20);
- a car driving head-on at a block it senses late stops 0.21 m short and never touches it.
G1 to G13 are unchanged. The plant_ledger items (D11) are part 2c.
* CophDriver.ABlockSensedLateIsNeverHit ends once the car has stood still for 6 s
The car stops 0.21 m short of the block at about tick 250 and stays there, but the run went on to
its 1500-tick cap: 10.2 s in Release, about 3.2 times the two-car crossing. That was more than the
300 s a PR's Debug ctest allows on the slow runner of #1461's first run, and more than the 900 s
the executable now has.
The run now also ends after 100 ticks (6 s) with the car's speed under 1e-3. It ends at tick 347
with the same result as before: at (10.71, 5.85), 0.21 m from the block at its closest, the last
control brake (no_start_connector), allocation residual 0.557. 2.0 s in Release on Windows.
transfix
added a commit
to transfix/libcvc
that referenced
this pull request
Nov 23, 2026
) * nav: CoPH's packets, their assimilation and the channel (C4; G9-G10) C4 of docs/roadmap/NAV-COPH-ROADMAP.md (section 4.4), additive and default-off: nothing calls it yet; C5's fleet driver will. - coph_packet.h: the demos' packet (cooperative.Packet, then MazePacket's geometry), and bytes(): the length of its compact, key-sorted JSON, with Python's repr for floats (coph_repr, from std::to_chars's shortest digits) (D9). coph_exchange_state holds the received packets, the route evidence and its cells, and the reported geometry. - coph_exchange.h: - coph_export: CooperativeLearner's bootstrap and candidate anchors, TerrainLearner's risk-ordered anchors and second bootstrap, MazeLearner's geometry. The resample indices are injected, or drawn from a seeded std::mt19937 through detail::pick_below (D8). - coph_assimilate: MazeLearner's geometry checks; CooperativeLearner's schema, provenance, age, order, payload and received cap; TerrainLearner's route evidence. - coph_expire and the two refreshes. - coph_fit_messages: the legacy receiver's whitened Gauss-Newton step, which coph_update now commits when packets are held. - coph_channel.h: the transport interface and coph_ideal_channel (seeded delay and jitter, drops, duplicates, an optional range). - detail/coph_math.h: the features, Cholesky and slab distance that coph_learner.cpp and coph_exchange.cpp share (moved out of coph_learner.cpp unchanged). nav_coph_exchange_test reproduces GRL-SNAM's G9 and G10 (CVC-Lab/GRL-SNAM#201; data/coph_golden.json is its fixture). Every decision and byte count matches exactly, and the values come within 0.074 of the tier's allowance on Windows. It also checks the channel's statistics, production draws and JSON escapes. * nav: CoPH's agent and fleet, and the crossing world (C5 part 1; G12) C5 part 1 of docs/roadmap/NAV-COPH-ROADMAP.md (section 4.5), additive and default-off. - coph_agent.h: the demos' whole learner (CrossingLearner) over C1-C4. - observe: CooperativeLearner's uids, navigation.observe_geometry's store, C1's ledger, the expiries, MazeLearner's geometry reports. - advance. - action: the routed control in the live navigation context. - update: CooperativeLearner's diagnostic controls around C3's update, then TerrainLearner's own anchors. - export and assimilate, with the received-geometry events. - coph_fleet.h: - coph_fleet: the demos' runner (staggered_demo.execute) for agents that start together, over a coph_channel. Its boundaries observe and advance, export on the update cadence, deliver, update and act. It keeps records and each agent's energy account. - coph_crossing_world: the crossing demo's world, with its plant, its door and corridor hits and its sensing. - C1-C3 gain the hooks it needs: - coph_ledger::commit; - the route change and the raw command in coph_control_meta; - coph_corridor_clear and coph_slab_sweep; - coph_field_vector; - TerrainLearner's local cells in the exchange state. nav_coph_fleet_test reproduces GRL-SNAM's G12 (CVC-Lab/GRL-SNAM#202; data/coph_golden.json is its fixture). Every decision matches, and positions and forces are within 2.8e-16 against an atol of 1e-6. The C++-only tests cover: - refusals outside the profile; - packets arriving after a channel's delay; - a run of the whole crossing, which both agents finish (agent 0 in 92.0 s, the demo's reciprocal finish time) with each energy account's residual at 7e-15. The vehicle driver and the plant_ledger items (D11) are part 2. * nav: CoPH's cars' learner, the profile's router (C5 part 2a; G13) C5 part 2a of docs/roadmap/NAV-COPH-ROADMAP.md (section 4.5), additive and default-off. A car carries the cars controller's learner (GRL-SNAM's CarLearner, demo 2b), not the crossing's: a bare CooperativeLearner whose stages advance by MazeLearner's rule, routing with the profile's own planner since a car's world has no surveyed network, and sending packets without maze or terrain layers. - coph_learner.h: - coph_profile_route and coph_edge_clear port navigation.route without a maze graph: A* through the sensor footprints on a 0.1 m grid, with edges priced by the stages' risk, replanning on stagnation, the update cadence, a blocked waypoint or a newly sensed disk. - coph_control dispatches on the learner's network: an empty one takes the profile's router and drops the guard's corridor checks. - Each kept stage keeps its entry context, from which the replay and the pilot start. - coph_agent with an empty network runs CooperativeLearner on Learner: no geometry reports, no terrain anchors, and CooperativeLearner's packet (coph_packet::maze false: no geometry keys in its JSON). - coph_can_export: whether an export makes a packet, so the fleet asks a draw source only then. - coph_crossing_world with no network and risk patches is CooperativeWorld's open field. nav_coph_cars_test reproduces GRL-SNAM's G13 (CVC-Lab/GRL-SNAM#203; data/coph_golden.json is its fixture). Every decision matches, including each planned route and every delivery, and positions are within 5.6e-16 against an atol of 1e-6. G1 to G12 are unchanged. The vehicle driver on sim_world and the plant_ledger items (D11) are part 2b.
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.
C4 part 1 of libcvc's
docs/roadmap/NAV-COPH-ROADMAP.md: the G9 and G10 goldens (§4.4, §5) that libcvc's C4 will reproduce. libcvc C4 (coph_packet,bytes(), the bootstrap,assimilate,coph_channel) follows as its own PR and commits this fixture as itsdata/coph_golden.json.What lands
grl_snam.tools.coph_golden_packetswrites apacketssection and itspacket_rules. Both run on G5–G8's scripted crossing run, which is now simulated once and shared (coph_golden_learner.simulate).G9,
packets.exports.CrossingLearner.exportat the three snapshots (ticks 64, 96 and 112).Injected indices (D8). Both block bootstraps' resample indices are recorded from the learner's own generators and injected back.
Two export layers. The demos' learner exports twice over:
CooperativeLearneranchors at four candidates around the agent;TerrainLearnerthen replaces them with the four riskiest supported readings and a second bootstrap.G9 records both: the ensembles, anchors and covariances, plus H, V_task and the packet (a
MazePacket, with the geometry reports).bytes()is BIT on the wire packet (D9). Every export bootstraps from 4–6 time blocks, so no covariance is pure round-off. But an entry's last bits still change its shortestrepr, and with it the JSON length. So G9 records each packet's wire form: the anchors' values and gradients, the covariance, H and V_task rounded to 2^-24, as G5–G8 round what an update commits. The byte counts are 7,567, 10,834 and 10,659.packets.jsonpins export 0's JSON text in full.packets.reprpins Python's float rule.G10,
packets.assimilate. A receiver, the tick-112 learner as agent'1'with its readings relabelled, assimilates 37 packets in order throughMazeLearner,TerrainLearnerandCooperativeLearner:incompatible_geometry,invalid_geometry,incompatible_convention,returned_evidence,wrong_recipient,invalid_provenance,invalid_age,duplicate_or_reordered,invalid_payload,invalid_supportandinvalid_remote_support, plus both route scopes.After that it records:
Determinism
numpy.linalg.normdecision more than 1e-9 from its threshold. These are the anchor support and spacing, the route support and the geometry gap.outthey are FLOAT64 at rtol 1e-9, atol 1e-12. Everything else is BIT, including the wire packets, the reasons and the bytes.Tests
tests/test_coph_golden.pyadds 8 tests:bytes(), export 0's JSON text, and the repr cases.The regenerate test now also compares
packets. On Windows (cp312, torch 2.8), the golden and CoPH test files pass in full (35 tests), and black and ruff are clean.The committed G3 bits are kept, as in #195. The fixture grows from 931 KB to 1.23 MB.
Merge is left to Joe.