Demo Fortran90 Genetic Algorithm Code

NOTE: The following is what I wrote during my Doctorate and has not been modified since. Please treat as such!!
To copy the code you can right click in the text area.

The code is written in Fortran 90. All undeclared variables are real unless the variable name begins with the letters I-N in which case the are integers. The routine for setting the random seed is specific to the ftn90 compiler for pc’s by NAG/Salford software, otherwise it should work on any Fortran 90 compiler. In the code anything following a ‘!’ is a comment.

The following code is included as a demonstration of a genetic algorithm optimisation procedure. The subroutine CALCSUITABILITY determines the 'performance' of each candidate solution on which the tournament selection procedure is based in the subroutine BREED. In this particular example the more identical adjacent bits in the string the better the suitability. Each bit can have values of 0,1,2 or 3

F90 Code