# Container Packing

This part of the course looks at methods for packing boxes and other containers.

Example

Rubbo rubbers have the dimensions 65 x 23 x 13 mm

How many of these rubbers can fit into a box which has dimensions 13.2 x 11.8 x 2.8 cm ?

Solution

Look at the dimensions and see how you can fit the rubbers into the box.

Pay attention to the units !

65 x 23 x 13 mm

is

6.5 x 2.3 x 1.3 cm

The box has dimensions 13.2 x 11.8 x 2.8 cm

so the base could be filled with 10 rubbers on the base :

And two layers high

Giving twenty rubbers in total.

## First Fit Algorithm

This is a rather simplistic way of putting items into a container.

It is the method used for the SQA National 4 Lifeskills Maths course.

Items are taken in order of arrival and placed in the container.

Example

A box can only hold 10 Kg.

Pack the following weights into boxes : 7kg, 8Kg, 2 Kg, 3 Kg

With the first fit algorithm, 3 boxes are required :

## Decreasing First Fit Algorithm

Items are arranged in decreasing size, then placed in the container. It is one method used for the SQA National 5 Lifeskills Maths course.

Using the example from above.

A box can only hold 10 Kg.

Pack the following weights into boxes : 7kg, 8Kg, 2 Kg, 3 Kg

First, put the weights into order of decreasing size:

8kg, 7Kg, 3 Kg, 2 Kg

Then pack into the containers.

With the decreasing first fit algorithm, 2 boxes are required :

## Best Fit Algorithm

Items are placed in the container as best as possible.It is one method used for the SQA National 5 Lifeskills Maths course.

Using the example from above.

A box can only hold 10 Kg.

Pack the following weights into boxes : 7kg, 8Kg, 2 Kg, 3 Kg

With the best fit algorithm, 2 boxes are required :