in reply to determine numbers of boxes needed per weight
use Algorithm::Knapsack; my $knapsack = Algorithm::Knapsack->new( capacity => $capacity, weights => \@weights, ); $knapsack->compute(); foreach my $solution ($knapsack->solutions()) { foreach my $index (@{$solution}) { # do something with $weights[$index] } }
Edit: g0n - reparented to root node
|
|---|