def osy_f

unified-nsga-iii@0.2.2.0 · problems.bend:532

import unified-nsga-iii@0.2.2.0/problems.bend as Problems
import Base
import unified-nsga-iii@0.2.2.0/util.bend as Util

532# C# OsyProblem. f0 negates the weighted squares (x5 is not in f0).
533def osy_f(+x: List<&2, F32>) -> List<&2, F32>:
534  +x0 = Util.get_f32(x, 0n)
535  +x1 = Util.get_f32(x, 1n)
536  +x2 = Util.get_f32(x, 2n)
537  +x3 = Util.get_f32(x, 3n)
538  +x4 = Util.get_f32(x, 4n)
539  +pen = F32.add(
540    F32.mul(25.0, F32.square(F32.sub(x0, 2.0))),
541    F32.add(
542      F32.square(F32.sub(x1, 2.0)),
543      F32.add(
544        F32.square(F32.sub(x2, 1.0)),
545        F32.add(F32.square(F32.sub(x3, 4.0)), F32.square(F32.sub(x4, 1.0)))
546      )
547    )
548  )
549  F32.neg(pen) <> [sum_sq(x)]

Uses (9)

Used by (1)