evokit.tools.diversity package

Module contents

Toolset for diversity maintenance.

evokit.tools.diversity.share_fitness(pop: Population, sigma_share: float, alpha: float, distance_measure: Callable[[Individual, Individual], float]) None[source]

Perform fitness sharing [1] by adjusting (in-place) the Individual.fitness of each individual in a population.

The fitness is updated according to the following expression:

x_i\mathrm{.fitness} \leftarrow
\frac{x_i\mathrm{.fitness}}{\sum^{|\mathcal{P}|}_{j}
{\mathrm{sh}\,(d(x_i,x_j))}}

where

\[
\mathrm{sh}\,(k) =
\left\{
\begin{array}{ll}
    1 - (k / \sigma_{\mathrm{share}})^{\alpha}
        & \mathrm{if}~k \le \sigma_{\mathrm{share}} \\
    0 & \mathrm{otherwise.}
\end{array}
\right.
\]