def normalize_nd.body
unified-nsga-iii@0.2.2.0 · normalization.bend:480
import unified-nsga-iii@0.2.2.0/normalization.bend as Normalization
import Base
import unified-nsga-iii@0.2.2.0/individual.bend as Ind
import unified-nsga-iii@0.2.2.0/util.bend as Util
480def normalize_nd.body(+ideal0: List<&2, F32>, +worst0: List<&2, F32>, +ext0: List<&2, List<&2, F32>>, +pop: List<&2, Ind.Individual>, nd: List<&2, Nat>) -> State & List<&2, List<&2, F32>>:
481 +mn = col_min(pop)
482 +mx = col_max(pop)
483 +ideal = merge_ideal(ideal0, mn)
484 +worst = merge_worst(worst0, mx)
485 +nd_use = nd_or_all(nd, Util.list_len(Ind.Individual, pop))
486 +front = col_max_idx(pop, nd_use)
487 +cand = List.append(&2, List<&2, F32>, ext0, gather_objs(pop, nd_use))
488 +m = n_obj_pop(pop)
489 +ext = pick_extremes(cand, ideal, m)
490 +nadir0 = nadir_from_maybe(try_intercepts(ext, ideal), ideal, worst, front)
491 +nadir1 = fallback_pop(nadir0, ideal, mx)
492 +nadir = fallback_unit(nadir1, ideal)
493 (MkState{m, ideal, worst, nadir, spans_or_one(nadir, ideal), ext}, map_norm(ideal, nadir, pop))