Hexaly vs VPSolver vs Gurobi on the Bin Packing Problem (BPP) – Optimality Gap
The Bin Packing Problem is defined as follows. You have to assign items with known weights to bins with uniform capacity. The sum of weights of items assigned to each bin must be lower than its capacity. The objective is to minimize the number of bins used to place all items.
On the Bin Packing Problem (BPP), Hexaly achieves an average optimality gap of 0.1% within one minute on the BPPLib benchmark, which includes instances with up to 5,486 items. The benchmark results demonstrate Hexaly’s ability to outperform traditional general-purpose optimization solvers, such as Gurobi 12.0, in both finding high-quality solutions and computing tight optimality bounds, while also outperforming specialized solvers, such as VPSolver v3.1.2, on the hardest instances.
Input data
BPPLib is a reference benchmark library for the Bin Packing Problem. We compare the performance of Hexaly 16.0, Gurobi 12.0, and VPSolver 3.1.2 (using Gurobi as a dependency) on the BPPLib instances introduced by Gschwind and Irnich in 2016, which contain up to 5,486 items.
All three solvers compute bounds on the optimal objective value to assess solution quality and establish optimality guarantees. We therefore compare their performance using the relative optimality gap, calculated from the best feasible objective value (ObjValue) and the best bound (ObjBound) returned by each solver. The gap is capped at 100% and defined as follows:
Mathematical models of the Bin Packing Problem
Mixed-Integer Linear Programming (MILP) model
The results reported below for Gurobi are obtained using the standard Mixed-Integer Linear Programming (MILP) model for the Bin Packing Problem (BPP), introduced in Kantorovish’s seminal paper and detailed in Martello and Toth’s book. This formulation consists of a quadratic number of binary variables representing the assignment of an item to a bin and one binary variable per bin representing whether the bin is used or not.
VPSolver model
VPSolver relies on an arc-flow formulation with graph compression, developed by Brandão and Pedroso in 20161. This formulation implicitly represents all feasible packing patterns as paths in a compressed directed acyclic graph, with integer variables representing the flow along each arc. It provides a strong linear relaxation equivalent to that of the classical Gilmore–Gomory formulation, without requiring column generation. In this benchmark, the resulting integer programming model is solved using Gurobi.
Hexaly model
The Hexaly model uses one set variable per bin, representing the items allocated to the bin. The demand for each item is retrieved by the at operator. This formulation is more compact and versatile than the MILP formulation. The number of variables is linear; we will show that it scales to large-scale instances.
function model() {
// Set decisions: bins[k] contains the items assigned to bin k
bins[k in 0..nbMaxBins-1] <- set(nbItems);
// Each item must be assigned to one and only one bin
constraint partition[k in 0..nbMaxBins-1](bins[k]);
for [k in 0..nbMaxBins-1] {
// Weight constraint for each bin
binWeights[k] <- sum(bins[k], i => itemWeights[i]);
constraint binWeights[k] <= binCapacity;
// Bin k is used if it contains at least one item
binsUsed[k] <- (count(bins[k]) > 0);
}
// Count the used bins
totalBinsUsed <- sum[k in 0..nbMaxBins-1](binsUsed[k]);
// Minimize the number of used bins
minimize totalBinsUsed;
}
Hexaly, VPSolver, and Gurobi results on the Bin Packing Problem (BPP)
We compare the performance of the three solvers with a time limit of 1 minute per instance. At the end of each run, we measure the relative optimality gap between the best feasible solution and the best bound returned by the solver. The benchmark uses Hexaly 16.0, Gurobi 12.0, and VPSolver v3.1.2, with VPSolver relying on Gurobi 12.0 to solve its resulting integer programming model. All solvers are run with their default parameters on a machine equipped with an AMD Ryzen 7 7700 processor (8 cores, 3.8 GHz base clock, 32 MB L3 cache) and 32 GB of RAM.
The table below reports the average optimality gap achieved by each solver across the benchmark instances.
| #items | Hexaly 16.0 | VPSolver v3.1.2 | Gurobi 12.0 | |
|---|---|---|---|---|
| CSAA125 | 1227 – 1440 | 0.0 | 0.0 | 9.1 |
| CSAA250 | 2322- 2804 | 0.2 | 0.0 | 55.7 |
| CSAA500 | 4850- 5460 | 0.2 | 65.0 | 100.0 |
| CSAB125 | 1207 – 1399 | 0.2 | 100.0 | 4.0 |
| CSAB250 | 2518- 2836 | 0.1 | 100.0 | 37.9 |
| CSAB500 | 5080 – 5486 | 0.1 | 100.0 | 100.0 |
| CSBA125 | 1212- 1475 | 0.0 | 0.0 | 8.6 |
| CSBA250 | 2480 – 2815 | 0.2 | 0.0 | 55.4 |
| CSBA500 | 4932 – 5453 | 0.2 | 95.0 | 100.0 |
| CSBB125 | 1176 – 1462 | 0.2 | 100.0 | 6.5 |
| CSBB250 | 2439 – 2727 | 0.1 | 100.0 | 24.8 |
| CSBB500 | 4928- 5399 | 0.1 | 100.0 | 100.0 |
Hexaly finds near-optimal solutions and computes tight optimality bounds even for instances with up to 6000 items, whereas Gurobi struggles to find high-quality solutions for instances with more than 2000 items. While VPSolver is more effective at proving optimality on smaller instances, it fails to return solutions for many larger instances due to memory limitations. Similar memory limitations were reported by Delorme, Iori, and Martello2.
Conclusion
On a widely studied combinatorial optimization problem such as the Bin Packing Problem (BPP), Hexaly finds solutions with proven near-optimality across all the most challenging instances in BPPLib. Hexaly’s innovative modeling approach, based on set variables, enables it to compute tighter optimality bounds on large-scale bin packing instances than traditional mixed-integer programming (MIP) solvers such as Gurobi, while achieving performance close to that of state-of-the-art specialized solvers such as VPSolver, without encountering the same memory limitations.
Want to compare the quality of feasible solutions against the best-known solutions? Explore our BPP primal solution quality benchmark.
- Brandão F., Pedroso J.P. (2016). Bin packing and related problems: General arc-flow formulation with graph compression. Computers & Operations Research, Volume 69, 56-67. ↩︎
- Delorme M., Iori M., Martello S. (2018). BPPLIB: a library for bin packing and cutting stock problems. Optimization Letters, Volume 12, 235-250. ↩︎
Ready to start?
Discover the ease of use and performance of Hexaly through
a free 1-month trial, or enjoy free academic access.