Repository navigation
nav: a golden for the per-step energy books, for GRL-SNAM's torch twin - #849
Merged
Merged
Conversation
NavPotential.BooksGolden writes or checks tests/data/nav_energy_books_golden.json (CVC_NAV_ENERGY_BOOKS_GOLDEN_WRITE=1), the values GRL-SNAM's torch twin of book_step, energy_residual_bound and the material surrogate's books is held to: - bound: energy_residual_bound on a sweep, mass and kappa_H included (double). - clamp: a diff::surr_step rollout whose vmax clamp cuts every step, booked per step as ClampWorkClosesTheBooks books it: the states, book_step's arguments and its books (double). - sharp: the material surrogate with a port force and the sharp check, every book rollout_energy has; agent 2 stops early, so its frozen steps book zero. - unlogged: the same rollout at dt 0.002 under a strong port force: booked, every step closes within the bound; left out, every step alarms. The material sections use a linear patch, whose gradient channels are its values' gradients. On NavPotential.Golden's curved patch a step books the gap between the force and -grad U, work of order dt, which nearly fills the bound at dt 0.002. NavPotential.Golden's surrogate setup moves into a shared fixture, and its golden is unchanged. The build reproduces the file to 1e-6 relative: of max(1, |x|) for states, potentials and kinetic energies (as NavPotential.Golden), and of max(|x|, the step's bound) for the books. Measured: clamp |r_E - r_hat_E|/bound <= 1.1e-3; sharp <= 1.0e-2 at dt 0.05; unlogged, smallest |r_E + W_port|/bound 6.6.
transfix
enabled auto-merge (squash)
October 28, 2026 00:30
transfix
added a commit
to CVC-Lab/GRL-SNAM
that referenced
this pull request
Oct 28, 2026
…he sharp check (#139) The torch twin of libcvc's per-step energy books for the navigator's point-mass surrogate (the white paper's Eq. 38; transfix/libcvc#832), held to libcvc's nav_energy_books_golden.json (transfix/libcvc#849). - nav_potential.book_step (StepBooks) and energy_residual_bound: libcvc's book_step, with the cheap bound and, given vHv, the sharp check r_hat_E. - nav_potential.material_energy: U and the material surrogate's conservative force in any dtype, libcvc's detail::material_energy<double>. - integrate_surrogate_material: energy={"books": True} (or "sharp": True) also fills kinetic, w_damp, w_port, w_clamp, w_cross, residual, bound (and residual_sharp), float64 and detached, booked from the rollout's state in float64 as libcvc does. The rollout's outputs are unchanged. tests/test_nav_energy_books_parity.py: book_step and the bound bit for bit on libcvc's arguments (DOUBLE tier); the clamped surr_step rollout's books to 2e-5 of the step's bound (measured 1.1e-6), and the material surrogate's to 1e-5 (measured 8.3e-8) (FLOAT tier); the unlogged port raises the alarm at every step, as in libcvc; r_E is second order, and the sharp check meets r_E on a quadratic potential.
This was referenced Oct 28, 2026
transfix
added a commit
that referenced
this pull request
Oct 28, 2026
The project version and the cvcpkg recipe family move to 3.7.2. Every recipe is at cvc_revision 1 already, so none restarts. 3.7.2 carries the dynamic plants on the terrain and in a Jolt world, and the four-wheel plant (#869): --plant dynamic and dynamic4w drive the ground, collide with the buildings and each other, and book the collisions. It also carries dyn_4w's port-Hamiltonian form (#850), dyn_bike's wheel-frame front slip (#852), the books goldens for GRL-SNAM's twins (#848, #849), pycvc's drive telemetry (#857) and keep-alives (#864), the macOS SDK's openssl (#846), and the state_exec scheduler and evaluator work (#842, #843, #844, #861, #863).
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.
Adds
NavPotential.BooksGoldenandsrc/cvc/tests/data/nav_energy_books_golden.json. This is the golden that GRL-SNAM's torch twin of the per-step energy books (#832) is held to:book_step,energy_residual_bound, and the booksintegrate_surrogate_materialfills.It is a separate file, so
nav_potential_golden.jsonand GRL-SNAM'stest_nav_potential_parity.pyare untouched.CVC_NAV_ENERGY_BOOKS_GOLDEN_WRITE=1rewrites it.Sections:
energy_residual_boundon a sweep, with mass and kappa_H varied (double).diff::surr_steprollout whose vmax clamp cuts every step, on ClampWorkClosesTheBooks' wall. Each step is booked as that test books it. The golden stores the states,book_step's arguments and its books (double), so the twin'sbook_stepcan be checked exactly.rollout_energyhas. Agent 2 stops early, so its frozen steps book zero.The material sections use a linear patch, whose gradient channels are its values' gradients. On NavPotential.Golden's curved patch, each step books the gap between the force and -grad U, which is work of order dt. At dt 0.002 that gap alone nearly fills the bound (|r_E|/bound 0.9965), so it would hide the integrator's own residual. NavPotential.Golden's surrogate setup moves into a shared fixture; its golden is unchanged and still passes.
Tolerance: 1e-6 relative.
Measured (MSVC 14.44 Release;
nav_potential_test16 -> 17 tests, all pass):