How to Breed Solutions
You know the solutions are pairs of numbers, which you need to initialize. You can weed out a few numbers with a little thought since they are bound to fail. Armed with a handful of initial attempts, you need a way to pick better ones to breed even better solutions. Once you have a clear idea of the backbone of the algorithm, you can implement the crossover operator to breed new solutions and mutate these from time to time in Python (either 2.x or 3.x), as described in Let’s Fire Some Cannons. Feel free to write the code as you read, or start thinking about how you want to implement this. Be sure to write some unit tests so that you can use these for Mutation Testing.
Starting Somewhere
The GA needs pairs of velocities ...
Get Genetic Algorithms and Machine Learning for Programmers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.