HSGEP-0.1.0: Gene Expression Programming evolutionary algorithm in HaskellSource codeContentsIndex
This module defines the types used for implementing GEP problems and operations. A few functions are also provided for convenience here for performing common operations.
data Genome = Genome {
terminals :: [Symbol]
nonterminals :: [Symbol]
geneConnector :: Symbol
maxArity :: Int
headLength :: Int
numGenes :: Int
type Symbol = Char
type Gene = [Symbol]
type Chromosome = [Symbol]
type Individual = Chromosome
type SymTable a = [(Symbol, a)]
tailLength :: Genome -> Int
geneLength :: Genome -> Int
allsymbols :: Genome -> [Symbol]
chromToGenes :: Chromosome -> Int -> [Gene]
genesToChrom :: [Gene] -> Chromosome
isNonterminal :: Symbol -> Genome -> Bool
data Genome Source
Data type representing a genome. The genome contains all necessary parameters to interpret a chromosome. These include the alphabet (split between terminal and nonterminal characters), connective characters for multi-gene chromosomes, the maximum arity of any nonterminal, the length of the head of a gene, and the number of genes per chromosome.
terminals :: [Symbol]Set of terminal symbols
nonterminals :: [Symbol]Set of nonterminal symbols
geneConnector :: SymbolSymbol connecting genes in a chromosome
maxArity :: IntHighest arity nonterminal function
headLength :: IntLength of gene head sequence
numGenes :: IntNumber of genes per chromosome
show/hide Instances
type Symbol = CharSource
A symbol in a chromosome
type Gene = [Symbol]Source
A gene in a chromosome is a list of symbols
type Chromosome = [Symbol]Source
A chromosome is a list of symbols. We avoided using a list of genes to maintain the view of a chromosome as nothing more than a flattened, linear sequence of genes.
type Individual = ChromosomeSource
An individual is a chromosome
type SymTable a = [(Symbol, a)]Source
Symbol table used for fitness tests. We assume that there is exactly one pair per symbol. If there are symbols missing, fitness testing may fail (the library does not have facilities yet to allow for default values). If a symbol occurs multiple times in the symbol table, no guarantee is provided for which value will be chosen.
:: GenomeGenome
-> IntNumber of symbols in a gene tail
Return the length of the tail of a gene for a given genome
:: GenomeGenome
-> IntTotal length of a gene.
Return length of a gene (tail + head) for a given genome
:: GenomeGenome
-> [Symbol]List of symbols
Given a genome, provide the list of all symbols possible in a chromosome. This is just nonterminals ++ terminals.
:: ChromosomeChromosome to split into a set of genes
-> IntLength of a single gene
-> [Gene]Ordered list of genes from chromosome
Fracture a chromosome into a set of genes
:: [Gene]List of genes
-> ChromosomeChromosome assembled from genes
Assemble a chromosome from a set of genes
:: SymbolSymbol to test
-> GenomeGenome providing context
-> BoolTrue if symbol is a nonterminal, false otherwise
Test if a symbol is a nonterminal
Produced by Haddock version 2.6.1