Wolfram Language Paclet Repository
Community-contributed installable additions to the Wolfram Language
Pack smaller rectangles into a larger rectangle
Contributed by: Jason Biggs, Wolfram Research
This paclet contains functions for packing rectangles into a rectangular area, the two-dimensional bin packing problem. No circles, no ovals, hexagons are right out as well. Squares, being a type of rectangle, are also processed, but other quadrilaterals are not.
To install this paclet in your Wolfram Language environment,
evaluate this code:
PacletInstall["JasonB/RectanglePacking"]
Pack eight smaller rectangular areas, given as a list of {width, height} pairs, into a 20 by 30 rectangular space:
In[1]:= | ![]() |
Out[1]= | ![]() |
Visualize the results:
In[2]:= | ![]() |
Out[2]= | ![]() |
Visualize the sequential packing of a set of random rectangles:
In[3]:= | ![]() |
Out[6]= | ![]() |
Create a mutable rectangle packing data structure:
In[7]:= | ![]() |
Out[7]= | ![]() |
Insert some rectangles:
In[8]:= | ![]() |
Out[8]= | ![]() |
Visualize the state of the packing object:
In[9]:= | ![]() |
Out[9]= | ![]() |
Add a fixed rectangle:
In[10]:= | ![]() |
Out[11]= | ![]() |
Add more rectangles:
In[12]:= | ![]() |
Out[13]= | ![]() |
Try to insert a rectangle that is too large to fit in the remaining space:
In[14]:= | ![]() |
Out[14]= | ![]() |
In[15]:= | ![]() |
Out[10]= | ![]() |
Wolfram Language Version 13.0