def fill

unified-nsga-iii@0.2.2.0 · survival.bend:679

import unified-nsga-iii@0.2.2.0/survival.bend as Survival
import Base
import unified-nsga-iii@0.2.2.0/util.bend as Util

679def fill(fuel: Nat, fronts: List<&2, List<&2, Nat>>, fits: Bool, +acc: List<&2, Nat>, +target: Nat, +asgs: List<&2, Assignment>, +n_dirs: Nat) -> List<&2, Nat>:
680  match fuel fronts fits:
681    case 0n fs p:
682      acc
683    case f Nil{} p:
684      acc
685    case 1n+f +fr <> +rest False{}:
686      +need = Nat.sub(target, Util.list_len(Nat, acc))
687      +rows = nrows_of(asgs, fr)
688      niche_loop(
689        1n+Util.list_len(NRow, rows),
690        need,
691        rows,
692        seed_counts(asgs, acc, Util.zeros_nat(n_dirs)),
693        acc
694      )
695    case 1n+f +fr <> +rest True{}:
696      +new_acc = List.append(&2, Nat, acc, fr)
697      fill(
698        f,
699        rest,
700        Nat.is_le(Nat.add(Util.list_len(Nat, new_acc), head_len(rest)), target),
701        new_acc,
702        target,
703        asgs,
704        n_dirs
705      )

Uses (15)

Used by (1)