This is a mini library for developing genetic algorithms.
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.
- Teacher Website
- Homework Repo
- Snake Project Commit
- Gray Code
- Random In Java
- Crossover Types
- Numerical Representation
- Numerical Optimization
The pdf resources are also available in resources
folder.