To reconstruct a given image with a set of semi-transparent overlapping polygons using a genetic algorithm, we've created a Python program called 01-reconstruct-with-polygons.py, which is located at https://github.com/PacktPublishing/Hands-On-Genetic-Algorithms-with-Python/blob/master/Chapter11/reconstruct-with-polygons.py.
Since we are using a list of floats to represent a solution – the polygons' vertices, colors, and transparency values – this program is very similar to the function optimization programs we saw 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:
- We start by setting ...