Four of five runs conserve perfectly; three are ecologically worthless
M4.5 closes M4 by measuring what aggregation costs, and adds no library code except one defect fix the measurement found. One rule is written once and applied at both resolutions. The control is what makes the rest mean anything: with one member per class a class average is that member, so the two runs must agree exactly, and they do, tick by tick, in every channel. A deliberate one-unit drift in the aggregate rule is caught by it, so the instrument is verified rather than assumed. Without it a measured gap would be indistinguishable from a transcription mistake in one of the two runs. The result is reported, not smoothed into a tolerance. At class widths ten and fifty the aggregate population survives ten thousand ticks within 375 parts per thousand on population and 43 on energy. At twenty-five, one hundred and two hundred it dies out entirely while the individual run sustains seventy-five members: a false extinction caused by resolution alone, because a whole class starves the moment its average cannot pay upkeep, where individuals starve a few at a time and the survivors keep the shared per-capita share up. The collapse is not monotone in class width. Twenty-five destroys the population and fifty sustains it. An earlier version of the test asserted that coarser is never better; the measurement refuted it, so the assertion went rather than the widths being chosen to make it hold. The non-monotonicity is asserted now, because it is surprising and because the warning written around it could otherwise become wrong without failing. A tier policy cannot assume degradation worsens smoothly as classes widen, and M4.6 inherits that. Conservation was exact at every tick on both sides of all five runs, including the three that died out. That is the clearest available demonstration of the thing ECOLOGY_MODEL keeps saying: conservation is not ecological evidence. Two flaws in my own experiment were found before any number was believed. The aggregate model had been producing overlapping classes, so the model measured was not one a cohort could represent; newborns now extend the youngest class while it is narrower than the width, and every step is checked to construct a valid Cohort. The first figures were discarded. The comparison also found a real M4.3 defect, which is what a validation milestone is for. plan_advance checked affordability with arrivals added before losses were taken, but emitted the ledger legs outflows-first, so an interval affordable as a whole underflowed leg by leg and was refused at commit. A fifty-tick interval shedding 10,480 against 6,950 held while drawing 13,080 in reproduced it. Arrivals are the first leg now, matching the order the arithmetic was checked in, with a regression and a corrected escrow expectation in an existing test. Release 38/38, analysis, ASan 38/38 and clang-format all ran and passed here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -143,10 +143,15 @@ std::expected<AdvancePlan, PopulationError> plan_advance(const Cohort& before,
|
||||
legs.push_back(inbound ? accounting::Transfer{where, before.reservoir(), amount}
|
||||
: accounting::Transfer{before.reservoir(), where, amount});
|
||||
};
|
||||
// Arrivals first, in the same order the arithmetic above was checked: the
|
||||
// ledger applies legs in sequence, so an outflow placed before an inflow could
|
||||
// underflow a reservoir that the interval as a whole affords. Without this a
|
||||
// cohort shedding more than it currently holds, while receiving enough to cover
|
||||
// it, would pass planning and then be refused at commit.
|
||||
leg(flux.from_elsewhere, request.elsewhere, true);
|
||||
leg(flux.to_detritus, request.detritus, false);
|
||||
leg(flux.to_predators, request.predators, false);
|
||||
leg(flux.to_elsewhere, request.elsewhere, false);
|
||||
leg(flux.from_elsewhere, request.elsewhere, true);
|
||||
if (legs.size() > accounting::max_transfers) {
|
||||
return std::unexpected{PopulationError::overflow};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user