Skip to content
Rainbow docs menu

Reference · The Applied Higher-Order Functions catalogue

rainbow.algorithms.proofs.ahof.roulette-selection

The Applied Higher-Order Functions cataloguesrc/rainbow/algorithms/proofs/ahof/roulette_selection.clj1 definitions, 3 theorems

AHoF genetic-algorithm operator: fitness-proportionate (roulette-wheel) selection. Individuals are chosen for reproduction with probability proportional to fitness. The wheel is the cumulative fitness (a prefix-sum scan); a spin s selects the first individual whose cumulative fitness reaches s: lands? cumulative s = decide (s <= cumulative) over exact-rational cumulative fitness. Proved native and axiom-free: the landing test and worked instances on concrete values -- spin 6 lands on an individual with cumulative fitness 9; the worked certificate 6 <= 9 as a native nnrat/at-most; and an individual with cumulative fitness 4 is passed over by spin 6. The cumulative wheel (a prefix-sum scan) and the RNG spin are executable. What is proved here is the landing decision at these instances; that selection probability is proportional to fitness is the classical property of the operator and is not proved here. Requires nnrat/at-most, audit/decide-nnrat-at-most, nnrat/decide-at-most-true-sound (all in the D63 checkpoint). Scope (measured by the kernel): this module has 3 worked instances (statements about specific values). None of its theorems is a guarantee about the algorithm for all inputs; `lein verify rainbow.algorithms.proofs.ahof.roulette-selection` prints this classification.

roulette/lands?

DefinitionSource, line 54

roulette/lands? :
  (x₁ x₂ : ℚ≥0)
  → data/Bool

ℚ≥0 = nnrat/NonnegativeRational

roulette/lands-on-individual

TheoremWorked exampleNo axiomsSource, line 71

roulette/lands-on-individual :
  → bo/is-safe 9 6 = data/true

= = equality/Eq

roulette/landing-is-valid

TheoremWorked exampleNo axiomsSource, line 79

roulette/landing-is-valid :
  → 6 ≤ 9

≤ = nnrat/at-most

roulette/passes-over-below-spin

TheoremWorked exampleNo axiomsSource, line 86

roulette/passes-over-below-spin :
  → bo/is-safe 4 6 = data/false

= = equality/Eq