Splitting profits based on quantity of work when work is reused General Problem
We (a small organization) want to split all profits for a project based on the quantity of work invested into that project (thus, if Person A invests 40h and Person B invests 60h, A gets 40% of all profit and B gets 60%). However, there is a complication when a component of one project is reused in another project. For instance:
Project 1: A spends 10h on a Component used in the project, B spends 5h doing something else, the project makes \$60
Project 2 (occurs after Project 1): The Component is reused and B spends another 5h, the project makes \$60
After just Project 1, we expect A to get \$40, having done two thirds of the work, and likewise B gets \$20.
After Project 2, we have a problem (explained below): how should the money be allocated? 
Assumptions


*

*People within the same project did approximately the same quality work

*A project's quality determines its profits

*A project will not lose money overall (if it does we intend to use a different system)


Wants


*

*Order of projects shouldn't matter (that is, changing the order of the projects should not change how we split up the profits)

*As new projects are completed and the profits calculated, no one should ever lose money (that is, we don’t want to be paying someone in one project and then taking some of that money back in the next)

*If two people have done the same quality work, they should be paid the same amount.

*(Least important) If two projects are identical except that one makes 'x' times as much money as the other, than the pay for those who worked on the more valuable project should be 'x' times as much compared to the other one.


We know that the first two assumptions are contradictory (if a component is used in multiple projects, each of which took the same amount of total time to create, but resulted in different profits, either the component is not the same quality as the rest of the project, or else the project’s quality does not determine profit).
Due to “want #3” and the first two assumptions, we expect that in the above scenario, both A and B will get 50% of the profits (\$60 each). Our problem is how to figure this out in the general case.
“Solutions” That Don't Work


*

*Pooling all hours and profits together (across all projects), then splitting up the profits. Besides violating assumption 2, it ends up violating want #2 as well (imagine a project that makes no profit but consumed many hours: the profit would be distributed to those fruitless hours, taking money away from more successful projects).

*Count a component’s time just like any other work. In the above scenario, this means giving A \$40 in both projects. Unfortunately, this would give A more money than B, which isn’t what we want in this case.

*Ignore a component’s time after it’s re-used. This means giving A nothing in Project 2 (B would get all of it).


Base Pay
Base pay in a single project is equal to the project’s profit * the percent of time invested in a project that a person was responsible for (excluding time spent on components that were reused in another project).
For instance, in the above scenario, B worked 5 out of 15 hours in Project 1, and so his “base pay” is \$20 (one-third of \$60).
The “value” of a component is calculated the same way (\$40 for the Component in Project 1).
The “max value” of a component is the maximum value of the component in any project (so if it’s valued at \$10, \$50, and \$25 in three different projects, we say its “max value” is \$50).
(This is where the contradiction of assumptions 1 and 2 come into play: if the component is worth \$40 in Project 1, we would expect the component to be worth \$40 in all projects - which is not always the case. To get a sense of its “real value”, we are using a component’s “max value”. Other possible solutions include using its “first value”, “average value”, and “max value after two projects”. The main drawback of “average value” is that it can violate “want #2” should the component be used in a project that makes no money.)
A person’s total base pay (over all projects) is equal to the sum of their base pays in the individual projects plus the maximum value for any reused components they created. (In the above scenario, A has \$0 base pay in each project (A spent no time on either project outside of the Component), but since A created the component and the component is valued at \$40 in both projects, A’s base pay is \$0 + \$40 = \$40.)
Residual
We intend to pay each person their “base pay”, but if we stopped right there, there is residual profit. For instance, in the above scenario, the total profit is \$120, but A’s base pay (\$40) plus B’s base pay (\$40) is only \$80.
Thus our question becomes: How do we split up the residual fairly?
At first we tried to split it up based on how much work each person did, or based on a person’s base pay (according to our assumptions, that’s equal to the quality of work they’ve produced). However, doing this never worked out because the increase in residual is not necessarily proportional to the success of a project (nor to the hours worked in that project). This resulted in the possibility of a very successful project coming along and “stealing” money away from the less successful ones.
ex. If we extend the original scenario to have a third, very successful project:
Project 3: Component is reused and Person C spends 90 hours. Project makes \$1000
A base pay = Component max value: \$100
C base pay: \$900
B base pay: \$40
Residual: \$80
Note that before Project 3 came along, A and B both had \$60 (due to the residual of \$40 being split evenly amongst them; their base pay of \$40 plus \$20 from their share of the residual is \$60).
If we “inflate” all base pays so that they use up the residual (multiply all base pays by (1120/1040) 1.08 , B only gets 40*1.08 = 43.2, which is down from the \$60 he was getting after Project 2 -- in other words, some of B’s money is taken away (we already paid B the \$60 and are now asking for some of that back) -- clearly undesirable.
(We tried limiting the residual distribution calculations to the specific project in which the residual was generated, but this didn’t work out either - we would end up either violating “want #1” and/or not satisfying our original scenario).
So, we move on to the next question: what is proportional to the increase in residual?
In general, the residual “generated” by a specific component within a project is equal to the minimum of these two things:


*

*The component’s “max value” over all previous projects (This number is 0 when the component hasn’t been used before)  

*The component’s current value (in the specific project we’re considering)


So, for instance, in the scenario we’ve been looking at, the residual generated in each project is:
Project 1: \$0 (the “max value” of the component was \$0 before this point, the current value in Project 1 is \$40; the minimum of these two values is \$0)
Project 2: \$40 (the previous max value was 40, the current value in Project 2 is 40)
Project 3: \$40 (the previous max value was 40, even though the current value in Project 3 is 100)
We’re unsure if there’s a way of attributing some percentage of the residual generated in each project (with the idea that if we attribute 50% of the residual to a person, then that person receives 50% of the residual) to the different people involved while still satisfying our list of wants and satisfying the original scenario (that is, after Project 2, we expect the total money given to A and to B to be the same).
Is there a way to do this? Is there a different approach entirely that would work?
 A: There ain't no graceful way.  The question you ask under General Problem is not mathematical.  You should answer it based on your feelings for what is fair.  That answer (and many more like it for other situations) become input to define an algorithm.  One way is to assign a value to a Component and charge royalties to a project for using it, then distribute those to the authors.  Those royalties will reduce the profit on the project, to the detriment of those who worked on that one.  You also have to deal with how to compensate a Component author when the Component is slightly modified and reused.  If that eliminates the residuals, I can always mod something in a minor way.  If not, I am tempted to write a new Component from the ground up, costing the company a lot more time, but not paying royalties.
This sounds like you are developing software, but writing code is not the only way to add value to the organization.  Maybe in Project 1 some of B's time was setting up a network/workflow that made the whole organization more efficient or protecting against bad guys hacking your network.  Should that be rewarded? It is value that carries on after the project is done. "What gets measured gets done"-Tom Peters.  People quickly figure out what is not rewarded and put their efforts where they will be rewarded.
