Genetic algorithms solution

To interact with the CartPole environment and solve it using a genetic algorithm, we've created the Python program,, which is located at

Since we are using a list of floats to represent a solution—the network's weights and biases—this program is very similar to the function optimization programs we looked at in Chapter 6, Optimizing Continuous Functions, such as the one we used for the Eggholder function's optimization.

The following steps describe the main parts of this program:

  1. We start by creating an instance of the CartPole class, which will allow us to test the various ...

Get Hands-On Genetic Algorithms with Python 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.