Member-only story
Genetic Algorithms in C++
Much of this post is based on Machine Learning: An Algorithmic Perspective by Stephen Marsland. This book offers easy-to-follow and understand introductions to practically every field of machine learning including deep learning, evolutionary learning, and reinforcement learning. A good resource for a much more in-depth introduction to genetic algorithms can be found in An Introduction to Genetic Algorithms (Complex Adaptive Systems) by Melanie Mitchell.
Genetic algorithms (GAs) are powerful optimization techniques beneficial when dealing with large datasets or optimization problems with no efficient algorithms (e.g. NP-complete problems). GAs are not guaranteed to find the optimal solution for any parameterization but often find a “close enough” sub-optimal solution in less time than slower (often brute-force) algorithms. In this post, GA methodology is introduced, and an example GA is implemented in C++ using the GALib library to solve the NP-complete Knapsack problem.
Genetic Algorithms
The genetic algorithm (GA) models the genetic process by evolving a population of potential solutions that optimize a fitness function. This is done via modeling, particularly, sexual reproduction as “parents”, drawn from the population, are combined in certain ways to create offspring. Hypothetically, choosing parents with “good” fitness scores, with…