Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: √ ∞ ≠ ≤ ≥ ≈ ⇒ ∈ Δ θ ∴ ∑ ∫ π -

Login

Username

Password

Not registered yet?

Post a reply

Go back

Write your message and submit
:) :| :( :D :o ;) :/ :P :lol: :mad: :rolleyes: :cool: | :dizzy :eek :kiss :roflol :rolleyes :shame :down :up :touched :sleep :wave :swear :tongue :what :faint :dunno
Options

Go back

Topic review (newest first)

LQ
2008-08-19 23:11:14

X=Z=Y I thought. Elseways you keep the X rest, the Y rest and the Z rest, Xr,Yr and Zr
Then you continue doing what i showed in my first post, but replace X with Xr, Y with Yr and Z with Zr and add the answer to your first answer, then you continue doing that until no more boxes fit.

Perhaps you could do this also:
calculate the volume of the big box, sum up the smallest boxes and discard the ones with bigger lengths then the big box until you reach one box to many. throw away the biggest box.
1.Put in the smallest box first
2.Put the smallest of the hopefully inner boxes in the smallest corner, smallest side towards the smallest, medium towards medium, biggest side towards etc. etc. the biggest.
3.If the boxes don't fit, then exchange the rest with a box that does fit. If there is none, they will hardly fit. They couldn't possibly fit... Could they?

luca-deltodesco
2008-08-19 19:28:01

That will not work LQ, the problem is more complicated, simple example in 2D to show;

Code:

 _____5____
|          |   __3__
|          |  |_____1
4          |  
|__________|

with your method, you would have 5/3 -> 1. 4/1 -> 4.   14 = 4. however, you can fit 6.

Code:

 _________
|__1__| | | 
|__2__|5|6| 
|__3__|_|_| 
|__4__|___|

and in 3D this becomes even more evident, let's say the box was 453, and sub-box was 311, you method would say you can fit 15. but you can fit 20. with the second diagram above, where each of those 6 boxes are, you could fit the same pattern ontop of it twice over, and then in the unused space you could put 2 more boxes in orientated vertically to make 20

LQ
2008-08-19 18:24:59

First you divide the big box's X with the small box's X, the big box's Y with the small box's Y, the big box's Z with the small box's Z.
Then you eraze the decimals and multiply those answers.

lightnb
2008-08-19 15:58:50

Hi,

I have a bunch of boxes (cuboids), each with a known X, Y, and Z dimension. I also have a larger cuboid with known X, Y and Z dimensions.

I need an algorithm to determine if all the small cuboids will fit in the larger one. I imagine this would require the program to try the cuboids in all possible combinations/orientations until all the small cuboids fit in the larger one, or until every possible orientation has been tried and failed.

Any ideas on where to start, or what the logic flow should be?

Testing if one box fits in another is easy... But once the first box is known to fit, where do you go from there?

Thanks in advance,

Nick

Board footer

Powered by FluxBB