in reply to Finding the best option...
my @values = (10,40,30,14,50,29,59,20,59,20,10,1,3,5,2,4); use Algorithm::Bucketizer; # Create a bucketizer my $bucketizer = Algorithm::Bucketizer->new(bucketsize => 291); for my $value (@values) { # Add items to it $bucketizer->add_item($value, $value); } $bucketizer->optimize(maxrounds => 1000, algorithm => "brute_force"); for my $bucket ($bucketizer->buckets()) { my @items = $bucket->items(); print $bucket->level(), ": @items\n"; }
1000 Rounds:
286: 4 2 5 3 1 10 20 59 20 59 29 50 14 10 70: 30 40
10,000 Rounds:
If you find a usable algorithm, it can be plugged into Algorithm::Bucketizer as a standard choice.286: 4 2 5 3 1 10 20 59 20 59 29 50 14 10 70: 30 40
|
|---|