N-Way debt settlement error detection problem
There are N traders who operate a mutual credit scheme. At the end of some given
period there will be a settlement day. In a perfect world each trader only has to add up
their debts and credits to get a single figure representing what they have to pay into or
take out of the mutual fund. But alas the world is not perfect and some will make
mistakes. One way to resolve mistakes would be to match up every "A owes B five
pieces of gold" with "B is owed five pieces of gold by A" record. This would take a lot of
time and effort. Is there a middle way? These traders don't really want to give a list of
all their transactions to a third party.
Suppose there was only one mistake where say a transaction between C and D is the root of the problem. If we removed C and D from the totaliser pool then everything would balance for them and we could leave C and D to sort out their differences on their own. The trouble is we don't have any data and process to discover which pair are causing the problem.
If traders subdivided their overall totals into pre-defined groups then some of these groups would sum to zero and others fail. (For example a trader might report that for four sub-groups the amount owing was -10, + 14, + 56, -44 respectively.)