SonneRevsson
SonneRevsson

Reputation: 95

Algorithm for Box Selection / Space Optimization

So, I have an optimization/space management problem. This same question is posted on two SE sites simultaneously, Stack Overflow and Mathematics, since I think it is fitting for both.

Let's say I have containers of (X, Y) dimensions. Inside, I want to place as many smaller containers of (x_i, y_i) dimensions as possible. These smaller containers can vary in size. Inside these smaller containers, I have a given item which is the smallest unit I have.

Basically: Items, inside variable small boxes, inside variable big boxes.

Provided I know all of the following:

Is there any known algorithm that can be applied to determine the following:

IF this is a thing that already exists, can it be extended to three dimensions, rather than only two, as my example states? That is to say, calculate packaging configurations for dimensions (x, y, z).

EXAMPLE: I have

Through trial and error (or intuition?), I can see that a valid configuration is as follows:

All inside a single 5x5 container.

Now, it's a matter of tetrising/tangraming my way into a solution. So, for example, the following two are valid placements/configurations:

Valid Configurations

While this one isn't since it would require a second large container:

Invalid Configuration

Upvotes: 1

Views: 1939

Answers (1)

lalebarde
lalebarde

Reputation: 1816

This is the well known rectangle packing problem or Korf's problem. Here is a simple solution with MiniZinc with the restriction of not turning the rectangles. Other answers here.

Upvotes: 1

Related Questions