def replace_head

unified-nsga-iii@0.2.2.0 · algorithm.bend:522

import unified-nsga-iii@0.2.2.0/algorithm.bend as Algorithm
import Base
import unified-nsga-iii@0.2.2.0/individual.bend as Ind

522# Replace the first random member with `seed_x` before evaluate.
523# The rest of the initial population still consumes the seed RNG.
524# C# places the seed first and does not draw RNG for it; this helper
525# only guarantees a known feasible start for the constrained smoke.
526def replace_head(+xs: List<&2, F32>, +nm: Nat, pop: List<&2, Ind.Individual>) -> List<&2, Ind.Individual>:
527  match pop:
528    case Nil{}:
529      Nil{}
530    case h <> t:
531      Ind.from_variables(xs, nm) <> t

Uses (5)

Used by (1)