Stop calling the end of watching a death
Three defects from review of 89ad95b.
An organism still alive when an episode stopped was recorded dead. A one-tick
run reported no extinctions while writing terminal records for founders that had
not died, and their watched time was added to the same total as completed
lifetimes. Observation ending is a fact about the run, not about the organism,
and ADR-0034 makes a recorded death terminal, so there was nothing to be
terminal about. Survivors stay living now and are counted apart, with their
watched time as the lower bound it is; lived_ticks and observed_ticks answer
different questions and are never summed together.
A genome without the reproduction capability derives a zero investment, which
the driver refused outright, so seeds 10, 12 and 15 failed the whole run.
Filtering those variants out before sampling would have been the worse repair:
the measured set would then be the fertile subset a guard approved of, and being
unable to reproduce is a result rather than grounds for exclusion. The driver
runs such a strategy and proposes no birth for it. ADR-0029 is amended rather
than quietly contradicted.
A half's thermal shortfall was assigned where it was documented as a total, so
two episodes at 15,000 reported 15,000.
Only configurations the driver already rejected behave differently, so the M2.6
pin 2cd4a15f9fbe9949 was checked rather than assumed and still holds. The
ensemble pin moved because the reported facts changed, not to pass a test; the
reason sits beside it. Each fix was confirmed load-bearing by reverting it alone.
Release 33/33, analysis, ASan 33/33 and clang-format all ran and passed here.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+126
-5
@@ -115,12 +115,29 @@ void the_run_is_reproducible_and_archived() {
|
||||
// Every founder is archived, and so is every organism that ever lived.
|
||||
CHECK(report->archived_genomes == set.size());
|
||||
CHECK(report->archived_organisms > report->episodes * set.size());
|
||||
// A death is recorded only where one was observed. An organism whose episode
|
||||
// stopped while it was alive stays living in the archive, so a lineage is
|
||||
// reported absent exactly when every one of its carriers was seen to die.
|
||||
std::uint64_t survivors = 0, deaths = 0;
|
||||
for (const auto& cell : report->cells) {
|
||||
for (const auto* which : {&cell.first_half, &cell.second_half}) {
|
||||
for (const auto& outcome : *which) {
|
||||
survivors += outcome.survivors;
|
||||
deaths += outcome.deaths;
|
||||
}
|
||||
}
|
||||
}
|
||||
CHECK(deaths > 0 && survivors > 0); // Both paths occur in this fixture.
|
||||
CHECK(deaths + survivors == report->archived_organisms);
|
||||
std::uint64_t carried = 0;
|
||||
for (const auto& genome : set) {
|
||||
CHECK(archive.find(genome.id()));
|
||||
// Every episode ended, so nothing is still carrying anything.
|
||||
CHECK(*archive.status(genome.id()) == LineageStatus::absent);
|
||||
CHECK(*archive.living_carriers(genome.id()) == 0);
|
||||
carried += *archive.living_carriers(genome.id());
|
||||
CHECK(*archive.status(genome.id()) == (*archive.living_carriers(genome.id()) == 0
|
||||
? LineageStatus::absent
|
||||
: LineageStatus::living));
|
||||
}
|
||||
CHECK(carried == survivors);
|
||||
// A repeated run reproduces the whole report.
|
||||
LineageArchive again;
|
||||
const auto repeated = run_ensemble(again, set, base_world(), plan(), 11);
|
||||
@@ -246,8 +263,12 @@ void tolerance_keeps_more_life_at_the_extremes() {
|
||||
CHECK(at_reference.first_half[0].scheduled_lifespan ==
|
||||
at_reference.first_half[1].scheduled_lifespan);
|
||||
// At the extreme the intolerant one is stressed more and scheduled shorter.
|
||||
CHECK(at_extreme.first_half[0].thermal_shortfall == 30'000);
|
||||
CHECK(at_extreme.first_half[1].thermal_shortfall == 10'000);
|
||||
// Shortfall is a total across the half's episodes, so it scales with them.
|
||||
const auto episodes = at_extreme.first_half[0].episodes;
|
||||
CHECK(episodes > 1); // Otherwise a sum and a single reading look alike.
|
||||
CHECK(at_extreme.first_half[1].episodes == episodes);
|
||||
CHECK(at_extreme.first_half[0].thermal_shortfall == 30'000 * episodes);
|
||||
CHECK(at_extreme.first_half[1].thermal_shortfall == 10'000 * episodes);
|
||||
CHECK(at_extreme.first_half[0].scheduled_lifespan == 1); // The loss floors it.
|
||||
CHECK(at_extreme.first_half[1].scheduled_lifespan == 300U - 10U * 20U);
|
||||
CHECK(at_extreme.first_half[1].scheduled_lifespan >
|
||||
@@ -256,6 +277,103 @@ void tolerance_keeps_more_life_at_the_extremes() {
|
||||
CHECK(at_reference.first_half[0].scheduled_lifespan == 300);
|
||||
}
|
||||
|
||||
void ending_observation_is_not_death() {
|
||||
// A single tick stops every episode with its founders alive. None of them
|
||||
// died, so none may be recorded dead, and the run must say so.
|
||||
LineageArchive archive;
|
||||
const auto set = founders();
|
||||
auto brief = plan();
|
||||
brief.tick_limit = 1;
|
||||
brief.seeds_per_cell = 2;
|
||||
const auto report = run_ensemble(archive, set, base_world(), brief, 11);
|
||||
CHECK(report);
|
||||
std::uint64_t survivors = 0, deaths = 0, observed = 0, lived = 0;
|
||||
for (const auto& cell : report->cells) {
|
||||
CHECK(cell.extinctions == 0); // Nothing died out in one tick.
|
||||
for (const auto* which : {&cell.first_half, &cell.second_half}) {
|
||||
for (const auto& outcome : *which) {
|
||||
survivors += outcome.survivors;
|
||||
deaths += outcome.deaths;
|
||||
observed += outcome.observed_ticks;
|
||||
lived += outcome.lived_ticks;
|
||||
}
|
||||
}
|
||||
}
|
||||
CHECK(deaths == 0); // The defect recorded a death for every founder.
|
||||
CHECK(lived == 0); // And charged each one a completed lifetime.
|
||||
CHECK(survivors > 0); // They are survivors, counted as such.
|
||||
// Each founder was watched for exactly its one tick. Anything born during
|
||||
// that tick is also a survivor, watched for none of it, so observed time is
|
||||
// a lower bound and not a lifetime.
|
||||
CHECK(observed == report->episodes * set.size());
|
||||
CHECK(survivors >= report->episodes * set.size());
|
||||
// The archive agrees: nothing was observed to die, so every lineage lives.
|
||||
for (const auto& genome : set) {
|
||||
CHECK(*archive.status(genome.id()) == LineageStatus::living);
|
||||
CHECK(*archive.living_carriers(genome.id()) > 0);
|
||||
}
|
||||
}
|
||||
|
||||
void a_strategy_that_cannot_reproduce_is_still_measured() {
|
||||
// A mutation may legitimately drop reproduction. Such a genome yields a zero
|
||||
// investment, which the driver once refused outright, so the whole ensemble
|
||||
// failed on the seeds that happened to draw one. It now runs and simply never
|
||||
// reproduces; excluding it would have made the measured set a subset chosen
|
||||
// by a guard rather than by the draw.
|
||||
auto source = ancestor_draft();
|
||||
source.capabilities.erase(
|
||||
std::remove_if(source.capabilities.begin(), source.capabilities.end(),
|
||||
[](const auto& record) { return record.kind == Capability::reproduction; }),
|
||||
source.capabilities.end());
|
||||
const auto barren = Genome::create(source);
|
||||
CHECK(barren);
|
||||
CHECK(!barren->carries(Capability::reproduction));
|
||||
const EnvironmentState where{reference_temperature, pooled(1'000)};
|
||||
const auto budget = metabolic_budget(*barren, {1000, 0}, where);
|
||||
CHECK(budget && budget->reproduction_investment == Inventory{});
|
||||
const auto strategy = strategy_for(*barren, {1000, 0}, where, Inventory{}, 60);
|
||||
CHECK(strategy && strategy->investment == Inventory{});
|
||||
// The driver accepts it rather than rejecting the configuration.
|
||||
auto config = base_world();
|
||||
config.tick_limit = 120;
|
||||
const std::array only{*strategy};
|
||||
auto episode = EcosystemEpisode::create(config, only, 3);
|
||||
CHECK(episode);
|
||||
const auto summary = episode->run();
|
||||
CHECK(summary && summary->births == 0); // It lives, and it leaves nothing.
|
||||
// And the seeds that previously failed now produce a whole run.
|
||||
for (const std::uint64_t seed : {10U, 12U, 15U}) {
|
||||
LineageArchive archive;
|
||||
const auto set = diverge_founders(ancestor(), 3, seed);
|
||||
CHECK(set);
|
||||
auto brief = plan();
|
||||
brief.seeds_per_cell = 2;
|
||||
brief.tick_limit = 60;
|
||||
CHECK(run_ensemble(archive, *set, base_world(), brief, seed));
|
||||
}
|
||||
}
|
||||
|
||||
void thermal_shortfall_is_summed_over_episodes() {
|
||||
// The field is a total across a half's episodes, not one episode's reading.
|
||||
LineageArchive archive;
|
||||
const auto set = founders();
|
||||
auto stressed = plan();
|
||||
stressed.gradient = {{reference_temperature + 15'000U, 1'000}};
|
||||
stressed.seeds_per_cell = 4;
|
||||
stressed.tick_limit = 40;
|
||||
const auto report = run_ensemble(archive, set, base_world(), stressed, 11);
|
||||
CHECK(report && report->cells.size() == 1);
|
||||
const auto& cell = report->cells[0];
|
||||
for (const auto* which : {&cell.first_half, &cell.second_half}) {
|
||||
for (const auto& outcome : *which) {
|
||||
CHECK(outcome.episodes == 2);
|
||||
// Two episodes at 15,000 millikelvin of shortfall total 30,000; the
|
||||
// defect reported 15,000, the value of a single episode.
|
||||
CHECK(outcome.thermal_shortfall == 30'000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void invalid_plans_are_refused() {
|
||||
LineageArchive archive;
|
||||
const auto set = founders();
|
||||
@@ -291,6 +409,9 @@ int main() try {
|
||||
the_two_seed_halves_agree();
|
||||
the_gradient_changes_the_outcome();
|
||||
tolerance_keeps_more_life_at_the_extremes();
|
||||
ending_observation_is_not_death();
|
||||
a_strategy_that_cannot_reproduce_is_still_measured();
|
||||
thermal_shortfall_is_summed_over_episodes();
|
||||
invalid_plans_are_refused();
|
||||
std::cout << "PASS genome-derived strategies, gradient ensembles and split-half agreement\n";
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user