A continuous genetic algorithm in Lisp

Code: continuous-ga.lisp

A population of chromosomes is randomly created inside an n-dimensional hypercube bounded by the lists of coordinates maxs and mins.

The chromosomes’ coordinates can have any floating point values inside the hypercube.

Then the fitness of each chromosome is evaluated.

The fitness functions are in a separate file, continuous-fitness-functions.lisp.

Chromosomes are selected for reproduction according to the roulette wheel selection algorithm.

If selected, two chromosomes either mate and produce two children or are cloned into the new generation.

The probability of mating (or crossover) is p-c.

Mutation is also considered with the probability p-m.

Most children are born in the hypercube bounded by the coordinates of the parents.

Some children, however, have their coordinates outside the parental hypercube.

This is done in order to increase genetic diversity. The amount of such children and how far they are from the parental hypercube is determined by the parameter b.

The details of the crossover mechanism are in the functions mate and random-lin-comb.

The algorithm runs (the function run-ga) until either the termination condition (termination) is satisfied or the maximum number of iterations (max-iterations) is reached.

My termination condition is satisfied when the best value of the fitness in the population stops changing from generation to generation and is not less than the highest fitness value during the whole run.

Published in: on 26/02/2013 at 23:35  Leave a Comment  

The URI to TrackBack this entry is: https://burubaxair.wordpress.com/2013/02/26/a-continuous-genetic-algorithm-in-lisp/trackback/

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: