1

I want to solve the following problem. It is not a homework.

Assume that a company pays payroll to employees every period, the sum of the salaries for period is $T$. The accountant goes to the bank and withdraws the amount. She does not know what denominations she should ask the cashier to give here so that she can satisfy all salaries without asking any employee for change back. In the example below the denominations are 5,10,20,50 and 100. The total amount for all salaries for the period is 365. One employee gets 90 Dollars, the other gets 120 Dollars and the third gets 135 Dollars.

Questions:

Q1 - is to determine for each employee how many bills of each denomination to use so that the salary amount is paid in full and exactly without asking the employee to return change to the accountant. The answer presented suggests that first employee be paid 2-Twenty Dollars bill and 1-Fifty Dollars bill, and so on. Of course there may be 0, 1 or many solutions.

I am looking for the algorithm to use. You can help me by providing a reference instead of typing all the details.

Q2 - How can I tell if there is no solution?

Q3 - What area of mathematics study this kind of problem? Is it Dynamic Programming/Linear Programming?

Q4 - Do you know of any software that solves this kind of problems?

Thank you all.

Example data: enter image description here

NoChance
  • 6,695
  • Not sure this is sufficiently constrained. You could ask for all $5's$, say. or one $5$ and $36$ $10's$. Among other possibilities Are there other constraints? Fewest number of bills, say? – lulu Apr 26 '16 at 11:03
  • 1
    If, instead, you want to know "how many ways are there to do this?" then there are standard methods using generating functions. See, for example this or this – lulu Apr 26 '16 at 11:07
  • @lulu, thank you for your comments and for the links. Of course it would be fancier to add constraints, but I thought this would make it harder. As for the generating function approach, it is elegant. However, I guess it works for a single amount (employee in this case) only. I also think that trying to satisfy each individual separately, could lead to the situation where one runs out of 1 or more denominations suddenly, and would have to start over again. – NoChance Apr 26 '16 at 11:48
  • If you have solved for each individual separately, then the three solutions combine to a global solution. Conversely, a global solution certainly gives you three individual solutions. There are well known probabilistic questions (like the ballot problem ) which ask about the extent to which you can just ignore the order of the bills and pass them out to whomever comes first. – lulu Apr 26 '16 at 11:53
  • 1
    To clarify, I didn't mean to suggest that the individual solutions and the global solutions are in bijection. They aren't. If Alice gets two $5's$ and Bob gets a $10$, then I can switch those. So there is a combinatorial question involved in deciding which sets of individual solutions provide equivalent global solutions. Is that what you are asking about? – lulu Apr 26 '16 at 11:59
  • @lulu, actually I was wondering how to provide (any) solution. Some algorithms, of course you know this, provide a 'next' solution as one iterates but this is not necessary. Again, I am curious about the problem. As for solving each one individually, I still think that we can't 'always' get a solution unless we have 'enough' number of each denomination required. I could try to come up with an example. – NoChance Apr 26 '16 at 12:22
  • 1
    Well, unless I am confused (always possible) I see no problem with solving individually. Then just keep an Alice pile, and a Bob pile, and a Claire pile, and so on. Existence is a "small number" problem. That is, barring divisibility obstructions, there's always a solution if the total is big enough. If you have denominations of $2$ and $5$ then you can get any total larger than $3$, for example (but $1$ and $3$ are impossible). – lulu Apr 26 '16 at 12:27
  • @lulu, thank you very much, I will check on this some more and let you know if I come with a counter example... – NoChance Apr 26 '16 at 12:31

0 Answers0