Over to You
You now have a genetic algorithm to solve a specific problem. You can change the fitness function to solve other problems. You can play around with the parameters—the epochs, the number of items in a population, etc. Let’s take a final look at what happened and how you can tweak your solution.
Does your cannon tend to fire balls to the right or left? How often do you get some going one way and some going the other way? Finding more than one solution can be a challenge, so it is covered more in Chapter 10, Optimize! Find the Best. How can you encourage solutions to prefer one side over the other? Giving solutions going to your preferred side a bonus in the fitness function works. Or equally, anything going to the other side can ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access