| Stability | experimental |
|---|---|
| Maintainer | georg@schaathun.net |
| Safe Haskell | None |
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.
- type ParPop c g = Array V DIM1 (c, g, Double)
- solveIOP :: (MonadIO m, SplittableRandMonad g m, Chromosome c) => Chan (ParPop c g) -> Config c (ParPop c g) g -> Int -> Int -> Int -> m c
- solveParallel :: Chromosome c => Handle -> Config c (ParPop c TFGen) TFGen -> Int -> Int -> Int -> IO c
- mkConfigP :: (ConfigurableChromosome c g, NFRandomGen g) => g -> Param -> Config c (ParPop c g) g
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.
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 |
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