Utilitify functions that makes it easier to write the genetic operators and functions for doing calculations on the EA data.

- avgFitnesses :: [[(Genome a, Fitness)]] -> [Fitness]
- maxFitnesses :: [[(Genome a, Fitness)]] -> [Fitness]
- minFitnesses :: [[(Genome a, Fitness)]] -> [Fitness]
- stdDeviations :: [[(Genome a, Fitness)]] -> [Double]
- randomGenomes :: (Random a, Enum a) => Int -> a -> a -> StdGen -> [Genome a]
- fitPropSelect :: [(a, Fitness)] -> Rand StdGen a
- tournamentSelect :: [(a, Fitness)] -> Int -> Rand StdGen a
- sigmaScale :: [Fitness] -> [Fitness]
- rankScale :: [Fitness] -> [Fitness]
- elite :: [(a, Fitness)] -> [a]
- getPlottingData :: [[(Genome a, Fitness)]] -> String

# Documentation

avgFitnesses :: [[(Genome a, Fitness)]] -> [Fitness]Source

Returns the average fitnesses for a list of generations.

maxFitnesses :: [[(Genome a, Fitness)]] -> [Fitness]Source

Returns the maximum fitness per generation for a list of generations.

minFitnesses :: [[(Genome a, Fitness)]] -> [Fitness]Source

Returns the minimum fitness per generation for a list of generations.

stdDeviations :: [[(Genome a, Fitness)]] -> [Double]Source

Returns the standard deviation of the fitness values per generation fot a list of generations.

randomGenomes :: (Random a, Enum a) => Int -> a -> a -> StdGen -> [Genome a]Source

Returns an infinite list of random genomes of length `len`

made of elements
in the range `[from,to]`

fitPropSelect :: [(a, Fitness)] -> Rand StdGen aSource

Fitness-proportionate selection: select a random item from a list of (item, score) where each item's chance of being selected is proportional to its score

tournamentSelect :: [(a, Fitness)] -> Int -> Rand StdGen aSource

Performs tournament selection amoing `size`

individuals and returns the winner

sigmaScale :: [Fitness] -> [Fitness]Source

Applies sigma scaling to a list of fitness values. In sigma scaling, the standard deviation of the population fitness is used to scale the fitness scores.

rankScale :: [Fitness] -> [Fitness]Source

Takes a list of fitness values and returns rank scaled values. For a list of *n* values, this
means that the best fitness is scaled to *n*, the second best to *n-1*, and so on.

elite :: [(a, Fitness)] -> [a]Source

takes a list of (genome,fitness) pairs and returns a list of genomes sorted by fitness (descending)

getPlottingData :: [[(Genome a, Fitness)]] -> StringSource

takes a list of generations and returns a string intended for plotting with gnuplot.