Simplifying the solution
In the implementation we have just seen, there were measures in place to restrict the size of the trees that represent the candidate solutions. However, the best solution we found seems overly complex. One way to pressure the algorithm into producing simpler results is to impose a small cost penalty for complexity. The penalty should be small enough, though, to refrain from favoring simpler solutions that fail to solve the problem. It should rather serve as a tie-breaker between two good solutions, so the simpler of the two will be preferred. This approach has been implemented in the Python program 02-gp-even-parity-reduced.py, which is located at https://github.com/PacktPublishing/Hands-On-Genetic-Algorithms-with-Python/blob/master/Chapter12/02-gp-even-parity-reduced.py ...
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