I'm a layperson when it comes to maths so I don't know exactly what terms I should use to search for, or even describe the problem, so apologies if this is a duplicate already answered. I come from a programming background. This example is a simplification of the actual problem. Say I have a table of values for combinations 1A, 1B, 1C, 1D, 2A etc:
| A | B | C | D | |
|---|---|---|---|---|
| 1 | 12 | 10 | 09 | 08 |
| 2 | 10 | 03 | 02 | 01 |
| 3 | 03 | 09 | 04 | 03 |
| 4 | 01 | 02 | 07 | 05 |
| 5 | 01 | 02 | 02 | 02 |
| 6 | 01 | 01 | 01 | 01 |
Using only 4 out of the 6 rows say, I need an algorithm that will efficiently find the largest total of column values for the 4 rows without duplicating a column. So for this table the highest value I can find is 34 using 1D, 2A, 3B and 4C. Of course I could write a routine that just looked at all possible combinations. For this case that would be fine, but with larger numbers of elements it would take too long. Is there a maths short cut out there that can help me?