Safe Haskell | Safe-Inferred |
---|
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 Sequence = [Char]
- type Gene = Sequence
- type Chromosome = Sequence
- type SymTable a = [(Symbol, a)]
- type ExpressionFunction a = Chromosome -> Genome -> a
- tailLength :: Genome -> Int
- geneLength :: Genome -> Int
- allsymbols :: Genome -> [Symbol]
- chromToGenes :: Chromosome -> Int -> [Gene]
- genesToChrom :: [Gene] -> Chromosome
- isNonterminal :: Symbol -> Genome -> Bool
Types
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.
Genome | |
|
A sequence of symbols not neccessaryly a gene or chromosome. Used in gene operations.
type Chromosome = SequenceSource
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 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.
type ExpressionFunction a = Chromosome -> Genome -> aSource
Function to express an individual into a list of ET structures
Functions
Return the length of the tail of a gene for a given genome
Return length of a gene (tail + head) for a given genome
Given a genome, provide the list of all symbols possible in a chromosome. This is just nonterminals ++ terminals.
:: Chromosome | Chromosome to split into a set of genes |
-> Int | Length of a single gene |
-> [Gene] | Ordered list of genes from chromosome |
Fracture a chromosome into a set of genes
:: [Gene] | List of genes |
-> Chromosome | Chromosome assembled from genes |
Assemble a chromosome from a set of genes