def col_min.go
unified-nsga-iii@0.2.2.0 · normalization.bend:35
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
35
36def col_min.go(+fuel: Nat, pop: List<&2, Ind.Individual>) -> List<&2, F32>:
37 match fuel pop:
38 case 0n Nil{}:
39 Nil{}
40 case 0n ind <> xs:
41 Util.vec_min(Ind.objectives(ind), col_min.go(0n, xs))
42 case 1n+p Nil{}:
43 Nil{}
44 case 1n+p ind <> Nil{}:
45 Ind.objectives(ind)
46 case 1n+p h <> t:
47 +all = {h <> t : List<&2, Ind.Individual>}
48 +mid = Nat.div(Util.list_len(Ind.Individual, all), 2n)
49 lo hi = col_min.go(p, List.take(&2, Ind.Individual, all, mid)) col_min.go(p, List.drop(&2, Ind.Individual, all, mid))
50 Util.vec_min(lo, hi)