Genetic Algorithm Problem Solver
Single-threaded (currently working on concurrency) program to solve problems using genetic algorithm.
Individual
Represents single solution to a problem with a sequence of 0's and 1's.
Defined with genome length: (Int) and function: (Vector[Boolean] => Double) to compute fitness of the solution.
Public interface contains methods:
-
mutate: (Double => Individual) creates new Individual based on a mutation probability.
-
cross: ((Individual, Double) => (Individual, Individual)) produces pair of children from crossing two Individuals.
GeneticAlgorithm
Defined with population size, crossing probability, mutation probability and a population (generation).
To create GA it is needed to provide fitness function: (Vector[Boolean] => Double) as well (will be changed).
Public interface contains methods:
-
calculateSequentialStatic: (Int => GeneticAlgorithm) calculates given iterations in a single thread without adjusting mutation and crossing probabilities.
-
solution: (String) returns the solution with the highest fitness value of the generation contained in this GeneticAlgorithm object.
Working on implementation of:
- calculateSequentialDynamic: (Int => GeneticAlgorithm)
- calculateParallelStatic: (Int => GeneticAlgorithm)
- calculateParallelDynamic: (Int => GeneticAlgorithm)
- Michal Szturo - Initial work - mstr93
Version 1.1, December 2016
Copyright (C) 2018 Michal Szturo
Everyone is permitted to copy and distribute verbatim or modified copies of this license document.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
Do whatever you like with the original work, just don't be a dick.
Being a dick includes - but is not limited to - the following instances:
1a. Outright copyright infringement - Don't just copy this and change the name.
1b. Selling the unmodified original with no work done what-so-ever, that's REALLY being a dick.
1c. Modifying the original work to contain hidden harmful content. That would make you a PROPER dick.
-
If you become rich through modifications, related works/services, or supporting the original work, share the love. Only a dick would make loads off this work and not buy the original work's creator(s) a pint.
-
Code is provided with no warranty. Using somebody else's code and bitching when it goes wrong makes you a DONKEY dick. Fix the problem yourself. A non-dick would submit the fix back.
-
Phil Sturgeon - Providing a license - philsturgeon
-
Stephen McDonald - Providing examples for MergeSort in Akka - stephenmcd