Plexus.Population (Plexus v0.1.0)

Copy Markdown View Source

Population queries and selection operators over the per-run node table.

Summary

Functions

Index a top-level node attribute in run-owned ETS. Queries validate candidate rows against current attributes. Historical index values remain until run teardown, avoiding lost entries under concurrent updates; index low-cardinality metadata, not unbounded counters. Concurrent queries are not snapshots.

Find current nodes with an indexed attribute equal to the requested value.

Replace compatible sibling leaves using an application-merged input map.

Move a leaf to another run using an explicit application snapshot; mailbox contents are not migrated.

Replicate initial application input; pass init_arg in opts to supply a current snapshot.

Weighted sampling with replacement and an explicit reproducible seed.

Replace a leaf with siblings using application-supplied input maps. Failed admission rolls back births.

Functions

all(run_id)

@spec all(term()) :: [{term(), map()}]

by_class(run_id, class)

@spec by_class(term(), term()) :: [{term(), map()}]

index(run_id, field)

@spec index(term(), term()) :: :ok

Index a top-level node attribute in run-owned ETS. Queries validate candidate rows against current attributes. Historical index values remain until run teardown, avoiding lost entries under concurrent updates; index low-cardinality metadata, not unbounded counters. Concurrent queries are not snapshots.

lookup(run_id, field, value)

@spec lookup(term(), term(), term()) :: [{term(), map()}]

Find current nodes with an indexed attribute equal to the requested value.

merge(context, sources, target, init_arg)

Replace compatible sibling leaves using an application-merged input map.

migrate(context, source, destination, init_arg)

Move a leaf to another run using an explicit application snapshot; mailbox contents are not migrated.

pareto(run_id, class, objectives)

@spec pareto(term(), term(), [(map() -> number())]) :: [{term(), map()}]

replicate(context, source, target, opts \\ [])

Replicate initial application input; pass init_arg in opts to supply a current snapshot.

resample(run_id, class, count, weight, seed)

@spec resample(term(), term(), non_neg_integer(), (map() -> number()), integer()) :: [
  {term(), map()}
]

Weighted sampling with replacement and an explicit reproducible seed.

split(context, source, children)

Replace a leaf with siblings using application-supplied input maps. Failed admission rolls back births.

top_k(run_id, class, k, score_fun)

@spec top_k(term(), term(), non_neg_integer(), (map() -> term())) :: [{term(), map()}]

tournament(run_id, class, size, score, seed)

@spec tournament(term(), term(), pos_integer(), (map() -> number()), integer()) ::
  {term(), map()} | nil

where(run_id, predicate)

@spec where(term(), (term(), map() -> boolean())) :: [{term(), map()}]