parga-0.5.0.0: A parallel implementation of genetic algorithms.

Safe HaskellNone

AI.GA.Population.List

Description

This module provides a simple implementation of a Population using lists.

Synopsis

Documentation

type ListPop c = [c]

The population is simply a list of chromosomes. The chromosome can be any instance of the Chromosome class.

solveIOL

Arguments

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

Channel for logging

-> Config c (ListPop c) g

Configuration of the GA

-> Int

Chromosome length

-> Int

Population size

-> Int

Number of generations

-> m c

Best chromosome

The solveIO takes the configuration as an input parameter and solves the GA to return the best chromosome. This is simply a wrapper around the solveIOinner function.

solveListPop

Arguments

:: Chromosome c 
=> Handle

File handle for log output

-> Config c (ListPop c) TFGen

Configuration of the GA

-> Int

Chromosome length

-> Int

Population size

-> Int

Number of generations

-> IO c

Best chromosome

The solveListPop function integrates does much of the setup, including calling ioThread before calling solveIO. 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.

augSort :: Ord b => [(a, b)] -> [(a, b)]

rankWeight :: [(c, Double)] -> [(c, Double)]

applyCrossover :: PopulationTypeX c p g m => p -> ReaderT (Config c p g) m p

applyMutation :: PopulationTypeX c p g m => p -> ReaderT (Config c p g) m p