stopher
AWF VIP
- Local time
- Today, 15:17
- Joined
- Feb 1, 2006
- Messages
- 2,395
We need to optimise the layout of boxes on a pallet such that we can get the maximum number of boxes on a layer without exceeding the perimeter of the pallet. All boxes are the same size and are laid flat but can be rotated.
There is software available to do this but I'm sure this is a problem that can be solved using VBA. An example of the problem is provided is a simple game here. If you try the game for 9 boxes then getting 8 boxes to fit is pretty easy but getting the ninth to fit requires a bit of trial and error.
So the function will have the following inputs:
I haven't really got very far with this. I'm thinking brute force. I'm thinking of some kind of recursive algorithm but I think my biggest problem is finding some function that can determine all the possible positions/rotations that the next box can be placed.
Any ideas?
Chris
There is software available to do this but I'm sure this is a problem that can be solved using VBA. An example of the problem is provided is a simple game here. If you try the game for 9 boxes then getting 8 boxes to fit is pretty easy but getting the ninth to fit requires a bit of trial and error.
So the function will have the following inputs:
- Pallet Dimensions (lxw)
- Box dimensions (lxw)
- Maximum number of boxes that can be placed
- Position and rotation of each box e.g. perhaps as a list of coordinates of opposite corners of each box, or maybe a graphic.
I haven't really got very far with this. I'm thinking brute force. I'm thinking of some kind of recursive algorithm but I think my biggest problem is finding some function that can determine all the possible positions/rotations that the next box can be placed.
Any ideas?
Chris