parga-0.5.0.0: A parallel implementation of genetic algorithms.

parga-0.5.0.0: A parallel implementation of genetic algorithms.

This package provides both parallel and sequential implementations of genetic algorithms. It is still under development and a tutorial will be provided later.

The package offers two chromosome models:

It also offers two population models:

The list based implementations are intended primarily as educational. The implementation is documented in detail, using literate Haskell with LaTeX, to explain how the GA operates.

The recommended setup is two use unboxed vectors for the chromosomes and Repa arrays for the population. Operations on the Repa arrays are parallellised, taking advantage of multi-core machines.

At present only floating point genes are supported. The first step to set up a GA is to define a cost function, cost :: UChromosome -> Double assuming that the Unboxed Vector chromosome model is used.

The second step is to choose crossover and mutation functions, and define the Chromosome Configuration A reasonable choice is to use

chromcfg = ChromosomeConfig crossoverHybrid (mutateReplace p)

where p is the mutation probability. Then we need to make the GA configuration, like this

    cfg = Config {
            cConfig = chromcfg,
            cost = cost,
            keep = k,
            elite = n
       }

where n is the number of best chromosomes not subject to mutation and k is the number of chromosomes to keep from one generation to the next. The chromosomes kept are also the ones eligible to breed. If k is zero, no chromosomes are preserved and every chromosome is elligible to breed.

Now the solver can be run as follows

    winner = solveParallel h cfg clen psize ngen

where h is a file handle for log output, clen is the chromosome length, psize is the population size and ngen is the number of generations to run.

Modules