Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^5: Computer science Problem - single dimension bin packing

by FloydATC (Chaplain)
on Aug 14, 2014 at 20:13 UTC ( #1097486=note: print w/ replies, xml ) Need Help??


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


Comment on Re^5: Computer science Problem - single dimension bin packing
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1097486]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2015-07-30 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (270 votes), past polls