Expected optimization time
Lax343628.Runtime · concepts/Lax343628/Runtime.lean · lax-343628
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
The genetic algorithm with crossover probability is run on , starting from individuals chosen independently and uniformly at random from . Its optimization time is the number of iterations until the population first contains the optimum . The expected optimization time is .
Concept map
Lean source view on GitHub
| 1 | import Lax343628.Algorithm |
| 2 | import Mathlib.Topology.Algebra.InfiniteSum.ENNReal |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: Expected optimization time |
| 7 | type: definition |
| 8 | --- |
| 9 | The genetic algorithm with crossover probability is run on |
| 10 | , starting from individuals chosen independently and uniformly at |
| 11 | random from . Its optimization time is the number of iterations until the |
| 12 | population first contains the optimum . The expected optimization time is . |
| 13 | -/ |
| 14 | |
| 15 | namespace Lax343628.Runtime |
| 16 | |
| 17 | open Lax343628.Algorithm |
| 18 | open scoped ENNReal Classical BigOperators |
| 19 | |
| 20 | noncomputable section |
| 21 | |
| 22 | /-- The population distribution after iterations of the GA. |
| 23 | Initialization is uniform over all indexed populations, equivalently independent uniform |
| 24 | initial individuals. Each subsequent iteration uses `step` with fitness . -/ |
| 25 | def populationLaw (n k : ℕ) (μ : ℕ+) (p_c : ℝ) : ℕ → PMF (Population n μ) |
| 26 | | 0 => PMF.uniformOfFintype (Population n μ) |
| 27 | | t + 1 => do |
| 28 | let P ← populationLaw n k μ p_c t |
| 29 | step (jump k) p_c P |
| 30 | |
| 31 | /-- The probability that the population after iterations does not contain . |
| 32 | For , this equals : since has the unique |
| 33 | maximal fitness, it is deleted only when all entries equal , so it is never |
| 34 | lost once present. -/ |
| 35 | def tailProbability (n k : ℕ) (μ : ℕ+) (p_c : ℝ) (t : ℕ) : ℝ≥0∞ := |
| 36 | ∑ P : Population n μ with (∀ i, P i ≠ optimum n), |
| 37 | populationLaw n k μ p_c t P |
| 38 | |
| 39 | /-- The expected optimization time . |
| 40 | The sum is in nonnegative extended reals and may equal infinity. An optimum already present |
| 41 | in the initial population is found at time zero. -/ |
| 42 | def expectedRuntime (n k : ℕ) (μ : ℕ+) (p_c : ℝ) : ℝ≥0∞ := |
| 43 | ∑' t : ℕ, tailProbability n k μ p_c t |
| 44 | |
| 45 | end |
| 46 | end Lax343628.Runtime |
| 47 |
Builds on
From Mathlib
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments