minimal peer to peer transactions #1
Hostea is not incorporated, meaning that money flows between Hostea members. For instance @Gusted will receive money and it could be from @easter-eggs and me and @realaravinth , each sending part of what @Gusted entitled to. That's grossly inefficient. Instead I could be the only one sending you money for the whole amount. That being settled, we'll have to figure out how the rest of us will share the remaining funds.
@Gusted suggested to look at https://liumingzhang.gitbooks.io/google-questions/content/optimal_account_balancing.html which is the same kind of problem explained. The author does not provide a solution but it is a good algorithmic description.
It is similar to the same problem as distributing data evenly on disks with varying capacities which is resolved by CRUSH https://www.ssrc.ucsc.edu/Papers/weil-sc06.pdf/ but slightly simpler. Abstracting this as members == disks, income == bytes that need to be replicated, expense == available space with the goal of filling out all available space while probabilisticaly keeping the peer to peer exchanges to a minimum.
This is a very creative and unique solution to another NP-hard problem, also a mixture of maths and smart heuristics / approximations.
The function implementing the revenue sharing model is in share.py (see https://gitea.hostea.org/Hostea/accountant/pulls/3) can can be used.
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?