M11.1: development version 2 and the primitive founder (first bud in 5-15 min)
Foundation / checks (deploy) (push) Successful in 3m28s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (client) (push) Successful in 12m36s
Foundation / checks (network) (push) Failing after 10m52s
Foundation / checks (tsan) (push) Successful in 7m50s
Foundation / checks (checks) (push) Successful in 33m6s
Foundation / checks (postgres) (push) Successful in 46m9s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
Foundation / checks (deploy) (push) Successful in 3m28s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (client) (push) Successful in 12m36s
Foundation / checks (network) (push) Failing after 10m52s
Foundation / checks (tsan) (push) Successful in 7m50s
Foundation / checks (checks) (push) Successful in 33m6s
Foundation / checks (postgres) (push) Successful in 46m9s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
Development version 2 is defined per second; phenotype/budget rates carry their period (rate_microseconds: 50 ms for v1, 1 s for v2) and the M2 fixture adapters accept only v1. Tunable v2 constants (maintenance 10, membrane upkeep 15, movement 50 pJ/s per 1000 fg) and the primitive founder (schema 2: 1 um membrane, 8e6 fg, 200 um/s, 574,000 fg/s ingestion, 500 per-thousand bud) give a first bud in 300/600/901 s when feeding 100/50/33 % of the time at full-speed movement (bud_funding_seconds; never at 10 %), the maintainer's 5-15 minute target. Tests pin the range; v1 is unchanged. 11.1 complete. Refresh the dev session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -55,10 +55,16 @@ std::uint64_t matter_total(const accounting::Inventory& inventory) noexcept {
|
||||
} // namespace
|
||||
|
||||
std::expected<DevelopmentRules, DevelopmentError> rules_for(std::uint32_t development_version) {
|
||||
if (development_version != 1) {
|
||||
return std::unexpected{DevelopmentError::unsupported_rules};
|
||||
if (development_version == 1) {
|
||||
return DevelopmentRules{1000, 1200, 2, 3, 40, 60'000, 293'150, 50};
|
||||
}
|
||||
return DevelopmentRules{1000, 1200, 2, 3, 40, 60'000, 293'150, 50};
|
||||
// Version 2 (ADR-0099; tunable, ADR-0098 decision 7): rates per second. Maintenance
|
||||
// and membrane upkeep are a quarter of version 1's per-second equivalent (40, 60), so
|
||||
// a primitive cell can fund its first bud within a session of feeding.
|
||||
if (development_version == 2) {
|
||||
return DevelopmentRules{1000, 1200, 10, 15, 40, 60'000, 293'150, 50};
|
||||
}
|
||||
return std::unexpected{DevelopmentError::unsupported_rules};
|
||||
}
|
||||
|
||||
std::expected<Phenotype, DevelopmentError>
|
||||
@@ -98,10 +104,14 @@ derive_phenotype(const Genome& genome, GrowthState growth, EnvironmentState envi
|
||||
phenotype.conversion_per_thousand =
|
||||
static_cast<std::uint32_t>(*genome.parameter(Capability::energy_conversion));
|
||||
// A capability the genome does not carry yields nothing, whatever the size.
|
||||
// Development version 1 is defined in 50 ms ticks: genome rates (per second) enter it
|
||||
// at that quantum, rounded down as capacities (ADR-0099; exact for schema 1 records).
|
||||
const auto rate_per_tick = [](std::uint64_t per_second) {
|
||||
return accounting::per_tick(per_second, development_v1_tick_microseconds,
|
||||
// Version 1 is defined in 50 ms ticks: genome rates (per second) enter it at that
|
||||
// quantum, rounded down as capacities (ADR-0099; exact for schema 1 records).
|
||||
// Version 2 is defined per second and reads them as they are.
|
||||
const bool v1 = genome.development_version() == 1;
|
||||
phenotype.rate_microseconds =
|
||||
v1 ? development_v1_tick_microseconds : development_v2_rate_microseconds;
|
||||
const auto rate_per_tick = [&](std::uint64_t per_second) {
|
||||
return accounting::per_tick(per_second, phenotype.rate_microseconds,
|
||||
accounting::Rounding::down);
|
||||
};
|
||||
if (genome.carries(Capability::movement)) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "evo/biology/founder.hpp"
|
||||
|
||||
namespace evo::biology {
|
||||
std::expected<Genome, GenomeError> primitive_founder(std::uint64_t id, std::uint64_t origin_event) {
|
||||
const auto& p = primitive_founder_parameters;
|
||||
GenomeDraft draft;
|
||||
draft.schema_version = genome_schema_version;
|
||||
draft.id = id;
|
||||
draft.origin_event = origin_event;
|
||||
draft.development_version = primitive_founder_development_version;
|
||||
draft.capabilities = {{Capability::energy_conversion, p.energy_conversion, 0},
|
||||
{Capability::membrane, p.membrane, 0},
|
||||
{Capability::movement, p.movement, 0},
|
||||
{Capability::ingestion, p.ingestion, 0},
|
||||
{Capability::reproduction, p.reproduction, 0},
|
||||
{Capability::target_size, p.target_size, 0}};
|
||||
return Genome::create(draft);
|
||||
}
|
||||
} // namespace evo::biology
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "evo/biology/metabolism.hpp"
|
||||
|
||||
#include "evo/accounting/rates.hpp"
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace evo::biology {
|
||||
@@ -102,10 +104,14 @@ accounting::Inventory fraction_of(const accounting::Inventory& source,
|
||||
|
||||
std::expected<MetabolicRules, DevelopmentError>
|
||||
metabolic_rules_for(std::uint32_t development_version) {
|
||||
if (development_version != 1) {
|
||||
return std::unexpected{DevelopmentError::unsupported_rules};
|
||||
if (development_version == 1) {
|
||||
return MetabolicRules{structure_shares, membrane_shares, 20, 50'000};
|
||||
}
|
||||
return MetabolicRules{structure_shares, membrane_shares, 20, 50'000};
|
||||
// Version 2: per second; movement at 1000 um/s costs 50 pJ/s per 1000 fg (tunable).
|
||||
if (development_version == 2) {
|
||||
return MetabolicRules{structure_shares, membrane_shares, 50, 50'000};
|
||||
}
|
||||
return std::unexpected{DevelopmentError::unsupported_rules};
|
||||
}
|
||||
|
||||
std::expected<MetabolicBudget, DevelopmentError>
|
||||
@@ -203,4 +209,43 @@ metabolic_budget(const Genome& genome, GrowthState growth, EnvironmentState envi
|
||||
}
|
||||
return budget;
|
||||
}
|
||||
|
||||
std::optional<std::uint64_t> bud_funding_seconds(const MetabolicBudget& budget,
|
||||
std::uint32_t feeding_per_thousand) noexcept {
|
||||
const auto period = budget.phenotype.rate_microseconds;
|
||||
if (period == 0 || accounting::microseconds_per_second % period != 0 ||
|
||||
feeding_per_thousand == 0 || feeding_per_thousand > thousand ||
|
||||
matter_total(budget.reproduction_investment) == 0)
|
||||
return std::nullopt;
|
||||
const auto periods_per_second = accounting::microseconds_per_second / period;
|
||||
// Per-second amounts; ceil(need / rate) seconds for each.
|
||||
const auto seconds = [&](std::uint64_t need,
|
||||
std::uint64_t per_period) -> std::optional<std::uint64_t> {
|
||||
if (need == 0)
|
||||
return std::uint64_t{0};
|
||||
std::uint64_t per_second{};
|
||||
if (!multiply(per_second, scaled(per_period, feeding_per_thousand), periods_per_second) ||
|
||||
per_second == 0)
|
||||
return std::nullopt;
|
||||
return need / per_second + (need % per_second != 0 ? 1 : 0);
|
||||
};
|
||||
std::uint64_t longest = 0;
|
||||
for (std::size_t c = 0; c < budget.reproduction_investment.matter.size(); ++c) {
|
||||
const auto t = seconds(budget.reproduction_investment.matter[c].value,
|
||||
budget.intake_limit.matter[c].value);
|
||||
if (!t)
|
||||
return std::nullopt;
|
||||
longest = std::max(longest, *t);
|
||||
}
|
||||
// Energy: the fed share of intake, less the whole demand, all per period.
|
||||
const auto fed = scaled(budget.intake_limit.energy.value, feeding_per_thousand);
|
||||
if (fed <= budget.demand.value)
|
||||
return std::nullopt;
|
||||
std::uint64_t surplus{};
|
||||
if (!multiply(surplus, fed - budget.demand.value, periods_per_second) || surplus == 0)
|
||||
return std::nullopt;
|
||||
const auto need = budget.reproduction_investment.energy.value;
|
||||
longest = std::max(longest, need / surplus + (need % surplus != 0 ? 1 : 0));
|
||||
return longest;
|
||||
}
|
||||
} // namespace evo::biology
|
||||
|
||||
Reference in New Issue
Block a user