What are subsets and numeric issues?
Problem analysis, simply said that there is n number in this n number of selected number of the number to make these several numbers and M.
The way to solve the problem, using backtracking.
Finally form a two-fork tree
On the left there is this number, and the right son is not this number.
Using backtracking, one of the calculations, the time is too long.
Use certain conditions to shorten the time.
The premise is to sort all the numbers in a non-descending order, and then do the following.
A limit function that shrinks the set of possible solutions. Some can not produce the feasible solution directly to exclude.
∑w (i) X (i) +∑w (i) >=m
∑w (i) X (i) +w (k+1) >m
If you add a number k, if the number of k-1 and less than M, plus K is less than M but plus the next number of K is greater than M, then the number k is not calculated, directly excluded.
Subsets and problems of algorithm two