Dsxir.Optimizer.GEPA.Population (dsxir v0.4.0)

Copy Markdown

Opaque collection of %Individual{} preserving birth order. Lookup by id is O(1); iteration is birth-order stable (oldest first).

Summary

Functions

Appends ind to the population. No-op when ind.id already exists.

Looks up an individual by id. Returns nil if unknown.

Creates a new population seeded with a single individual.

Number of individuals in the population.

Returns members in birth order (oldest first).

Types

id()

t()

@type t() :: %Dsxir.Optimizer.GEPA.Population{
  by_id: %{required(id()) => Dsxir.Optimizer.GEPA.Individual.t()},
  order: [id()]
}

Functions

add(pop, ind)

@spec add(t(), Dsxir.Optimizer.GEPA.Individual.t()) :: t()

Appends ind to the population. No-op when ind.id already exists.

by_id(population, id)

@spec by_id(t(), id()) :: Dsxir.Optimizer.GEPA.Individual.t() | nil

Looks up an individual by id. Returns nil if unknown.

new(seed)

Creates a new population seeded with a single individual.

size(population)

@spec size(t()) :: non_neg_integer()

Number of individuals in the population.

to_list(population)

@spec to_list(t()) :: [Dsxir.Optimizer.GEPA.Individual.t()]

Returns members in birth order (oldest first).