mod swarm

module swarm

How a leftover chain uses the shared packing catalog. How a leftover chain uses the shared packing catalog.

The hop is leftover SOAP. The catalog is the set of packing wells the chains have already published. This module only answers three questions that catalog already implies:

  • This chain holds the deepest published packing: keep walking it. Do not redraw a member.

  • This chain is on another packing and the ledger is still open: a competitive other class may be adopted. Late in the ledger, only a deeper member.

  • The occupied packing is exhausted for this chain — it is locally raised, or this chain has not deepened for STALL_LEAVE slices: step into a SOAP hole. Do not redraw the catalog incumbent.

A chain that just deepened its own quench does not adopt. That is the same leftover walk, not a second method.

Variables

const STALL_LEAVE: u32

Slices without a deeper own quench before the packing is treated as exhausted for this chain.

Functions

fn catalog_role(my_energy: f64, catalog_best: f64, catalog_size: usize, _catalog_saturated: bool, on_raised_packing: bool) -> Role

Role from catalog rank and whether the occupied packing is exhausted.

fn ledger_half(progress: f64) -> LedgerHalf

First half of the budget is open.

fn policy(progress: f64, my_energy: f64, own_best: f64, catalog_best: f64, catalog_size: usize, catalog_saturated: bool, on_raised_packing: bool, stall: u32) -> Decision

Catalog policy. stall is slices since this chain last deepened.

Enums

enum LedgerHalf

Open ledger: other packings. Closed ledger: only a deeper member.

Open

First half of the charged budget.

Closed

Second half.

enum Role

Where this chain sits relative to the published packings.

Occupant

Deepest published packing. Walk it. Publish if it deepens.

Other

A different packing. May adopt a competitive class.

Leave

This packing is exhausted for the chain. Leave through a hole.

Structs and Unions

struct Decision

Catalog action for one slice.

role: Role

Relation to the published packings.

half: LedgerHalf

Open or closed half of the ledger.

pull: bool

Take one sample from the catalog.

win_only: bool

That sample must be deeper than this chain’s quench.

leave: bool

Step into a SOAP hole of the occupied packing.