parga-0.5.0.0: A parallel implementation of genetic algorithms.

Stabilityexperimental
Maintainergeorg@schaathun.net
Safe HaskellNone

AI.GA.Chromosome.Functions

Description

This module provides crossover and mutation functions.

Synopsis

Documentation

class Gene d where

A Gene is an element of a chromosome. We need a function to generate a random Gene.

Methods

randomGene :: RandMonad m => m d

Instances

class (Chromosome c, Gene d) => ChromosomeGene c d | c -> d where

ChromosomeGene extends Chromosome with further methods which have to be parameterised on the gene type. This is used only in the definition and configuration of crossover and mutation.

Methods

mapGeneM :: Monad m => (d -> m d) -> c -> m c

The mapGeneM function maps a monadic function on each gene.

crossoverMap :: RandMonad m => (d -> d -> m (d, d)) -> c -> c -> m (c, c)

The crossoverMap function does crossover by applying a random function to each gene pair in a pair of chromosomes. This is used by the crossoverScattered function.

crossoverScattered :: RandMonad m => c -> c -> m (c, c)

Scattered crossover function. This is the default crossover function in Matlab.

mutateReplace :: RandMonad m => Double -> c -> m c

The mutateReplace function replaces mutated genes with a random value, independently of the original gene value.

class (ContinuousGene d, ChromosomeGene c d) => ContinuousChromosomeGene c d | c -> d where

Methods

mutateNoise

Arguments

:: RandMonad m 
=> Double

Mutation probability

-> d

Maximum absolute value of noise

-> c

Chromosome

-> m c

Mutated chromosome in a monad

Several mutation operations are possible. The mutateNoise function mutates by adding uniformly distributed random noise.