def col_max.go

unified-nsga-iii@0.2.2.0 · normalization.bend:55

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

55def col_max.go(+fuel: Nat, pop: List<&2, Ind.Individual>) -> List<&2, F32>:
56  match fuel pop:
57    case 0n Nil{}:
58      Nil{}
59    case 0n ind <> xs:
60      Util.vec_max(Ind.objectives(ind), col_max.go(0n, xs))
61    case 1n+p Nil{}:
62      Nil{}
63    case 1n+p ind <> Nil{}:
64      Ind.objectives(ind)
65    case 1n+p h <> t:
66      +all = {h <> t : List<&2, Ind.Individual>}
67      +mid = Nat.div(Util.list_len(Ind.Individual, all), 2n)
68      lo hi = col_max.go(p, List.take(&2, Ind.Individual, all, mid)) col_max.go(p, List.drop(&2, Ind.Individual, all, mid))
69      Util.vec_max(lo, hi)

Uses (10)

Used by (1)