Which Way Up?
Choose a carton orientation before stocking the shelf. A worked example shows how a quarter turn fits a tenth carton.
- Status
- Active
- Built with
- Python
- Started
- Updated
- Source
- github.com/Um9i/wwu
Suppose a shelf is 100 cm wide and 60 cm deep, with 20 cm of clearance. Each carton measures 30 × 20 × 20 cm. A stockroom team needs to know how many identical cartons to allocate to each shelf.
Which Way Up? compares six ways to orient a carton. For each, it counts how many whole cartons fit across, deep and high, then returns the layout with the highest count.
Try both layouts
| Carton footprint | Across 100 cm | Along 60 cm | Cartons per shelf |
|---|---|---|---|
| 30 × 20 cm | 3 | 3 | 9 |
| 20 × 30 cm | 5 | 2 | 10 |
In the first layout, three cartons use 90 cm of the width. The remaining 10 cm is too narrow for another carton. In the second, five cartons use the full 100 cm and two rows use the full depth. Both layouts use the available height in one layer.
When the answer applies
The calculation assumes rectangular cartons of the same size, all facing the same way, with no overhang or handling gap. Use the shelf’s usable internal dimensions and allow for any clearance your team needs before running the numbers.
Reproduce the result
Install the wwu Python package. It takes each set of dimensions in height, width, depth order.
from wwu import Box
carton = Box(20, 30, 20)
layout = carton.best_orientation(20, 100, 60)
print(layout.dimensions) # (20, 20, 30)
print(layout.box_count) # 10