Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

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


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

Stuff is left behind.

Then add another bin (tape) and start filling it with leftovers. Repeat until no more bins (tapes) or leftovers.

The first few bins would probably be most optimally filled for most datasets but if the goal is to use the least amount of tapes this should work... or am I missing something?

-- FloydATC

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


Comment on Re^3: Computer science Problem - single dimension bin packing
Re^4: Computer science Problem - single dimension bin packing
by ikegami (Pope) on Aug 14, 2014 at 19:18 UTC

    Then add another bin (tape) and start filling it with leftovers. Repeat until no more bins (tapes) or leftovers.

    That wouldn't optimize anything. I think we all agree that there is something that he wants to optimize.

      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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2014-12-28 08:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (179 votes), past polls