Number Matching
-
Hi, I'm developing a reconciliation software. I have to find the matching items using some rules. However, some items represent sum of other items but I don't know which are they. So, I need to find, by trial and error, the numbers that represent the another number. List 1 : 10, 300, 50 List 2 : 5, 50,20,25,150,5,30,50,5,20 Here 10 = 5 + 5 300 = 50 + 150 + 25 + 5 + 50 + 20 50 = 20 + 30 There may be hundreds of such number like in List 2 and dozens likes List 1. My job is to find which number make up the numbers in List 1 base only on the numbers. Can any one knows about any algorithm to achieve this task. Thanks
Md. Humayuon Kabir Hemoo
-
Hi, I'm developing a reconciliation software. I have to find the matching items using some rules. However, some items represent sum of other items but I don't know which are they. So, I need to find, by trial and error, the numbers that represent the another number. List 1 : 10, 300, 50 List 2 : 5, 50,20,25,150,5,30,50,5,20 Here 10 = 5 + 5 300 = 50 + 150 + 25 + 5 + 50 + 20 50 = 20 + 30 There may be hundreds of such number like in List 2 and dozens likes List 1. My job is to find which number make up the numbers in List 1 base only on the numbers. Can any one knows about any algorithm to achieve this task. Thanks
Md. Humayuon Kabir Hemoo
What comes in my mind is simply brute force: take a number from list 1 and try every combination in list 2. There are many ways to optimize this because it tries many combinations are surely wrong. for example: sort your list 2 and stop trying combinations if the sum gets bigger then the number from list 1. If your list 2 numbers have more characteristics (they are not completely random) maybe you can find rules so more needless combinations can be avoided. I hope this gives you a good start... Rozis
-
Hi, I'm developing a reconciliation software. I have to find the matching items using some rules. However, some items represent sum of other items but I don't know which are they. So, I need to find, by trial and error, the numbers that represent the another number. List 1 : 10, 300, 50 List 2 : 5, 50,20,25,150,5,30,50,5,20 Here 10 = 5 + 5 300 = 50 + 150 + 25 + 5 + 50 + 20 50 = 20 + 30 There may be hundreds of such number like in List 2 and dozens likes List 1. My job is to find which number make up the numbers in List 1 base only on the numbers. Can any one knows about any algorithm to achieve this task. Thanks
Md. Humayuon Kabir Hemoo
Try sorting all #s first. Then for each element in list 1, search for a match in list 2. Upon finding it, remote the item from both lists. So if there are 3 50's in list 1 and 8 50's in list 2, you should be left with 0 in list 1 and 5 in list 2. Then with your new list 1 and 2, try to reconcile the largest items first. You should do sweeps assuming that an item in list is the sum of two #s. Then after trying this for all items, then look at sums of three #s... You will loop over the combinations using (d-1) dimensional arrays where d is the # of items in the sum. Note that this does not guarantee that it will find the right solution.... The correct algorithm is more complex. You could mark each # as being utilized for sum of k #s in the other list. Then you have to search multiple cases until you find your most explanatory match... Depending on what other information you have, there may be an even better method.
-
Hi, I'm developing a reconciliation software. I have to find the matching items using some rules. However, some items represent sum of other items but I don't know which are they. So, I need to find, by trial and error, the numbers that represent the another number. List 1 : 10, 300, 50 List 2 : 5, 50,20,25,150,5,30,50,5,20 Here 10 = 5 + 5 300 = 50 + 150 + 25 + 5 + 50 + 20 50 = 20 + 30 There may be hundreds of such number like in List 2 and dozens likes List 1. My job is to find which number make up the numbers in List 1 base only on the numbers. Can any one knows about any algorithm to achieve this task. Thanks
Md. Humayuon Kabir Hemoo
Both of replies are very helpful. I think I have got the point. Thank you very very much.
Md. Humayuon Kabir Hemoo