P is for Practical PerlMonks

### Re: Packaging Algorithm

by extremely (Priest)
 on Nov 07, 2000 at 06:57 UTC ( #40308=note: print w/replies, xml ) Need Help??

There isn't an answer to this one. There are some strategies for doing this with restrained box sizes but the general case you describe isn't actually solvable. At least no one has yet. (of course, there may be some genius out there that just broke NP-complete problems too but...)

I've not heard of anyone solving this or any related 2d or 3d problem.

The balance problem, aka tape-sides is a good simpler example. Given a set of weights (or a set of song lengths) divide them into two sets that have the least difference in weight (length)

There are a lot of nice strategies but they all have nasty cases that don't work. Exaustively trying every case is the only hope. The best bet is to minimize the cases you have to exhaust. Force everything to inch(cm) boundries, move boxes on the same. Pack things around the largest volume item, etc.

Really, not to discourage you too much, it might be a good idea to start on something a bit simpler, like curing cancer. =)

--
\$you = new YOU;
honk() if \$you->love(perl)

Replies are listed 'Best First'.
RE: Re: Packaging Algorithm
by rlk (Pilgrim) on Nov 08, 2000 at 02:36 UTC

Remember, just because a problem is NP, doesn't mean it's unsolvable. It just means that there's no (known) way to solve it in polynomial time. All we can do in polynomial time is verify a solution.

There's no reason that one couldn't write an algorithm to solve this problem. The problem is that for any non-trivial number of boxes, it would take a long, long time and/or some pretty expensive hardware to run that algorithm.

--
Ryan Koppenhaver, Aspiring Perl Hacker
"I ask for so little. Just fear me, love me, do as I say and I will be your slave."

RE: Re: Packaging Algorithm
by PsychoSpunk (Hermit) on Nov 07, 2000 at 20:51 UTC
There isn't an answer to this one. There are some strategies for doing this with restrained box sizes but the general case you describe isn't actually solvable. At least no one has yet. (of course, there may be some genius out there that just broke NP-complete problems too but...)

Actually, I was playing Minesweeper this morning... awww nevermind.

ALL HAIL BRAK!!!

Create A New User
Node Status?
node history
Node Type: note [id://40308]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2020-10-01 14:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My favourite web site is:

Results (13 votes). Check out past polls.

Notices?