Is anyone familiar with the Pipe Cutting Problem?

More than 20 years ago I worked at a boiler repair shop that had a Pipe Cutting program. Now that I am retired, I could use it again. Searching the internet has resulted in math symbols that have no meaning to me. I have been out of school for too many years and do not remember things that I have not used in 45 years.
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 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 my sample data for which I am basing the program upon. I hope I haven't screwed up the numbers with a typo, but I think you can gather what I am trying to do if I did. The entries have text which I will retain, but the sort is numerical. The sort 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

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

----------- ----------- ----------- ----------- -----------

657,549 655,829 655,856 654,449 652,725

Note the total KB of each of the five groups (5 CDs) is close to the 655242 average. I attempted to keep them within a range of 651966 to 658518 (655242 plus/minus 1/2 percent).

I appreciate any and all help,

Jim Y

More than 20 years ago I worked at a boiler repair shop that had a Pipe Cutting program. Now that I am retired, I could use it again. Searching the internet has resulted in math symbols that have no meaning to me. I have been out of school for too many years and do not remember things that I have not used in 45 years.

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

----------- ----------- ----------- ----------- -----------

657,549 655,829 655,856 654,449 652,725

Note the total KB of each of the five groups (5 CDs) is close to the 655242 average. I attempted to keep them within a range of 651966 to 658518 (655242 plus/minus 1/2 percent).

I appreciate any and all help,

Jim Y