parga-0.5.0.0: A parallel implementation of genetic algorithms.

Stabilityexperimental
Maintainergeorg@schaathun.net
Safe HaskellNone

AI.GA.Parallel

Description

This module provides a parallel implementation of GA based on the repa package.

The core of module is an instance of the Population class, implementing a collection of chromosomes using Repa arrays.

Synopsis

Documentation

type ParPop c g = Array V DIM1 (c, g, Double)

The ParPop type represents a population as a one-dimensional Repa Array. This enables parallellisation of the random operations on chromosomes. The elements can be any Chromosome type, but it is expected that unboxed vectors will normally be used.

solveIOP

Arguments

:: (MonadIO m, SplittableRandMonad g m, Chromosome c) 
=> Chan (ParPop c g)

Channel for logging

-> Config c (ParPop c g) g

Configuration of the GA

-> Int

Chromosome length

-> Int

Population size

-> Int

Number of generations

-> m c

Best chromosome

The solveIOP instantiates and runs a genetic algorithm using the configuration provided. It is similar to the solveIO function except that it is constrained to the ParPop type.

solveParallel

Arguments

:: Chromosome c 
=> Handle

File handle for log output

-> Config c (ParPop c TFGen) TFGen

Configuration of the GA

-> Int

Chromosome length

-> Int

Population size

-> Int

Number of generations

-> IO c

Best chromosome

The solveParallel function integrates does much of the setup, including calling ioThread before calling solveIOP. Thus it is a simpler and more high-level alternative for the user. It uses the TFGen pseudo-random generator, which is the only known satisfactory alternative.

mkConfigP :: (ConfigurableChromosome c g, NFRandomGen g) => g -> Param -> Config c (ParPop c g) g

This function proceses command line options from a Param object and constructs a Config object for a parallel GA.

TODO: This must be reviewed carefully.