Repository navigation
tolerance table: rows for #1002's jump-mend constants, with measured pins, and the ratchet reads them (#2150) - #2153
Merged
Merged
Conversation
The integrator's dense and colored difference-quotient Jacobians read kFdJumpRatio, kFdJumpNoise and kFdJumpParked from fd_jacobian.hpp, and none had a row. Each now has one, with its pin measured by moving it, rebuilding and running the mend's 1,277 tests: the ratio is pinned both ways, loosely, to (1, 1e8); the floor against a rise past 1e7 and the parked share against a rise past 0.1, with nothing holding either from below, as PR #1302's variants found. The ratchet reads fd_jacobian.hpp from the mend's banner on (INTEGRATOR_PARTS), so a constant added to the mend, whatever its name, needs its row, while the steady-state step rule above it stays outside. The contract's British spellings become American.
The ratio row says which tests fail at 1 and 1e8, not why; the prose's passing range is the values tried. A constant named kFdJump... declared above the mend's banner fails the ratchet as well (INTEGRATOR_PART_NAMES).
kFdJumpNoise and its terms scale came in ea1bcbc, not 27e990a, and the value-floor case is in a test after all, on MODEL1812040006 since b7a5d31. The parked row says 0.5 is a decaying fixture's own share, where rounding decides; the section's lead-in no longer says every row is outside the constexpr form.
Merged
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.
Closes #2150. Part of #1781's phase 1. Docs and tests only: no
src/orinclude/change.What changes
The integrator's two difference-quotient Jacobians (
dq_jacobian.hpp,sparse_jacobian.hpp) read three constants ofinclude/bngsim/fd_jacobian.hppthat set #1002's mend of a column whose step crosses a jump in a rate law. None of the three had a row indocs/development/tolerance-table.md, and the ratchet from #2045 listed the whole file as outside the integrator, so a fourth constant added to the mend would have needed no row.kClampNoiseAtols:kFdJumpRatio,kFdJumpNoiseandkFdJumpParked. Each gives the constant's value and scale, what it guards, how it was set, the commit that first needed it, its measured pin, and phase 3: goes, with the mend (G1).INTEGRATOR_PARTSmapsfd_jacobian.hppto the mend's banner: everyconstexpr k…from there to the file's end needs a row, whatever its name. AkFdJump…declared above the banner fails too (INTEGRATOR_PART_NAMES). The file's seven step-rule constants above it, which only the steady-state solver andModel.jacobian()read, stay outside. If the banner is reworded, the ratchet fails and says so. As agreed on tolerance table: the integrator's difference-quotient Jacobians read three tuning constants of fd_jacobian.hpp with no rows #2150, the header is not split.integrator-contract.md: British spellings made American (judgement, neighbouring, behaviour ×9, modelling).The pins, measured
Each constant was moved in the header, the core rebuilt, and the mend's tests run: seven files with 1,277 tests (
test_difference_quotient_jump.py,test_differenced_jacobian_agreement.py,test_colored_fd_jacobian_steps.py,test_differential_shapes.py, and the three that PR #1302 ran its variants against:test_jacobian_discontinuous_fallback.py,test_net_state_switch_stepping.py,test_steady_state_stagnation_escape.py). The extreme values were run first, to show the trial builds take effect.kFdJumpRatio(16)kFdJumpNoise(1024)kFdJumpParked(1e-6)So the ratio is pinned both ways, loosely, to (1, 1e8). The noise floor and the parked share are pinned only against a rise, past 1e7 and past 0.1. Nothing holds either from below: with the floor at 0, or the parked rule off, every test passes. That agrees with PR #1302's own variants, where both "survive" because the own-row rule added later also undoes the false mends that first set them. The rows say so. That is a gap in the tests' coverage, not a wrong result: no known case comes out wrong at either value.
The last trial rebuilt the core at the shipped values, and the header is byte-identical to main's.
Review
By AI models, two independent reviews of the whole branch.
/code-review(Claude Opus 5.5) at high effort, one round, at 3a7f5bd. Three nits, no blocking findings. All three were fixed in 201b44f:kFdJump…constant declared above the banner passed with no row. It now fails, with a test.Fable 5.2 at medium effort, one round, at 201b44f. It was given the diff, the issue and CONTRIBUTING's review prompt, not my conclusions. No blocking findings. Two factual errors in the
kFdJumpNoiserow, both fixed in f3c36d8:test_difference_quotient_jump.py::test_a_model_with_no_jump_has_nothing_mended, on MODEL1812040006. The test passes at 0 because the own-row rule also undoes those mends.From its notes, also fixed in f3c36d8:
constexpr k…. It now says they are outside the 107 ofcvode_simulator.cpp.It also probed the ratchet against seven realistic edits, and each failed or passed as it should. It checked the measured bounds against the mend's arithmetic on the threshold fixture: a jump-to-slope ratio near 3.4e7, and a floor of 0.015 at 1e7 against a jump of 0.1.
Commits after the last round of either review: f3c36d8 (the Fable fixes above; docs only).
Left alone
kFdJump…, declared above the banner, needs no row. The banner and the name rule are the ratchet's two ways in.2.0infd_jump_testable,0.5infd_jump_came_across) are not named constants, so neither the table nor the ratchet counts them. That is the table's rule for every bare number ("Numbers written inline").src/cvode_simulator.cpp) andtest_event_zeno_refusal.pystill spell it "behaviour". Respelling a user-facing message is asrc/change, outside this docs PR.Testing
test_tolerance_table_ratchet.py: 40 passed. Each new case was checked to fail without its change: on main's ratchet, a constant added to the mend draws no problem at all.test_skip_audit.py,test_ci_run_list_coverage.py,pre-commit runon the changed files, andsphinx -Won the docs all pass.ci/pre_push_pytest.py) passed at f3c36d8.perf_ab.pyrun: nothing insrc/,include/, the code generator, the loaders orSimulatorchanges. No changelog fragment either: CI asks for one only forpython/bngsim/,src/orinclude/.