Greedy algorithm for debt payment when choosing which debt to pay off first.

271 Views Asked by At

I wish to find a greedy algorithm for solving the following problem:

Given a set of debts, having an original value $X_{i}$ and an interest rate $r_{i}$ (meaning, they behave like a geometric series $X_{i} \cdot r_{i}^{q}$ for $q$ number of months), that can differ from each other, and a monthly amount to use for paying them $Tot$: I want to minimize the number of months needed for finishing paying all of them.

In other words, for each months I need to decide which debts I want to pay. Those not chosen, will be multiplied by $r_{i}$. And in the next month I'll have $Tot$ restarted, and I'll choose which of the remaining debts I'd want to cover. Repeating this until I reach a month having all my debts paid.

My first idea was to sort the debts somehow and then in a greedy manner choose as much as I can until I reach $Tot$. My problem was understating how should I sort them, neither the original debt amount nor the interest rate seemed to do the trick.