Repository navigation
coph_golden: G13, two car learners on an open field (C5, part 2) - #203
Merged
Merged
Conversation
G13 pins the cars controller's learner (grl_snam.ariadne.coph_cars.CarLearner, demo 2b) under the demos' runner, as G12 does the crossing's: two agents for 120 ticks on CooperativeWorld (two disks and a risk patch between them), communication on, G12's rational sensor noise and recorded bootstrap draws. A car's learner is a bare CooperativeLearner whose stages follow it in any direction. It routes with the profile's own planner (navigation.route: A* through its sensor footprints on a 0.1 m grid), since a car's world has no surveyed network, and its packets have no maze or terrain layers. libcvc's fleet driver (C5 part 2) runs this learner, and G13 is what it reproduces. Both cars reach their goals without a hit. Each replans 33 times through frontier routes, cached waypoints and the direct goal; some controls are projected around the disks; packets arrive eligible (13) and unsupported (4); one car rejects two updates. Decisions are BIT and survive a 1e-9 nudge of the damping; positions are FLOAT64 at atol 1e-6. The tests rebuild the positions from the forces, check that every planned route steps between 8-neighbours of the grid, check the coverage, and check that last bits pass and real changes fail.
staggered_demo.execute staggers its two agents' starts by default (start_seconds [0, 5]); G12's spec sets [0, 0] and G13's did not, so its second car started 5 s late. A fleet of cars starts together, and libcvc's coph_fleet runs agents that start together, so G13 now sets start_seconds [0, 0]. Both cars still reach their goals without a hit, each replanning 33 times; packets arrive eligible (20) and unsupported (8), and each car rejects one update. The decisions survive the 1e-9 nudges, and the 37 golden tests pass, including the byte-for-byte regeneration. Only the cars section of the fixture changes.
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.
G13 for libcvc's CoPH golden (
NAV-COPH-ROADMAP.md§4.5, C5 part 2): the cars controller's learner under the demos' runner, which libcvc's fleet driver will reproduce.Why a new case
G12 pins the crossing's
CrossingLearner, which plans on the maze's surveyed network. A car's learner (grl_snam.ariadne.coph_cars.CarLearner, demo 2b) is different in three ways the C++ driver needs pinned:CooperativeLearnerwhose stages follow it in any direction (MazeLearner's advance rule);navigation.route: A* through its sensor footprints on a 0.1 m grid, since a car's world has no network;CooperativeLearner's, with no maze or terrain layers.What G13 is
grl_snam/tools/coph_golden_cars.py, written intocoph_golden.jsonascarswith its rules incars_rules.CarLearners for 120 ticks understaggered_demo.execute(armreciprocal_fixed), communication on, as in G12.CooperativeWorld, an open field with two disks and a risk patch between the agents. Both cars start at 0 s (start_seconds[0, 0]), as a fleet of cars does; the runner's default staggers them. The sensor noise is G12's rational pattern, and each sent packet's bootstrap draws are recorded for injection (D8).Every other section of the fixture is unchanged; only
carsandcars_rulesare added (blob41fd3f90, 1.34 MB).Tests
Locally (Windows, torch 2.8.0+cpu): the 37 golden tests pass, including the byte-for-byte regeneration; black and ruff are clean.
transfix/libcvc#1460 reproduces G13: every decision matches, and positions agree within 5.6e-16.