|
Home page |
Shape Packing Applet |
InstructionsThis applet uses a Simulated Annealing algorithm to simulate a collection of identical shapes inside a larger shape. The code currently supports circles and regular polygons but the user interfaces restricts the latter to those with 3, 4, 5, 6, 7 and 8 sides. There are 4 user interface controls;
ExplanationThe algorithm dates back to my days in chemistry when I used to use Monte Carlo calculations to calculate the thermodynamic properties of collections of atoms and molecules. A big problem when using this method at low temperatures and high densities is that the particles tend to get stuck in non-equilibrium configurations. In this simulation the object is not so much to calculate the thermodynamic properties of the ensemble but to try and find the best packing of the smaller shapes inside the larger one. To do this we have to define an energy for a configuration in such a way that the minimum energy configuration corresponds to the best packing. The energy employed here is infinite if two shapes overlap or a shape is not entirely inside the container. Non overlapping shapes inside the container have zero energy. An additional contrubution is made by the size of the shapes, being equal to minus the common radius. The tendency to freeze in non optimal arrangements is provided by the temperature slider. It is best to run the simulation at moderate temperature so that the shapes get the chcnage to move around. When it looks like they are close to a solution the temperature can be reduced to optimise it. This method can't guarantee to get the best answer and only give an approximate value of the ratio of the shapes sizes (The size of a shape in this calculation is the radius of its circumcircle). Running the same simulation a number of times can show the range of possible and their rough packing efficiency. The really keen can take the best and calculate the precise efficiency from there. MovesAt each step of the simulation on of the following possible movement types is chosen;
The ReadoutThere are three lines of text output at the bottom left of the applet.
|
|
||||||||||||||||||||||||||||
|
(c) John Whitehouse 2011
|
|||||||||||||||||||||||||||||