As pointed out, this looks like a variation of the knapsack
problem (although I've no idea what the purpose of the
single line is). The knapsack problem is a well studied
problem, and it is a really hard problem.
What is the background of your particular instance of this
problem?
As the seeker says, he wants to cut sheets of glass. I think he is looking to cut his own reference edge then go from there. It is solvable but it is NP-hard!
I do recall seeing something in the Perl world related to a similar problem. The seeker might look up WARDLEY on CPAN, I think Andy may have done something for optimizing fabric cut-out for kite building.