Repository navigation
Nav: train on the Jolt Humvee through the four-wheel pH model's gradient (P1-P3) - #940
Merged
Merged
Conversation
rollout_kind::jolt drives the training rollout's forward in Jolt (the Humvee through nav_plant's driver model, the scene's walls in the world, one copy of the scene per agent) and takes its gradient from dyn_4w's port-Hamiltonian model evaluated at the states Jolt reached, with the model's books calibrated to Jolt's energy ledger. - P1: nav_plant::ledger_step (each tick's vehicle_energy lines, energy_lines in vehicle.h) and nav_plant::save/restore (world::save plus the agents' state), which replays a run bit for bit. - P2: calibrate_dyn4 (nav/dyn4_ledger.h) fits the model's drive (new dyn4_params drive_gain, brake_gain, resist_comp; defaults step bit for bit), drive lag and tire stiffness to Jolt's one-tick motion, its drag, rolling and dampers to Jolt's ledger lines, and the source's price of its port to what Jolt's fuel paid. dyn4_ph_lines splits the pH rates as the ledger does. - P3: the rollout_plant seam (nav/rollout_plant.h), physics::jolt_rollout, the Jolt window in coef_trainer, record_plant_ticks, and the start clearance. Measured: held-out books close (dissipation -10.5%, fuel +3.5%); the gradient matches Jolt's central differences within 5-7% on alpha, beta and gamma and 1.26x along the gradient; 25 steps on Jolt lower the loss 1.2344 -> 1.2321.
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.
Training on the Jolt Humvee.
rollout_kind::joltruns the training rollout's forward in Jolt and takes the gradient from dyn_4w's port-Hamiltonian model, evaluated at the states Jolt reached:The model's books are calibrated to Jolt's energy ledger first. Jolt is on the forward path and is never differentiated. This is phases P1–P3 of the plan in the libcvc workstream. It partly reverses cvc-engagement-docs doc 31 D2 ("Jolt is never on the gradient path"); that doc change is a follow-up.
P1: the ledger a tick, and replay
nav_plant::ledger_step(i): agent i'svehicle_energyover the last tick, computed byenergy_lines(vehicle.h) from the ledger at the tick's start and end. The lines balance as the ledger does and sum to it.nav_plant::save()/restore():world::saveplus each agent's command, energy, contacts, sample and drift, and the drift summary. A restored run continues bit for bit. A state of other agents or another world is refused, and nothing changes.P2: the four-wheel model calibrated to Jolt's ledger (
nav/dyn4_ledger.h)dyn4_ph_lines_atsplits the pH power the way the ledger does: port, tire, drag, rolling, damper.dyn4_paramsfieldsdrive_gain,brake_gainandresist_compdescribe how the drive answers a command. Their defaults leave the plant bit for bit as before.calibrate_dyn4fits the model in three parts:dyn4_books_ofreports the books on held-out runs.P3: the rollout
nav/rollout_plant.his the seam, since nav cannot depend on physics. It holds therollout_plantinterface anddyn4_rollout_plant, the model itself, which serves as the exact twin for gradchecks.physics::jolt_rolloutbuilds one world per batch:nav_plantdriving each vehicle through the driver model;dyn4_state, and its ledger mapped onto the model's lines;coef_trainer, the window steps all agents together in Jolt, and the backward isdyn4_bike_step_bwdat Jolt's states. Withw_energy, the term's value is Jolt's fuel and its gradient goes through the calibrated port.record_plant_ticks,bike_veh_of, andtrain_config::start_clearance, which defaults to half a wheelbase on this rollout and to 0 elsewhere, as before.Measured
Windows MSVC Release; the Humvee on the trainer's city at about 0.106 normalized units per metre.
The gradient check starts from vehicles already moving. From rest, a short window changes the loss less than Jolt's float arithmetic does, so a check there shows only noise.
Tests
physics_jolt_rollout_test(6 tests).nav_coef_train_test: three new tests (model-plant gradcheck, guards, calibration recovery).nav_dyn_4w_test: power lines against the rates; the drive's answer.nav_plant_test: ledger lines balance; save/restore replays bit for bit.Docs
Next
--rollout jolt.