Class: GEPA::Strategies::RoundRobinReflectionComponentSelector

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/gepa/strategies/component_selector.rb

Instance Method Summary collapse

Constructor Details

#initialize(telemetry: nil) ⇒ RoundRobinReflectionComponentSelector

Returns a new instance of RoundRobinReflectionComponentSelector.



11
12
13
# File 'lib/gepa/strategies/component_selector.rb', line 11

def initialize(telemetry: nil)
  @telemetry = telemetry
end

Instance Method Details

#select_modules(state, trajectories, subsample_scores, candidate_idx, candidate) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gepa/strategies/component_selector.rb', line 24

def select_modules(state, trajectories, subsample_scores, candidate_idx, candidate)
  with_span(
    'gepa.strategies.component_selector',
    strategy: 'round_robin',
    candidate_idx: candidate_idx
  ) do
    predictor_id = state.named_predictor_id_to_update_next_for_program_candidate[candidate_idx]
    state.named_predictor_id_to_update_next_for_program_candidate[candidate_idx] =
      (predictor_id + 1) % state.list_of_named_predictors.length

    [state.list_of_named_predictors[predictor_id]]
  end
end