This is a calculus problem. There are specialized equations for just this sort of problem. Off hand I don't know where you could find these equations, but a better bet would be to ask around in math or science newsgroups.
>I have a very complex prob..
>
>Our co. being a export firm is having a requirement, the details of which are as follows :-
>
>we are shipping goods in various carton sizes which goes into containers of 40ft, 20 ft etc.
>
>We try to fill as much goods as possible in a container..(saving each inch of space)
>
>Our goods carton size varies from order to order.. what we want is the user should give input of carton sizes i.e.
>
>Length X Breadth X Width & in which container (i.e. 40 or 20) wants to put those goods..
>
>Program should show a graphical presentation, how goods will be loaded, i.e. how can rows, in which direction horizontal or vertical....so that we can utilize maximum space...
>
>This Prob. is so complex that I don't know from where to start it...
>
>Any Help/ideas/suggestions are welcome...