def start_or_copy

unified-nsga-iii@0.2.2.0 · polynomial_mutation.bend:163

import unified-nsga-iii@0.2.2.0/polynomial_mutation.bend as PolynomialMutation
import Base
import unified-nsga-iii@0.2.2.0/individual.bend as Ind
import unified-nsga-iii@0.2.2.0/bounds.bend as Bounds
import unified-nsga-iii@0.2.2.0/rng.bend as Rng

163# p=0 leaves the decision vector unchanged before any NextDouble.
164# Matches C# when per-variable probability is 0 (every draw is > 0).
165def start_or_copy(
166  +eta: F32,
167  +box: Bounds.Box,
168  rng: Rng.State,
169  ind: Ind.Individual,
170  +p: F32,
171  n: Nat,
172  zero: Bool
173) -> Rng.State & Ind.Individual:
174  match zero:
175    case True{}:
176      (rng, ind)
177    case False{}:
178      start(eta, box, rng, ind, p, n)

Uses (9)

Used by (1)