We require a PHP class to accept
a list of 3D polygonal spaces
a list of items with id, known LxWxH, weight, boolean onFloor, boolean isStackable
Your task is to sort the items optimally into the available 3D spaces. Items that have 1 to the boolean onFloor must be on the bottom/floor of the the 3D space. Items that have 0 to the boolean isStackable must be on the top. Items of an equal or lower weight can only be tacked on top of the item below.
The class it to output a packing list, back bottom corner to top back right corner coming forwards.
Given that this is a complex sorting algorithm, you may with to accelerate it some way such as threading with Ruby/OpenCL.
All rights to source code to be transferred to me on completion of job.
You could port this http://www.diku.dk/hjemmesider/ansatte/pisinger/3dbpp.c to PHP with the added boolean requirements.
This project differs from the Knapsack Problem
We have items that
must be on the bottom
must be on the top
items cannot be heavier than the item below
You could break it down into 2D layers in the z-axis. Items can only be rotated around the item z-axis - so 2 possible orientations.
1). 2D best fit algorithm for items on the floor (layer 0).
2). 2D best fit algorithm for stackable items on layer 1 upwards taking into account the weight constraints of the item below. So we know where some items cannot go.
3). 2D best fit algorithm for items that are not stackable and must be on top, again taking into account weight constraints on the item below.