Skip to main content

sbx_child

Function sbx_child 

pub fn sbx_child(x1: f64, x2: f64, u: f64, eta: f64) -> f64
Expand description

One child coordinate of simulated binary crossover (Deb & Agrawal 1995).

SBX imitates the behaviour of single-point binary crossover on real numbers: with a spread factor β drawn from the distribution

β = (2u)^(1/(η_c+1))              for u ≤ 0.5
β = (1 / (2(1−u)))^(1/(η_c+1))    for u > 0.5

the two children are placed symmetrically about the parents’ midpoint:

c₁ = ½·((1+β)·x₁ + (1−β)·x₂)
c₂ = ½·((1−β)·x₁ + (1+β)·x₂)

This returns c₁, clamped into [0, 1]. u ≤ 0.5 gives β ≤ 1 — a contracting child, between the parents — and u > 0.5 gives β ≥ 1, an expanding child outside them; the two branches are what make SBX explore rather than merely interpolate, and swapping them turns the operator into a slow blender that never leaves the parents’ convex hull.

The distribution index η_c controls the spread: large η_c concentrates children near the parents, small η_c spreads them out. The customary value is 20 (DEFAULT_CROSSOVER_ETA).

Identical parents give back that parent for every u, which is correct: SBX has no diversity to work with there, and it is the mutation operator’s job to supply some.

A u at or beyond 1 would send β to infinity and the child to NaN; the result is checked and falls back to x₁ rather than propagating one. The callers here draw u from [0, 1), so that path is a guard, not a behaviour.