# Cutting tubing lengths

I have a quantity of tubing that must be cut to various lengths with minimum waste. Some years ago I worked with a boiler repair shop that had a program to solve this problem. Now I have need of it I can write the code, but I need help with the formulae to do it.
Jim Y
waste. Some years ago I worked with a boiler repair shop that had a program to solve this problem. Now I have need of it I can write the code, but I need help with the formulae to do it.
See here:
This is one of a class of similar problems:
"Jim Y" wrote in news:BY-dnWt-pcyr9mzbnZ2dnUVZ snipped-for-privacy@comcast.com:
I tried it, but unfortunately, it has too many bells and whistles for my application. I think I would rather write my own routines.
Thank you for the suggestion, Jim
The following is what I want to do. A short sample problem is illustrated.
I have a population of 20 entries and want to separate it into 5 groups of near equal numerical amounts. With just 20 entries, I solved it manually (see one possible solution below). But, if I get a larger population of 100 or 500 entries, then I need help from a PC. (I am using Visual Basic 6 (not .NET) to solve this.) The following is sample data for which I am basing the program. The entries have text which I will retain, but the sort is numerical. The sort of 4 entries into each of 5 groups is my problem. How do I get the answer, or close to it, that is at the bottom of this post?
As an example, consider the input data to be a list of files on a computer that must be copied to compact disks (CDs). Each CD can store approximately 716000 KB (for this example), but I want to make each CD contain close to the same amount, the average (655242) of the total (3276208) within 1/2 percent.
My Input data:
Alpha 161070
Bravo 200693
Charlie 144706
Delta 156937
Echo 141950
Foxtrot 264431
Golf 129718
Hotel 122485
India 137988
Juliet 176747
Kilo 220332
Lima 151080
Mike 125412
November 170891
Oscar 136265
Papa 146946
Quebec 165550
Romeo 186222
Sierra 155214
Tango 181571
The sum of the entries is 3,276,208. Setting 5 groups averaging 655,242, each group will have 4 entries. I know larger populations will not have an even number in every case. There may be a an odd number of entries in a group or two. The following is what I did manually and would like some help with doing the same *or better* with VB6. Having the information stated, I need some suggestions to achieve the following (or close to it) based on the input numbers. I need a "simplified" description, one without mathematic symbols that I don't understand. With a good explanation of the math, I believe I can solve the programming portion.
The following represents my answer - the five groups and their totals:
264431 220332 200893 186222 170891
137988 122485 156937 181571 165550
129718 176747 151080 144706 161070
125412 136265 146946 141950 155214
Great response!
Brian W

#### Site Timeline

• Is anyone familiar with the Pipe Cutting Problem? More than 20 years ago I...
• next in

## ⚙ Mechanical Engineering

• Hi everyone, I am new to this group, I am currently pursuing B.Tech in...
• previous in

## ⚙ Mechanical Engineering

• Does anyone know how to locate the CFM rating of Maytag Dryer model MED8630HW?...
• last updated in

## ⚙ Mechanical Engineering

• Does anyone know how to locate the CFM rating of Maytag Dryer model MED8630HW?...
• last posted in

## ⚙ Mechanical Engineering

• >> >>>> Yesterday I found myself cleaning up a bit of square tube in >>>>...
• site's last updated in

## ⏣ General Metalworking

• Grawitacja pomaga wytwarzać światło, a to tylko początek niezwykłych...