user151841
user151841

Reputation: 18046

find a subset of numbers that most closely match a sum

I'm looking for a technique or algorithm that will give me a subset of integers from a given set that, when summed, most closely match a given target number.

I have a music video and I want video for 248 frames. I have a set of clips of various lengths, all less than 248. I would like a subset of those that are closest to 248 when their lengths are summed.

Is there something on the linux command line that I can use to do this?

Upvotes: 0

Views: 222

Answers (1)

msw
msw

Reputation: 43487

Ye Olde Bin Packing Problem and oddly I can't think of a standard implementation.

Upvotes: 1

Related Questions