You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add integer-value and population-conservation test for multinomial mode across all test frameworks #560
The only test of multinomial mode across frameworks is test_functional_all_framework_databook, which checks that the demos run. It does not check that compartment values stay integer or that people are conserved, and it only covers demo_projects, which contain no residual junctions and no duration groups. Both residual-junction bugs found in review would have been caught by an integer and conservation check on the existing tests/*.xlsx frameworks.
Implementation plan
Add a parametrised test over every framework/databook pair in tests/ plus the library frameworks (including sir_vaccine) that runs in multinomial mode with a fixed seed and asserts:
every non-source compartment value is integer-valued (np.allclose(v, np.round(v)));
every compartment value is non-negative;
the total number of people across non-source compartments equals the initial total plus cumulative source inflow minus cumulative sink inflow at every timestep.
Mark frameworks with duration groups as expected failures until the timed-compartment issue is resolved.
Add a cheap guard in Compartment.resolve_outflows() under multinomial mode that raises ModelError if self[ti] is not integer-valued, so a future regression surfaces at the point of failure rather than as a silent truncation.
Activity