473,806 Members | 2,330 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

volume/dimension algorithm question

I realize this could be a little off-topic, but there are some great minds
on this NG and I hope you can let me slide this time ;0)

I'm designing our system to manage what products can fit in which cartons
and how many per carton. For example:
Widget A measures 10W x 10H x 10D
Carton A measures 20W x 10H x 10D
Carton B measures 50W x 10H x 10D

If I'm fulfilling an order for 2 Widget As I can choose Carton A as it will
contain 2 Widget A items.
Order for 50, Carton B, etc.

I would like to design a system that will eliminate user interaction in this
area, I would like my system to asses the item dimensions and quantity and
choose the appropriate carton.
The ideas that are floating through my head to solve this are far too basic
to be efficient and would result in a mess a spaghetti code handling
orientation combinations, etc.

Does anyone know of an algorithm that is designed to solve this problem?
I'm sure there is something out there, but my initial googling hasn't come
up with anything valid.
I hope you understand what I'm trying to achieve.

I appreciate any help!
Thanks,
Steve
Jun 10 '07 #1
4 2642
Holy Cow!

I didn't realize how big of a question this was ;)

I've been doing some more googling and tried some didfferent key words and
found results. Everything I'm finding is very complex and that's just the
2D stuff, the 3D stuff is crazy.
I think I need to lower my hopes of finding a solution to this.

With that said, if anyone out there has done this I would still really like
to hear about it.
-Steve

"sklett" <s@s.comwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>I realize this could be a little off-topic, but there are some great minds
on this NG and I hope you can let me slide this time ;0)

I'm designing our system to manage what products can fit in which cartons
and how many per carton. For example:
Widget A measures 10W x 10H x 10D
Carton A measures 20W x 10H x 10D
Carton B measures 50W x 10H x 10D

If I'm fulfilling an order for 2 Widget As I can choose Carton A as it
will contain 2 Widget A items.
Order for 50, Carton B, etc.

I would like to design a system that will eliminate user interaction in
this area, I would like my system to asses the item dimensions and
quantity and choose the appropriate carton.
The ideas that are floating through my head to solve this are far too
basic to be efficient and would result in a mess a spaghetti code handling
orientation combinations, etc.

Does anyone know of an algorithm that is designed to solve this problem?
I'm sure there is something out there, but my initial googling hasn't come
up with anything valid.
I hope you understand what I'm trying to achieve.

I appreciate any help!
Thanks,
Steve

Jun 10 '07 #2
You can seach google for "packing algorithm" and discover:
http://www.astrokettle.com/data.html
http://en.wikipedia.org/wiki/Bin_packing_problem

Your problem can be mapped to the "stock cutting problem", so you should do
a search for those algorithms too.

If you can constrain the ways in which you can fill a carton,
here is a rather naive approach that should be within 22% of optimal:
(see http://mathworld.wolfram.com/Bin-PackingProblem.html)
1. Order the cartons smallest to largest.
2. Order the items largest to smallest.
Foreach item:
select the first carton/subcarton that the item will fit in.
reduce the subcarton by dividing it into the subcartons that are left.

A "subcarton" is a cuboid (solid having 6 rectangular faces) that represents
some of the volume of the carton. The first time you add an item to a
carton you have left a set of cuboids (representing the volume left in the
carton). When you add an item to a cuboid, you dissect that cuboid into the
ones that remain, etc. So, the algorithm above looks at the subcartons
within the carton in attempting to fit the next item into the carton.

Note that when you add the first item to a carton, you can dissect the
remaining volume into 2 cuboids, in 2 different ways (and that is true for
each way you can place the item into the cuboid). If your items only fit one
way into the carton (as in your example) it will fit only one way into a
cuboid; you can see that this simplifies the problem considerably.

However, if there is more than one way to disect the remaining volume into
cuboids, you might want to do a depth-first search on the possibilities, or
some other optimization technique.
http://www.frontiernet.net/~fredm/dps/Contents.htm might be of use in that
case.

"sklett" <s@s.comwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>I realize this could be a little off-topic, but there are some great minds
on this NG and I hope you can let me slide this time ;0)

I'm designing our system to manage what products can fit in which cartons
and how many per carton. For example:
Widget A measures 10W x 10H x 10D
Carton A measures 20W x 10H x 10D
Carton B measures 50W x 10H x 10D

If I'm fulfilling an order for 2 Widget As I can choose Carton A as it
will contain 2 Widget A items.
Order for 50, Carton B, etc.

I would like to design a system that will eliminate user interaction in
this area, I would like my system to asses the item dimensions and
quantity and choose the appropriate carton.
The ideas that are floating through my head to solve this are far too
basic to be efficient and would result in a mess a spaghetti code handling
orientation combinations, etc.

Does anyone know of an algorithm that is designed to solve this problem?
I'm sure there is something out there, but my initial googling hasn't come
up with anything valid.
I hope you understand what I'm trying to achieve.

I appreciate any help!
Thanks,
Steve

Jun 10 '07 #3
This is known as the bin-packing problem and is a classic problem of
computer science. The only sure way to find the best fit is to try all the
combinations, which is often an excessively large search.
Jun 11 '07 #4
You shouldn't have to try 'all' the combinations. Likely in a real world scenario you can find approximations first and
narrow it down to those closest to the solution from there. For instance if the cube of the widget is 1000 units and
the first 100 cartons have a cube <1000 units I wouldn't bother testing them. As for packing multiple widgets in
cartons I wouldn't bother testing cartons <2000 units.

--
....Carl Frisk
Anger is a brief madness.
- Horace, 20 B.C.
http://www.carlfrisk.com
"Michael A. Covington" <lo**@ai.uga.ed u.for.addresswr ote in message news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
This is known as the bin-packing problem and is a classic problem of computer science. The only sure way to find the
best fit is to try all the combinations, which is often an excessively large search.

Jun 11 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3735
by: Steve Jorgensen | last post by:
Hi all, I'm working on the schema for a database that must represent data about stock & bond funds over time. My connundrum is that, for any of several dimension fields, including the fund name itself, the dimension may be represented in different ways over time, and may split or combine from one period to the next. When querying from the database for an arbitrary time period, I need the data to be rolled up to the smallest extent...
4
3013
by: murrayatuptowngallery | last post by:
I have looked at some mouseover/ sound object scripts and can't get them to work. Most were more complex than needed and introduced several new parameters for me. I found a simple pair of html code segments that accomplish display of an image and automatic 'display' (playback) of a .wav file, and apparently are usable for both IE and NS, " <object height="100%" width="100%"
3
20191
by: rafa | last post by:
Hi I'm just learning C and I was trying to do an exercise in a book which asks me to write a program to calculate the volume of a sphere. I know the formula is Volume = (4/3)*(Pi)*(Radius)^3 and I've been trying to write that but have been unsuccesfull so far. I tryed: volume = 4/3 * PI * radius; volume = volume * volume * volume; or
6
2114
by: soren juhu | last post by:
Hi, I am developing a C Program for reading over a million files of size 1 kilobytes each and sending the contents to another program using some middle ware. I need some help on designing the program to process such a large number of files in less than 8 hours. TIA Soren
8
3274
by: Dmitry Klymenko | last post by:
Do exists a way to detect a volume label of a disk? I've found the way to do this using WMI (System.Management) or winapi function. The second solution is principal non-portable in future, the first one require service WMI to work on client (for sure it's not a guarantee to be allways running). I do not want to include in my application logic, that will attempt to start that service before determining logical drive volume label. If no way to...
4
4337
by: Bill Sun | last post by:
Hi, All I have a conventional question, How to create a 3 dimension array by C language. I see some declare like this: int *** array; int value; array = create3Darray(m,n,l);
7
7655
by: Rich Milburn [MVP] | last post by:
Ok I am not a programmer, I copied some code and very painfully got it working in VB6. I can adjust the volume with waveOutSetVolume on winmm.dll. But I could not seem to be able to figure out how to adjust the master volume. I thought maybe if I upgraded this into VS2005 VB.Net then it might be a little easier. But now I am getting PInvokeStackImbalance messages on this, and it doesn't even run. We're talking a very little program... A...
0
1208
by: jasonlyt | last post by:
I have developed 10 functions to look up the surrogate key from different dimension tables. For example, CREATE FUNCTION BIR_GET_DIM_PROD_ID (p_prod_cde VARCHAR(15), p_date DATE, p_ctry_code CHAR(2)) RETURNS BIGINT LANGUAGE SQL BEGIN ATOMIC DECLARE v_id BIGINT; SET v_id = (SELECT PROD_ID
0
1167
by: Mike K | last post by:
I asked this question in the OLAP group but got no response. I am hoping somebody will have some answers here. Thanks ------------------- HI, I need to create a dimension that will play off another dimension. For example: lets say we have branches going into discontinued operations time to time. What we would like to create is a dimension that will have the Discontinued status with Year. So something like:
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10371
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9187
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3850
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.