This is an abstract computer code application that I'm trying to solve, but I think the following real life example kind of helps to illustrate the type of problem I'm working with.
In this example, the first group contains railroad passenger cars. Each object (a passenger car) in this group has 2 properties: weight, and length.
The second group contains railroad cattle cars. Each object in this group also has the same 2 properties: weight, and length.
The third group might contain luggage cars, and all have the weight and length properties.
etc. etc... (there need to be 7 groups total, but I think you get the idea).
The weight and length for each car in each group can be different.
Now, there is a locomotive, which can pull 7 cars, and 1 car must come from each group. Moreover, the combined weight of the 7 cars cannot exceed x, and the combined length of the 7 cars cannot exceed y.
What's the mathematical process for determining which 7 cars will get as close to the weight and length limits as possible without exceeding them?