mercredi 22 août 2018

Split given rectangle into N given rectangles

I am trying to develop a python program that solves the following problem:

I have two given rectangles of width and height given, let's say: W1*H1 and W2*H2; I want to "cut-out" N given rectangles, which widths and heights are given as well, let's say: w_i and h_i for i in range(1, N). The orientation of the rectangles is interchangeable: w_i and h_i can be switched for every i.

I'm sure that my set of smaller rectangles all fit in the two bigger rectangles (the sum of the areas of the two big ones is bigger than the sum of the N small ones). The result should be a graph which shows me the (random) disposition of all the cut-outs... the best solution would be to maximize the "left-over" area, although it is fine if it comes out randomly (I figured I could just do it many-many times at pick the more suitable result).

I know it's not an easy question and I really hope someone can help, thanks in advance!




Aucun commentaire:

Enregistrer un commentaire