http://www.perlmonks.org?node_id=1097486


in reply to Re^4: Computer science Problem - single dimension bin packing
in thread Computer science Problem - single dimension bin packing

That wouldn't optimize anything

What I mean is, it's still a knapsack problem but there are fewer items with each iteration. In pseudocode:

my @items = qw( loads of variable size items here ); while (@items) { push @tapes, remove_from(\@items); } sub remove_from { my $arrayref = shift; my $taperef = []; # Knapsack algorithm goes here # ... # Whatever we put in $taperef is removed from $arrayref # ... return $taperef; }

How would this not optimize for number of tapes?

-- FloydATC

Time flies when you don't know what you're doing