Internosis - knowledge management,ecommerce and project consulting
*Home>>>E-Commerce

Does anyone know an algorithm to compute the smallest 3d rectangle size that can contain a set of boxes in it?


Hello,

I need an algorithm for my ecommerce application that can compute and give me the x, y & z azis dimensions of the smallest 3d rectangle that would be able to contain a unlimited set of packages. The input boxes dimensions would be specified as an array :
For example :
[0]['length'] = 2.3
[0]['width'] = 4
[0]['height'] = 6

Those dimensions will be specified for each product I have in the cart... now I want to know what is the smallest box (which the site admin entered in its admin area) that can contain all these packages.

Volume calculation does not work here, even if the overall volume of all packages would fit into a box, the physical dimensions of some packages would prevent the box from beeing used sometimes...

I would be very happy if some could come up with a near perfect solution for this problem...I tried many times but my solutions were not really precise... and I love perfection.. so im waiting for your answers !

Thank you very much in advance

>what is the smallest box that can contain all these packages

This is a Packing Problem, a type of search problem as is taught in most Artificial Intelligence or algorithm courses.
Look for articles on blind search (Breadth-First Search, Depth-First Search) and heuristic search (A*).
Something with this much complexity will almost surely want to use heuristic search, and a large part of your task will be picking a good formulation AND a good heuristic.

There are very probably some open-source code or libraries for this. Sorry I don't know any names. Google should help.
But here are the keywords and concepts you want to know:

(We assume packages can't be arranged diagonally, i.e. must be orthonormal).
Anyway, you can formulate the packing problem by recursively dividing bounding volumes of free space (or adding volumes of occupied space).
Say there are N boxes, each with l,b,h parameters.
We consider configurations of each box B_i with some (xi,yi,zi) position (e.g. pick the bottom left corner, rather than the center) and each box can also be rotated to 3! =6 different configurations.
So each B_i has 4 parameters: 3 coords (integer or float) and 1 rotation (rot_i, a six-valued integer parameter).
So all points in the state space of the problem have 4N parameters.
>I would be very happy if some could come up with a near perfect solution for this problem
Well the complexity is also going to depend on the grid resolution you choose: 螖 = 0.1 ft perhaps? You can pick a coarser grid and round upwards the original l,b,h or the volumes, that may be slightly suboptimal but much-lower-complexity (especially if you have lots of irritatingly small boxes and a few large ones).
Note that since we have 3N coordinates, each of which can assume a number of values proportional to (1/螖), the number of possible states will increase with O((1/螖)^3N).
Thus if 螖=0.2 ft, we only need to consider x,y,z positions each with a granularity of 5 per foot, but if 螖=0.1 ft, we now have a granularity of 10 per foot in each of three axes, thus we increased our complexity by 2鲁 = 8.

>Volume calculation does not work here, even if the overall volume of all packages would fit into a box, the physical dimensions of some packages would prevent the box from being used sometimes...

Well at least you do know that the optimal volume must be 鈮?危 li*bi*hi , so that's a starting-point or sanity-constraint.
Also, the position and rotation of the first box are arbitrary, so you could pick the largest-volume box and place it at (0,0,0) with some arbitrary rotation.

I think it has been shown that this question can only be answered definitively by trying every possibility. This can take a lot of time.

All your packages are the same shape and size.

Place one package on a table. Place another next to the first along the shortest dimension. Place two next to the first two along their combined shortest dimension. Place four more against the first four along the shortest dimension of the first four.

Continue to place a second configuration of packages identical to the present configuration of packages along their shortest dimension until all the packages are packed.

If the final lot of packages is not the same number as the previous it might be possible to arrange them in a different orientation to fit them into a smaller space.

Tags
  Business Website   Business Hosting   Business Software   Online Business   Internet Business   E-Business   E-Commerce   Supply Chain   Data Mining   ERP   CRM   Application Development
Related information
  • What type of credit cards are used the most in the UK?

    Solo, Switch, Delta are not credit cards they are debit cards where the money is taken out of a bank account instantly. Diners Club is a credit card, don't know about the others. Visa is...

  • Web development technologies?

    Do you think Apex or maybe Google Apps can help you? if you can't find any helpful classes in both of them then I suggest you not to use them personally, I think PHP is as strong as ASP whi...

  • I need a free website builder that has a lot of features.?

    Hello nDawg..I would like to tell you about free web hosting service I use now. Register here: ...

  • Can I use my dwarf rabbit's old cage as a cage for my tortoise?

    until your tortoise outgrows it absolutly

    ...
  • Is there any website which can design e-commerce website ?

    well there are many company which can design but you need to be specific for your requirements so that one can help you.I knw some company which might help you as i have had experience with them an...

  • What is a good business Idea for e-commerce?

    GET RICH QUICK SCAMS UNCOVERED!!! Before you consider joining or paying for another "GET RICH QUICK" SCAM, read this free article. Wouldn't it be the ****,(excuse the languag...

  • Please help me answer this: What are the unique characteristics of e-commerce?

    Ecommerce (e-commerce) or electronic commerce, a subset of ebusiness, is the purchasing, selling, and exchanging of goods and services over computer networks (such as the Internet) through which tr...

  • I want to set-up a quick and easy e-commerce web site what direction should I go?

    Most people try it first on eBay to see if it can work. You sound like you are past that stage. Contact dodaddy.com and get the site up ( i don't work for them). Are you sure you don'...

  •  

    Categories--Copyright/IP Policy--Contact Webmaster