hmep-0.0.0: HMEP Multi Expression Programming – a genetic programming variant encoding multiple solutions

Safe HaskellNone
LanguageHaskell2010

AI.MEP.Operators

Description

Genetic operators

Synopsis

Documentation

data Config n a Source #

Constructors

Config 

Fields

defaultConfig :: Config Char Double Source #

defaultConfig = Config
  {
    p'const = 0.1
  , p'var = 0.4
  , p'mutation = 0.1
  , p'crossover = 0.9

  , c'length = 30
  , c'popSize = 40
  , c'popN = 1
  , c'ops = V.empty  -- <-- To be overridden
  , c'vars = V.singleton 'X'
  }

crossover :: Ord n => Chromosome n a -> Chromosome n a -> Rand (Chromosome n a, Chromosome n a) Source #

Uniform crossover operator

swap :: Double -> (t, t) -> Rand (t, t) Source #

replaceAt :: Int -> a -> Vector a -> Vector a Source #

mutation3 Source #

Arguments

:: Ord n 
=> Config n Double

Common configuration

-> Chromosome n Double 
-> Rand (Chromosome n Double) 

Mutation operator with up to three mutations per chromosome

smoothMutation Source #

Arguments

:: Ord n 
=> Double

Probability of gene mutation

-> Config n Double

Common configuration

-> Chromosome n Double 
-> Rand (Chromosome n Double) 

Mutation operator with a fixed mutation probability of each gene

newChromosome Source #

Arguments

:: Ord n 
=> Config n Double

Configuration

-> Rand (Chromosome n Double) 

Randomly initialize a new chromosome. By definition, the first gene is terminal (a constant or a variable).

new Source #

Arguments

:: Ord n 
=> Double

Probability to produce a constant

-> Double

Probability to produce a variable

-> Vector n

Variable labels vector

-> Vector (F Double)

Operations vector

-> Int

Maximal operation index

-> Rand (Gene Int n Double) 

Produce a new random gene

newTerminal Source #

Arguments

:: Ord n 
=> Double

Probability p of a constant generation. 1-p will be the probability of a variable generation.

-> Vector n

Variables vector

-> Rand (Gene Int n Double) 

newVar :: Ord n => Vector n -> Rand (Gene Int n a) Source #

A random variable from the variables vector

newOp :: Vector (F a) -> Int -> Rand (Gene Int n a) Source #

A random operation from the operations vector

newCNormal Source #

Arguments

:: Double

Mean

-> Double

Std deviation

-> Rand (Gene Int n Double) 

Draw a constant from the normal distribution

newC :: Rand (Gene i n Double) Source #

Draw a constant from the uniform distribution