Skip to content

valentin-stamate/Genetic-Algorithms-Playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Genetic Algorithms Playground

Introduction

This is a mini library for developing genetic algorithms.

Documentation

In order to solve a problem with a genetic algorithm, AbstractGeneticAlgorithm and AbstractMember should be extended because the library provides a general way of solving an optimization problem.

For example not every problem have the same method of calculating the fitness value, this is why AbstractMember doesn't implement it, as well as other methods.

Also, specific operators can be used by overriding the abstract ones that are given as parameter when a AbstractGeneticAlgorithm variable is instantiated. For every abstract operator, a default one is already implemented: OnePointCrossover, SimpleMutation, TournamentSelection.

The parameters such as population, mutation probability can be easily set by instantiating a GaConfig variable. Note that, before creating this instance also the gene length should be calculated first. Depending on the problem, this can have different lengths.

In the example given, the gene is calculated this way: geneLength = dimension * pointLenght where pointLenght is the bitmap length to represent a point in a given range with a given precision. All the points makes the coordinates of the point given to the function: Rastrigin's Function.

For debugging, there are two observers: one for every iteration and the other one for every generation. As parameters a copy of the population/member is given.

To test this library, Rastrigin's Function 6 was used to find the global minimum. The results are shown in the release section.

To use this library, download the .jar file provided in the release section.

Resources

The pdf resources are also available in resources folder.