Optimizing Cargo Loading with 2D Bin Packing
Projects | | Links: Contact me to learn more

A mathematical optimization model in Python and Gurobi was developed to solve a 2D bin packing problem for aircraft Unit Load Devices (ULDs). The study balanced cost minimization with realistic constraints such as fragile, perishable, and radioactive items, while extensions tested methods to improve stability. Results highlighted both the potential and the computational challenges of applying exact optimization to air cargo loading.
This project focused on the optimization of aircraft cargo loading using a 2D bin packing formulation. The model accounted for 25 items of varying sizes and constraints, and allocated them across four Unit Load Devices (ULDs) of two types (rectangular and cut-corner). Items could be rotated, fragile items had to remain unstacked, and perishable items could not be packed with radioactive ones.
The optimization model was implemented in Python with Gurobi, solving via a branch-and-bound approach. Due to the scale of the problem (over 7,000 variables and 19,000 constraints), a 2-hour time limit was set. The solver found a feasible solution with a cost of €700 (two rectangular ULDs at €200 each and two cut ULDs at €150 each), while analysis suggested that an arrangement using only three ULDs (€500) or even two ULDs (€400) could be possible. However, proving optimality within the time limit was computationally infeasible.
Main insights from the study:
- Fragile items were successfully placed at the ground level or on top of stacks, avoiding damage risk.
- The model respected all constraints: perishable and radioactive items were correctly separated, and stability rules prevented “floating” cargo.
- The branch-and-bound solver reported an optimality gap of 57%, showing that while a feasible solution was found, the global optimum remained unproven.
- Extensions to improve stability (e.g. requiring 5% of each box’s base to be supported) produced more realistic arrangements but further increased computation times.
- In practice, heuristic methods or hybrid approaches may be better suited than pure exact optimization, given the time-critical nature of cargo operations.
Overall, the project demonstrated how mathematical optimization can enhance cargo efficiency and safety, but also highlighted the limitations of exact solvers at scale and the trade-offs between robustness and computational cost.
Note: Due to university policies, I cannot share the full report, code, or detailed data. If you are interested in discussing the methodology or results further, please get in touch :)