The second example – a genetic algorithm

Genetic algorithms are adaptive heuristic search algorithms based on the natural selection principles use to generate good solutions to optimization and search problems. They work with possible solutions to a problem named individuals or phenotypes. Each individual has a representation formed by a set of properties named chromosomes. Normally, the individuals are represented by a sequence of bits, but you can choose the representation that better fits your problem.

You also need a function to determine whether a solution is good or bad named fitness function. The main objective of the genetic algorithm is to find a solution that maximizes or minimizes that function.

The genetic algorithm starts with a set ...

Get Mastering Concurrency Programming with Java 8 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.