Dsxir. Optimizer. GEPA. Operators behaviour
(dsxir v0.2.0)
Copy Markdown
Behaviour and dispatcher for GEPA mutation operators.
Each operator returns {:ok, %Delta{}, proposer_calls} or {:error, exc}.
sample/4 picks an operator by weighted draw against
config.operator_weights and returns the parents the operator needs.
Summary
Functions
Weighted draw of an operator. Returns {operator_module, parents, rng2}.
Population invariants make stale frontier references impossible by
construction: the loop never removes ids.
Types
@type ctx() :: %{ reflective_lm: {module(), keyword()}, demo_table: %{required(atom()) => %{required(map()) => [Dsxir.Demo.t()]}}, decls: [Dsxir.Program.PredictorDecl.t()], rng: term(), config: map() }
@type parents() :: Dsxir.Optimizer.GEPA.Individual.t() | {Dsxir.Optimizer.GEPA.Individual.t(), Dsxir.Optimizer.GEPA.Individual.t()}
Callbacks
@callback apply(parents :: parents(), ctx :: ctx()) :: {:ok, Dsxir.Optimizer.GEPA.Delta.t(), proposer_calls :: non_neg_integer()} | {:error, Exception.t()}
@callback kind() :: :mutate_instr | :mutate_demos | :crossover
@callback parent_count() :: 1 | 2
Functions
@spec sample( frontier :: [Dsxir.Optimizer.GEPA.Population.id()], pop :: Dsxir.Optimizer.GEPA.Population.t(), weights :: %{required(atom()) => float()}, rng :: term() ) :: {module(), parents(), term()}
Weighted draw of an operator. Returns {operator_module, parents, rng2}.
Population invariants make stale frontier references impossible by
construction: the loop never removes ids.