Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 900 Bytes

covering_algorithms.md

File metadata and controls

41 lines (26 loc) · 900 Bytes

Bin-covering algorithms

Currently, prtpy supports only some simple approximate bin-covering algorithms.

import prtpy
items = [44, 6, 24, 6, 24, 8, 22, 8, 17, 21]
print(prtpy.pack(algorithm=prtpy.covering.decreasing, binsize=60, items=items))
[[44, 24], [24, 22, 21]]

Two-thirds approximation (Csirik et al., 1999):

print(prtpy.pack(algorithm=prtpy.covering.twothirds, binsize=60, items=items))
[[44, 6, 6, 8], [24, 8, 17, 21]]

Three-quarters approximation (Csirik et al., 1999):

print(prtpy.pack(algorithm=prtpy.covering.threequarters, binsize=60, items=items))
[[24, 24, 6, 6], [44, 8, 8], [22, 21, 17]]

Markdown generated automatically from covering_algorithms.py using Pweave 0.30.3 on 2022-07-11.