Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Genetic Algorithm, written in Erlang. Each genome / individual is a process
Erlang
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
Makefile
Readme.md
environment.erl
fitness.erl
individual.erl
monitor.erl
monitor_trigger.erl
records.hrl
simple.plot
stress.sh
tick.erl

Readme.md

Genetic Algorithm (Erlang)

Description

A simple genetic algorithm where each genome / individual is a single process.

The crossover implementation can only handle populations which are divisible by four. Other populations will also be processed, but mixed up with simple cloned individuals. If crossover isn't enabled there are no restrictions.

Structure

individual.erl

The gen_server which represents the indivdiual

environment.erl

The gen_server which holds the population and manages the individuals

monitor.erl

A simple monitor which writes some statistics to a plain text file This file can be plot with

$ gnuplot simple.plot

monitor_trigger.erl

A simple monitor which can be used to trigger external events or write special formated statistics. The following example writes each 10 ticks the tickcount and the unix timestamp to the file special_statistics:

monitor_trigger:start("echo -n ~w~i~i >> special_statistics; date '+ %s' >> special_statistics", 10, format). 

For more details check the header of the module.

Usage

Before the first run (or after sourcecode modifications) you need to compile the .erl files. This can be done by hand

$ erlc environment.erl individual.erl monitor.erl

or with the include makefile

$ make

To start the simple default environment use

$ erl -s monitor start -s environment start

and initialize evolution with

environment:tick(Count).

where Count is the amount of iterations which should be calculated.

Results will be automatically saved in default_results.

The actual state could be requested with

environment:gene_pool().

or

environment:fitness().

For further details check the source code annotations.

Performance

Intel(R) Core(TM) i7 CPU 950 @ 3.07GHz (mostly idle):

100,000 cycles with default parameters (100 Individual, 8Bit Genome) are computed in less than 45 minutes.

Licence

GNU General Public License v3

Something went wrong with that request. Please try again.