I saw a thesis on a similar topic (circular coverage on the RGB plane), based on an evolutionary approach.
- The objective function has been clearly defined (How many squares? How big? Can they intersect? You probably want to fine small or overlapping squares).
- You can start by launching the k-means data preprocessing algorithm, i.e. find the potential center points of the squares.
As I recall, SGA, CGA and eCGA were compared (CGA started with initial coverage based on k-means), and SGA was superior to the rest. They were launched based on the image. Within a few minutes there were about 30 people and 20 generations with lead times.
For SGA, the crossover operator will take two parents at a time and pair closed / most similar circles from both parents. Then, for each pair, he will draw a children's circle somewhere in the middle with a radius also between the two circles. (Although I would advise not to take the values exactly between the parents, but to allow +/- 15% outside the range, which will save the population from premature convergence).
With rectangles, you have to slightly change the approach; each rectangle can be a tuple (x, y, width, height, rotation), with x and y being the center coordinates.
source share