![]() |
![]()
| ![]() |
![]()
NAMEAlgorithm::BinPack - efficiently pack items into bins SYNOPSIS"Algorithm::BinPack" efficiently packs items into bins. The bins are given a maximum size, and items are packed in with as little empty space as possible. An example use would be backing up files to CD, while minimizing the number of discs required. my $bp = Algorithm::BinPack->new(binsize => 4); $bp->add_item(label => "one", size => 1); $bp->add_item(label => "two", size => 2); $bp->add_item(label => "three", size => 3); $bp->add_item(label => "four", size => 4); for ($bp->pack_bins) { print "Bin size: ", $_->{size}, "\n"; print " Item: ", $_->{label}, "\n" for @{ $_->{items} }; } METHODS
SEE ALSOThis module implements the bin packing algorithm described in 'The Algorithm Design Manual' by Steven S. Skiena. This module is similar to Algorithm::Bucketizer, but has a few key differences. The algorithms in Algorithm::Bucketizer are based on optimization by multiple iterations, so the module is set up differently. By contrast, the algorithm used in Algorithm::BinPack is predictable, and does not require multiple iterations. The name also reflects the well-known name of the problem. Searching for variations on "bin packing" finds more relevant results than variations on "bucketizer". AUTHORCarey Tilden <revdiablo@wd39.com> CONTRIBUTORSAndrew 'Terra' Gillespie <algorithm_binpack@Tech.FutureQuest.net> - "prefill_bin" COPYRIGHT AND LICENSECopyright (C) 2004-05 by Carey Tilden This code is dual licensed. You may choose from one of the following:
POD ERRORSHey! The above document had some coding errors, which are explained below:
|