Optimal Settlement Plan for Group
We are a group of 6 friends trying to share our travel expenses. The settlement is far from optimal. At the end each person needs to make 5 settlements while this is not necessary.
You can add a little code to achieve minimum number of settlement to improve the user experience. Well here is the idea of the algorithm:
1. sort positive balance (to receive money) by value from largest to smallest
2. sort negative balance (to pay out money) by largest absolute value to smallest absolute value
3. use the largest absolute valued negative balance to pay the largest positive balance, if not enough, calculate the rest positive balance, if more than enough, calculate the rest negative balance
4. repeat 1-3.
As a product manager myself, I think this would greatly improve UX and thus worth doing.
Please let me know if you need any help.
Cheers,
Yang
Thanks for the suggestion! We have a very similar feature in groups. If everyone on the trip is in a group, you can turn on Simplify debts which will reduce the number of payments similar to how you suggest.
Marshall