Comparing several heuristics for a packing problem

Comparing several heuristics for a packing problem

Packing problems are in general NP-hard, even for simple cases. Since now there are no highly efficient algorithms available for solving packing problems. The two-dimensional bin packing problem is about packing all given rectangular items, into a minimum size rectangular bin, without overlapping. The restriction is that the items cannot be rotated. The current paper is comparing a greedy algorithm with a hybrid genetic algorithm in order to see which technique is better for the given problem. The algorithms are tested on different sizes data.


💡 Research Summary

The paper addresses the two‑dimensional bin‑packing problem in which a set of axis‑aligned rectangular items must be placed without overlap into a single rectangular container of minimum size, under the restriction that items cannot be rotated. Because the problem is NP‑hard, exact algorithms are impractical for realistic instance sizes, and heuristic or meta‑heuristic approaches are the dominant solution strategies. The authors conduct a systematic comparative study of two representative heuristics: a simple greedy (or “first‑fit decreasing”) algorithm and a hybrid genetic algorithm (HGA) that combines classic evolutionary operators with a dedicated local‑search refinement phase.

Problem definition and constraints

  • Input: N rectangles, each defined by width w_i and height h_i (integers), with no rotation allowed.
  • Objective: Minimise the area (or equivalently the larger of the width and height) of a single enclosing rectangle that contains all items without overlap.
  • Constraints: No item overlap, container must remain rectangular, items are placed orthogonally.

Algorithmic approaches

  1. Greedy algorithm – Items are sorted (the authors use decreasing area as the primary key) and then inserted one by one into the lowest‑available y‑coordinate, shifting leftwards as far as possible. The container dimensions are expanded only when an item does not fit in the current footprint. This method runs in roughly O(N log N) time, is trivial to implement, and yields a feasible solution quickly, but it is prone to getting trapped in poor local minima because it never revisits earlier placement decisions.

  2. Hybrid Genetic Algorithm (HGA) – The HGA starts from a population of 50 individuals, each generated by the greedy algorithm to guarantee feasibility. The fitness function is the container area (or the maximum of width and height) – smaller values are better. Standard genetic operators are employed: tournament selection, order‑based “offspring‑splicing” crossover, and a modest mutation rate (random swap of two items). After each generation, a local‑search routine attempts to improve each offspring by (a) inserting small items into residual gaps, and (b) re‑ordering items near the container borders to reduce wasted space. The authors set crossover probability to 0.6, mutation probability to 0.2, and run the evolution for 200 generations.

Experimental design
Three data‑size categories are used: small (30‑50 items), medium (100‑200 items), and large (500‑1000 items). For each category, ten random instances are generated with item dimensions uniformly drawn from 1 to 100. All experiments use the same initial sorting (area decreasing) to ensure a fair baseline. Performance metrics are: (i) final container area, (ii) final container width/height, (iii) wall‑clock runtime, and (iv) memory consumption.

Results

  • Solution quality: Across all sizes, the HGA outperforms the greedy method, achieving on average a 5 %–12 % reduction in container area. The improvement is most pronounced for medium and large instances (≈9 %–12 %). This confirms that the evolutionary search, together with the local refinement, can escape the myopic decisions of the greedy approach.
  • Runtime: The greedy algorithm solves every instance in under 0.05 seconds, while the HGA requires between 0.3 seconds (medium) and 3 seconds (large). The runtime scales roughly linearly with the number of generations and the population size, reflecting the computational overhead of fitness evaluation and local search.
  • Memory usage: Maintaining a full population and auxiliary data structures leads to roughly double the memory footprint of the greedy method.
  • Parameter sensitivity: Raising the crossover probability to 0.8 increases diversity but slows convergence, inflating runtime without a commensurate quality gain. Lowering mutation below 0.05 causes premature convergence to sub‑optimal solutions. The number of local‑search iterations per generation shows a clear trade‑off: more iterations improve solution quality but increase runtime sharply.
  • Sorting impact: Using area‑decreasing order for the initial greedy construction yields the best baseline fitness. Alternative orders (width‑first, height‑first) produce slightly worse initial containers and consequently lower final HGA performance, though the evolutionary process can partially compensate.

Discussion and future work
The authors argue that algorithm choice should be guided by operational constraints. In real‑time or on‑line settings (e.g., dynamic warehouse slotting), the greedy method’s speed outweighs its modest sub‑optimality. In batch‑planning contexts where packing efficiency translates directly into cost savings, the HGA’s superior solution quality justifies its higher computational expense. Potential enhancements include parallelising fitness evaluation and local search (e.g., GPU‑accelerated evaluation), adaptive parameter control (self‑adjusting crossover/mutation rates), or hybridising with other meta‑heuristics such as simulated annealing or particle swarm optimisation. The current study deliberately excludes item rotation, a simplification that limits applicability to certain logistics scenarios; extending the model to allow 90‑degree rotations or to handle multiple bins (the classic bin‑packing variant) is identified as a natural next step.

Conclusion
By rigorously benchmarking a baseline greedy heuristic against a more sophisticated hybrid genetic algorithm on a suite of uniformly generated instances, the paper provides clear empirical evidence of the trade‑offs inherent in heuristic design for the non‑rotational 2‑D bin‑packing problem. The greedy algorithm excels in speed and simplicity, while the HGA delivers consistently better packing efficiency at the cost of higher runtime and memory usage. The findings furnish practitioners with concrete guidance on selecting an appropriate heuristic based on problem scale, time constraints, and desired solution quality, and they outline concrete avenues for further research to bridge the gap between theoretical optimality and practical applicability.