algorithm - Bin-packing (or knapsack?) problem -


i have collection of 43 50 numbers ranging 0.133 0.005 (but on small side). find, if possible, combinations have sum between l , r, close together.*

the brute-force method takes 243 250 steps, isn't feasible. what's method use here?

edit: combinations used in calculation , discarded. (if you're writing code, can assume they're output; i'll modify needed.) number of combinations presumably far large hold in memory.

* l = 0.5877866649021190081897311406, r = 0.5918521703507438353981412820.

the basic idea convert integer knapsack problem (which easy).

choose small real number e , round numbers in original problem ones representable k*e integer k. smaller e, larger integers (efficiency tradeoff) solution of modified problem closer original one. e=d/(4*43) d width of target interval should small enough.

if modified problem has exact solution summing middle (rounded e) of target interval, original problem has 1 somewhere within interval.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -