Safe Haskell | Safe-Infered |
---|
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 :: (RandomGen g, Random a, Enum a) => Int -> Int -> a -> a -> Rand g [Genome a]
- fitPropSelect :: RandomGen g => [(a, Fitness)] -> Rand g a
- tournamentSelect :: [(a, Fitness)] -> Int -> Rand PureMT 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 :: (RandomGen g, Random a, Enum a) => Int -> Int -> a -> a -> Rand g [Genome a]Source
Returns a list of len
random genomes who has length genomeLen
made of
elements in the range [from,to]
.
fitPropSelect :: RandomGen g => [(a, Fitness)] -> Rand g 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 PureMT 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.