fitting products into a shipping box

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
dbalatero
Forum Newbie
Posts: 6
Joined: Tue Jul 29, 2003 2:15 am

fitting products into a shipping box

Post by dbalatero »

This is a problem I've been recently wrestling with: when a user places an order through Site X, I need to be able to determine whether a certain shipping box will accommodate the products in the order, in terms of volume, and 3 sides.

Is there an algorithm to do this, or could someone point me in the right direction of where to go with this? I have my own theories, but while I'm competent with math, I'm not a math genius either...

Thanks!
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

Sounds like the "Knapsack" problem. Check out some books at a library/bookstore with "alogrithms" in the title. I beleive CLRS covers this.
dbalatero
Forum Newbie
Posts: 6
Joined: Tue Jul 29, 2003 2:15 am

Post by dbalatero »

what is CLRS?
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

Oh, sorry, CLRS is one of the most common algorithm text books. Title is Introduction to Algorithms by Cormen, Lesierson, Rivest and S-somebody. (The first edition I used was only CLR, second edition added an author...)
dbalatero
Forum Newbie
Posts: 6
Joined: Tue Jul 29, 2003 2:15 am

Post by dbalatero »

thanks! i'll check it out today, see what i can find!
Selkirk
Forum Commoner
Posts: 41
Joined: Sat Aug 23, 2003 10:55 am
Location: Michigan

Post by Selkirk »

This probably isn't helpful, but...

I used to work for a manufacturing company that made customized products that was boxed in custom built wooden crates.

Often, box vendors would build their own factories close to ours, but there was still a lead time for ordering boxes for product.

A colleague of mine wrote the program that examined the production schedule and automatically produced an order for boxes that would be sent to the box vendor.

One day, he received a Polaroid from the production shift out in the factory. The picture was of the entire shift crew standing inside a wooden crate. It seems that a bug in the program had ordered a gigantic box and the box vendor dutifully fulfilled the order. :)
Post Reply