Debit reserve for proposed cellular motion
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (client) (push) Failing after 4m23s
Foundation / checks (network) (push) Failing after 3m5s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 32s
Foundation / checks (checks) (push) Canceled after 5m42s
Foundation / checks (postgres) (push) Canceled after 1m19s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (client) (push) Failing after 4m23s
Foundation / checks (network) (push) Failing after 3m5s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 32s
Foundation / checks (checks) (push) Canceled after 5m42s
Foundation / checks (postgres) (push) Canceled after 1m19s
This commit is contained in:
@@ -120,6 +120,9 @@ scoped change before starting the next segment.
|
||||
- 11.3c-2: habitat uptake proposals now require an authoritative in-bounds cell
|
||||
footprint and refuse a patch outside contact. Atomic patch/life publication,
|
||||
competing-life resolution and tick ordering remain open.
|
||||
- 11.3b-2: funded motion now returns one detached position/reserve/heat
|
||||
candidate and refuses underfunded or overflowing movement without partial
|
||||
debit. Live intent admission, tick publication and recovery remain open.
|
||||
|
||||
## Exit boundary
|
||||
|
||||
|
||||
@@ -5901,3 +5901,16 @@ focused CTest for motion, uptake and habitat (3/3 passed), clang-format 19.1.5,
|
||||
clang-tidy 19.1.5 with MSVC `/std:c++latest`, and `git diff --check`. CI
|
||||
qualification, simultaneous claims and atomic patch/life publication remain
|
||||
open.
|
||||
|
||||
## 2026-10-10 — M11.3b-2 funded movement candidate (CI pending)
|
||||
|
||||
Added a detached movement transition that combines bounded phenotype-derived
|
||||
motion with reserve sufficiency and an energy-only reserve-to-heat transfer.
|
||||
Insufficient reserve or heat overflow refuses the complete candidate; matter
|
||||
and caller-owned inputs remain unchanged. Maintenance remains a separate
|
||||
tick-ordered transition for the later cellular state owner.
|
||||
|
||||
Executed locally: warning-as-error MSVC Debug and Release `NDEBUG` compile/run,
|
||||
focused cellular CTest, clang-format 19.1.5, clang-tidy 19.1.5 with MSVC
|
||||
`/std:c++latest`, and `git diff --check`. CI and integration with durable
|
||||
intent/outcome publication remain pending.
|
||||
|
||||
@@ -31,12 +31,20 @@ struct CellularMotionProposal {
|
||||
accounting::Picojoules movement_cost{};
|
||||
auto operator<=>(const CellularMotionProposal&) const = default;
|
||||
};
|
||||
struct CellularMotionCandidate {
|
||||
CellularPosition position;
|
||||
accounting::Inventory reserve_after;
|
||||
accounting::Inventory heat_after;
|
||||
accounting::Picojoules movement_cost{};
|
||||
auto operator<=>(const CellularMotionCandidate&) const = default;
|
||||
};
|
||||
enum class CellularMotionError : std::uint8_t {
|
||||
invalid_area,
|
||||
invalid_extent,
|
||||
outside_area,
|
||||
invalid_intent,
|
||||
unsupported_rate_period,
|
||||
insufficient_reserve,
|
||||
overflow
|
||||
};
|
||||
|
||||
@@ -47,6 +55,14 @@ enum class CellularMotionError : std::uint8_t {
|
||||
propose_cellular_motion(CellularArea area, CellularPosition position, std::uint32_t extent_um,
|
||||
CellularIntent intent, const MetabolicBudget& budget) noexcept;
|
||||
|
||||
// Detached one-tick candidate: movement is refused if reserve cannot pay, and
|
||||
// paid energy moves to heat in the same returned value. Inputs are unchanged.
|
||||
[[nodiscard]] std::expected<CellularMotionCandidate, CellularMotionError>
|
||||
propose_funded_cellular_motion(CellularArea area, CellularPosition position,
|
||||
std::uint32_t extent_um, CellularIntent intent,
|
||||
const MetabolicBudget& budget, accounting::Inventory reserve,
|
||||
accounting::Inventory heat) noexcept;
|
||||
|
||||
// Axis-aligned square footprints touching at an edge count as in contact.
|
||||
[[nodiscard]] bool cellular_footprints_contact(CellularPosition a, std::uint32_t extent_a_um,
|
||||
CellularPosition b,
|
||||
|
||||
@@ -114,6 +114,24 @@ propose_cellular_motion(CellularArea area, CellularPosition position, std::uint3
|
||||
return CellularMotionProposal{{next_x, next_y}, distance, {*cost}};
|
||||
}
|
||||
|
||||
std::expected<CellularMotionCandidate, CellularMotionError>
|
||||
propose_funded_cellular_motion(CellularArea area, CellularPosition position,
|
||||
std::uint32_t extent_um, CellularIntent intent,
|
||||
const MetabolicBudget& budget, accounting::Inventory reserve,
|
||||
accounting::Inventory heat) noexcept {
|
||||
const auto motion = propose_cellular_motion(area, position, extent_um, intent, budget);
|
||||
if (!motion)
|
||||
return std::unexpected{motion.error()};
|
||||
const auto cost = motion->movement_cost.value;
|
||||
if (reserve.energy.value < cost)
|
||||
return std::unexpected{CellularMotionError::insufficient_reserve};
|
||||
if (heat.energy.value > std::numeric_limits<std::uint64_t>::max() - cost)
|
||||
return std::unexpected{CellularMotionError::overflow};
|
||||
reserve.energy.value -= cost;
|
||||
heat.energy.value += cost;
|
||||
return CellularMotionCandidate{motion->position, reserve, heat, motion->movement_cost};
|
||||
}
|
||||
|
||||
bool cellular_footprints_contact(CellularPosition a, std::uint32_t extent_a_um, CellularPosition b,
|
||||
std::uint32_t extent_b_um) noexcept {
|
||||
if (extent_a_um == 0 || extent_b_um == 0)
|
||||
|
||||
@@ -75,6 +75,31 @@ void edges_and_invalid_state() {
|
||||
CHECK(quantized->movement_cost.value == 0);
|
||||
}
|
||||
|
||||
void movement_funding_is_one_candidate() {
|
||||
using evo::accounting::Inventory;
|
||||
const Inventory reserve{{100}, {{{1}, {2}, {3}, {4}}}};
|
||||
const Inventory heat{{7}, {{{5}, {6}, {7}, {8}}}};
|
||||
const auto funded = propose_funded_cellular_motion({400, 300}, {100, 100}, 20, {1000, 0},
|
||||
budget(), reserve, heat);
|
||||
CHECK(funded && funded->position == CellularPosition{110, 100});
|
||||
CHECK(funded->movement_cost.value == 50);
|
||||
CHECK(funded->reserve_after == Inventory{{50}, {{{1}, {2}, {3}, {4}}}});
|
||||
CHECK(funded->heat_after == Inventory{{57}, {{{5}, {6}, {7}, {8}}}});
|
||||
|
||||
auto poor = reserve;
|
||||
poor.energy.value = 49;
|
||||
const auto refused =
|
||||
propose_funded_cellular_motion({400, 300}, {100, 100}, 20, {1000, 0}, budget(), poor, heat);
|
||||
CHECK(!refused && refused.error() == CellularMotionError::insufficient_reserve);
|
||||
CHECK(poor.energy.value == 49 && heat.energy.value == 7);
|
||||
|
||||
auto full_heat = heat;
|
||||
full_heat.energy.value = UINT64_MAX;
|
||||
const auto overflow = propose_funded_cellular_motion({400, 300}, {100, 100}, 20, {1000, 0},
|
||||
budget(), reserve, full_heat);
|
||||
CHECK(!overflow && overflow.error() == CellularMotionError::overflow);
|
||||
}
|
||||
|
||||
void contact_geometry() {
|
||||
CHECK(cellular_footprints_contact({0, 0}, 20, {20, 0}, 20)); // Exact edge touch.
|
||||
CHECK(cellular_footprints_contact({0, 0}, 20, {19, 19}, 20));
|
||||
@@ -88,6 +113,7 @@ int main() {
|
||||
try {
|
||||
movement_proposals();
|
||||
edges_and_invalid_state();
|
||||
movement_funding_is_one_candidate();
|
||||
contact_geometry();
|
||||
std::puts("PASS cellular motion: phenotype speed, energy cost, bounds and contact");
|
||||
} catch (const std::exception& error) {
|
||||
|
||||
Reference in New Issue
Block a user