Algorithm::Bucketizer

Algorithm::Bucketizer can distribute sized items to buckets with limited size.
Download

Algorithm::Bucketizer Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Mike Schilli
  • Publisher web site:
  • http://search.cpan.org/~mschilli/X10-Home-0.03/Home.pm

Algorithm::Bucketizer Tags


Algorithm::Bucketizer Description

Algorithm::Bucketizer can distribute sized items to buckets with limited size. Algorithm::Bucketizer can distribute sized items to buckets with limited size.SYNOPSIS use Algorithm::Bucketizer; # Create a bucketizer my $bucketizer = Algorithm::Bucketizer->new(bucketsize => $size); # Add items to it $bucketizer->add_item($item, $size); # Optimize distribution $bucketizer->optimize(maxrounds => 100); # When done adding, get the buckets # (they're of type Algorithm::Bucketizer::Bucket) my @buckets = $bucketizer->buckets(); # Access bucket content by using # Algorithm::Bucketizer::Bucket methods my @items = $bucket->items(); my $serial = $bucket->serial();So, you own a number of mp3-Songs on your hard disc and want to copy them to a number of CDs, maxing out the space available on each of them? You want to distribute your picture collection into several folders, so each of them doesn't exceed a certain size? Algorithm::Bucketizer comes to the rescue.Algorithm::Bucketizer distributes items of a defined size into a number of dynamically created buckets, each of them capable of holding items of a defined total size.By calling the $bucketizer->add_item() method with the item (can be a scalar or an object reference) and its size as parameters, you're adding items to the system. The bucketizer will determine if the item fits into one of the existing buckets and put it in there if possible. If none of the existing buckets has enough space left to hold the new item (or if no buckets exist yet for that matter), the bucketizer will create a new bucket and put the item in there.After adding all items to the system, the bucketizer lets you iterate over all buckets with the $bucketizer->items() method and determine what's in each of them.Requirements:· Perl


Algorithm::Bucketizer Related Software