Bin packing is NP-hard to approximate within a factor below 3/2 #
A polynomial-time algorithm for bin packing that always uses fewer than 3/2 times the optimal
number of bins decides Partition, so it gives P = NP
Williamson and Shmoys, Theorem 3.8. Given a list l with total S,
pack it into bins of capacity ⌊S / 2⌋. If l has a partition, two bins suffice, so the
algorithm uses at most two bins; conversely two bins of capacity ⌊S / 2⌋ holding S hold
exactly S / 2 each, and either is one side of a partition. Lists with a number larger than
⌊S / 2⌋ have no partition, and the empty list and lists of zeros always have one.
The algorithm is a function A : BinPackingInstance → List (List ℕ) from an instance
⟨items, capacity⟩ to bins, with the numbers in binary (BinPacking.encBinPacking and
BinPacking.encBins). It is required to return a packing only when one exists, that is when every
item fits into a bin (Cslib.Algorithms.Lean.BinPacking.exists_isPacking_iff), and its ratio is
compared with every packing of a nonempty list.
Main definitions #
Cslib.Complexity.BinPackingInstance: an instance(items, capacity)of bin packing.Cslib.Complexity.BinPacking.encBinPacking,Cslib.Complexity.BinPacking.encBins: binary encodings of instances and bin lists.Cslib.Complexity.BinPacking.decidePartition: the decider forPartitionbuilt from a bin-packing algorithm.
Main results #
Cslib.Complexity.BinPacking.decidePartition_iff: the decider built from the algorithm decidesPartition.Cslib.Complexity.P_eq_NP_of_binPacking_approx: an algorithm with2 * |A| < 3 * |Q|for every packingQgivesP = NP.Cslib.Complexity.P_eq_NP_of_binPacking_ratio: an algorithm with ratioρ < 3/2givesP = NP.
References #
The tuple of the fields of encBinPacking.
A list of bins, such as the packing an algorithm returns: the concatenation of the framed bins,
each the concatenation of its framed item sizes in binary. This is the layout
encList (encList encNat) that other modules name by their own roles, such as
Cslib.Complexity.KCenter.encDistMatrix; the name records the role.
The decider for Partition built from a bin-packing algorithm A: accept lists summing to
zero, and otherwise accept when every number fits into a bin of capacity ⌊S / 2⌋ and A packs
the list into at most two such bins.
The decider is correct: an algorithm that returns packings and uses fewer than 3/2 times
as many bins as any packing of a nonempty list decides Partition.
The decider built from a polynomial-time algorithm is polynomial-time.
Bin packing is NP-hard to approximate within a factor below 3/2
Williamson and Shmoys, Theorem 3.8. A polynomial-time algorithm that
returns a packing whenever every item fits into a bin, and on nonempty lists uses fewer than 3/2
times as many bins as any packing, gives P = NP.
No ρ-approximation for bin packing with ρ < 3/2 unless P = NP
Williamson and Shmoys, Theorem 3.8: a polynomial-time algorithm that
returns a packing whenever every item fits into a bin, and on nonempty lists uses at most ρ
times as many bins as any packing, gives P = NP.