~/bend-docscommunity

problems.bend checks

raw source on the hub · import 0xa2f9d6ef8c474468bf1de15ebe70c512/problems.bend as Problems

Named problems — C# Unsga3.Problems. ZDT1 / ZDT2 / DTLZ2 stay the oracle problems. The rest of the unconstrained catalog (ZDT3 / ZDT4 / ZDT6, DTLZ1 / DTLZ3 / DTLZ4 / DTLZ7, Sphere / Ackley / Rosenbrock) matches the same C# Evaluate formulas. Minimize. Unconstrained (NumberOfConstraints = 0). No IGD in this module. alpha is DTLZ4's exponent (C# default 100). Other kinds ignore it.

4 imports
import Base
import ./individual.bend as Ind
import ./bounds.bend as Bounds
import ./util.bend as Util

Types

type Family source · line 13 · raw

Data

type Problem source · line 28 · raw

Data

type Acc2 source · line 409 · raw

Data

Definitions

def box_of source · line 35 · raw

@p:Problem -> 0xa2f9d6ef8c474468bf1de15ebe70c512/bounds.Box

def kind_of source · line 40 · raw

@p:Problem -> Family

def alpha_of source · line 45 · raw

@p:Problem -> F32

def n_obj source · line 50 · raw

@p:Problem -> Nat

def n_var source · line 53 · raw

@p:Problem -> Nat

def mk_prob source · line 56 · raw

@kind:Family -> @box:0xa2f9d6ef8c474468bf1de15ebe70c512/bounds.Box -> Problem

def zdt1 source · line 60 · raw

@n:Nat -> Problem

ZDT1 / ZDT2 / ZDT3: n variables (C# default 30), 2 objectives, x ∈ [0,1]^n.

def zdt2 source · line 63 · raw

@n:Nat -> Problem

def zdt3 source · line 66 · raw

@n:Nat -> Problem

def zdt4_ivs source · line 70 · raw

@n:Nat -> List<&2, 0xa2f9d6ef8c474468bf1de15ebe70c512/bounds.Interval>

ZDT4: C# default n=10. x0 ∈ [0,1], x1.. ∈ [-5,5].

def zdt4 source · line 77 · raw

@n:Nat -> Problem

def zdt6 source · line 81 · raw

@n:Nat -> Problem

ZDT6: C# default n=10, x ∈ [0,1]^n.

def dtlz_n source · line 85 · raw

@m:Nat -> @k:Nat -> Nat

n = M + k - 1 (C# Dtlz*Problem).

def dtlz2 source · line 97 · raw

@+m:Nat -> @k:Nat -> Problem

DTLZ2: C# default M=3, k=10 ⇒ n=12, x ∈ [0,1]^n.

def dtlz1 source · line 101 · raw

@+m:Nat -> @k:Nat -> Problem

DTLZ1: C# default M=3, k=5 ⇒ n=7.

def dtlz3 source · line 105 · raw

@+m:Nat -> @k:Nat -> Problem

DTLZ3: C# default M=3, k=10. DTLZ2 map, DTLZ1 g.

def dtlz4_alpha source · line 109 · raw

@+m:Nat -> @k:Nat -> @+alpha:F32 -> Problem

DTLZ4: C# default α=100, k=10.

def dtlz4 source · line 112 · raw

@+m:Nat -> @k:Nat -> Problem

def dtlz7 source · line 116 · raw

@+m:Nat -> @k:Nat -> Problem

DTLZ7: C# default M=3, k=20 ⇒ n=22.

def sphere source · line 120 · raw

@n:Nat -> Problem

Single-objective. M=1. C# defaults: Sphere n=10, Ackley n=30, Rosenbrock n=10.

def ackley source · line 123 · raw

@n:Nat -> Problem

def rosenbrock source · line 126 · raw

@n:Nat -> Problem

def sum_from source · line 129 · raw

@xs:List<&2, F32> -> F32

def sum_tail source · line 136 · raw

@xs:List<&2, F32> -> F32

def list_tail source · line 143 · raw

@xs:List<&2, F32> -> List<&2, F32>

def zdt_den source · line 150 · raw

@n:Nat -> F32

def zdt_g source · line 160 · raw

@+x:List<&2, F32> -> F32

C# Zdt1Problem.GLinear: 1 + 9 * sum(x[1..]) / (n - 1).

def zdt1_f source · line 164 · raw

@+x:List<&2, F32> -> List<&2, F32>

def zdt2_f source · line 169 · raw

@+x:List<&2, F32> -> List<&2, F32>

def zdt3_f source · line 176 · raw

@+x:List<&2, F32> -> List<&2, F32>

C# Zdt3Problem: g * (1 - sqrt(r) - r * sin(10 π x0)), r = x0/g.

def zdt4_term source · line 183 · raw

@+xi:F32 -> F32

def sum_zdt4 source · line 186 · raw

@xs:List<&2, F32> -> F32

def pred source · line 193 · raw

@n:Nat -> Nat

def zdt4_g source · line 201 · raw

@+x:List<&2, F32> -> F32

C# Zdt4Problem: 1 + 10*(n-1) + Σ_{i≥1} (x_i² - 10 cos(4 π x_i)).

def zdt4_f source · line 205 · raw

@+x:List<&2, F32> -> List<&2, F32>

def zdt6_f source · line 211 · raw

@+x:List<&2, F32> -> List<&2, F32>

C# Zdt6Problem: biased density. g = 1 + 9 * (mean of x[1..])^0.25.

def sum_sq_half source · line 220 · raw

@xs:List<&2, F32> -> F32

def tail_from_m source · line 227 · raw

@+x:List<&2, F32> -> @m:Nat -> List<&2, F32>

def dtlz2_g source · line 231 · raw

@+x:List<&2, F32> -> @m:Nat -> F32

C# DtlzHelper.GDtlz2: sum (x[i] - 0.5)^2 for i >= M-1.

def dtlz1_term source · line 234 · raw

@+xi:F32 -> F32

def sum_dtlz1 source · line 238 · raw

@xs:List<&2, F32> -> F32

def dtlz1_g source · line 247 · raw

@+x:List<&2, F32> -> @m:Nat -> F32

C# DtlzHelper.GDtlz1: 100 * ((n - M + 1) + Σ (d² - cos(20 π d))), d = x-0.5. On a legal k≥1 box the tail length is n-M+1, which is that coefficient.

def half_pi source · line 251 · raw

F32

def prod_cos.go source · line 254 · raw

@+x:List<&2, F32> -> @fuel:Nat -> @+i:Nat -> @acc:F32 -> F32

def prod_cos source · line 266 · raw

@+x:List<&2, F32> -> @n:Nat -> F32

def dtlz2_sin source · line 269 · raw

@+x:List<&2, F32> -> @+m:Nat -> @+i:Nat -> F32

def dtlz2_fi.tail source · line 272 · raw

@+x:List<&2, F32> -> @+m:Nat -> @+g:F32 -> @+i:Nat -> @+body:F32 -> @first:Bool -> F32

def dtlz2_fi source · line 280 · raw

@+x:List<&2, F32> -> @+m:Nat -> @+g:F32 -> @+i:Nat -> F32

C# Dtlz2Problem: (1+g) * prod_{j<M-i-1} cos(x[j] π/2) [* sin(x[M-i-1] π/2) if i>0].

def dtlz2_fs.go source · line 290 · raw

@+x:List<&2, F32> -> @+m:Nat -> @+g:F32 -> @fuel:Nat -> @+i:Nat -> List<&2, F32>

def dtlz2_f source · line 297 · raw

@+x:List<&2, F32> -> @+m:Nat -> List<&2, F32>

def prod_xs.go source · line 300 · raw

@+x:List<&2, F32> -> @fuel:Nat -> @+i:Nat -> @acc:F32 -> F32

def prod_xs source · line 307 · raw

@+x:List<&2, F32> -> @n:Nat -> F32

def dtlz1_scale source · line 310 · raw

@+body:F32 -> @+x:List<&2, F32> -> @+idx:Nat -> @first:Bool -> F32

def dtlz1_fi source · line 318 · raw

@+x:List<&2, F32> -> @+m:Nat -> @+g:F32 -> @+i:Nat -> F32

C# Dtlz1Problem: 0.5*(1+g) * prod_{j<M-i-1} x[j] [* (1-x[M-i-1]) if i>0].

def dtlz1_fs.go source · line 322 · raw

@+x:List<&2, F32> -> @+m:Nat -> @+g:F32 -> @fuel:Nat -> @+i:Nat -> List<&2, F32>

def dtlz1_f source · line 329 · raw

@+x:List<&2, F32> -> @+m:Nat -> List<&2, F32>

def dtlz3_f source · line 333 · raw

@+x:List<&2, F32> -> @+m:Nat -> List<&2, F32>

C# Dtlz3Problem: DTLZ2 map with DTLZ1's g.

def map_prefix_pow.go source · line 337 · raw

@fuel:Nat -> @xs:List<&2, F32> -> @+alpha:F32 -> List<&2, F32>

Fuel shrinks first so the recursive call terminates. The g-tail stays raw.

def map_prefix_pow source · line 349 · raw

@+xs:List<&2, F32> -> @fuel:Nat -> @+alpha:F32 -> List<&2, F32>

Raise the first fuel decision variables to α.

def dtlz4_f source · line 353 · raw

@+x:List<&2, F32> -> @+m:Nat -> @+alpha:F32 -> List<&2, F32>

C# Dtlz4Problem: DTLZ2 with x^α inside the sine/cosine map. g is still GDtlz2.

def pos_or.fin source · line 356 · raw

@+x:F32 -> @+fallback:F32 -> @ok:Bool -> F32

def pos_or source · line 363 · raw

@+x:F32 -> @+fallback:F32 -> F32

def dtlz7_g source · line 367 · raw

@+x:List<&2, F32> -> @m:Nat -> F32

C# Dtlz7Problem g: 1 + 9 * sum(x[M-1..]) / (n - M + 1).

def dtlz7_h.go source · line 372 · raw

@+x:List<&2, F32> -> @+g1:F32 -> @fuel:Nat -> @+i:Nat -> @acc:F32 -> F32

def dtlz7_prefix source · line 381 · raw

@+x:List<&2, F32> -> @fuel:Nat -> @+i:Nat -> List<&2, F32>

def dtlz7_f source · line 389 · raw

@+x:List<&2, F32> -> @+m:Nat -> List<&2, F32>

f[i]=x[i] for i<M-1; f[M-1]=(1+g)*h; h = M - Σ f_i/(1+g) * (1+sin(3 π f_i)).

def sum_sq source · line 399 · raw

@xs:List<&2, F32> -> F32

def sphere_f source · line 406 · raw

@+x:List<&2, F32> -> List<&2, F32>

def ackley_go source · line 415 · raw

@xs:List<&2, F32> -> @+s1:F32 -> @+s2:F32 -> Acc2

def ackley_den source · line 426 · raw

@n:Nat -> F32

def ackley_from source · line 433 · raw

@+n:Nat -> @acc:Acc2 -> List<&2, F32>

def ackley_f source · line 446 · raw

@+x:List<&2, F32> -> List<&2, F32>

C# AckleyProblem. n=0 stays total (denominator 1) instead of dividing by zero.

def rosen_step source · line 449 · raw

@rest:List<&2, F32> -> @+a:F32 -> F32

def rosenbrock_f source · line 458 · raw

@+x:List<&2, F32> -> List<&2, F32>

def eval_kind source · line 465 · raw

@kind:Family -> @+x:List<&2, F32> -> @+m:Nat -> @+alpha:F32 -> List<&2, F32>

def evaluate source · line 494 · raw

@+p:Problem -> @+ind:0xa2f9d6ef8c474468bf1de15ebe70c512/individual.Individual -> 0xa2f9d6ef8c474468bf1de15ebe70c512/individual.Individual

def evaluate_all source · line 498 · raw

@+p:Problem -> @+xs:List<&2, 0xa2f9d6ef8c474468bf1de15ebe70c512/individual.Individual> -> List<&2, 0xa2f9d6ef8c474468bf1de15ebe70c512/individual.Individual>

Independent per individual. Mid-split + parallel recurse; same order as cons.