def zdt6_f

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

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

240# C# Zdt6Problem: biased density. g = 1 + 9 * (mean of x[1..])^0.25.
241def zdt6_f(+x: List<&2, F32>) -> List<&2, F32>:
242  +x0 = Util.get_f32(x, 0n)
243  +wave = F32.pow(F32.sin(F32.mul(F32.mul(6.0, F32.pi()), x0)), 6.0)
244  +f0 = F32.sub(1.0, F32.mul(F32.exp(F32.mul(F32.neg(4.0), x0)), wave))
245  +n = Util.list_len(F32, x)
246  +g = F32.add(1.0, F32.mul(9.0, F32.pow(F32.div(sum_tail(x), zdt_den(n)), 0.25)))
247  +r = F32.div(f0, g)
248  f0 <> [F32.mul(g, F32.sub(1.0, F32.mul(r, r)))]

Uses (15)

Used by (1)