A simple linear function should do. Something based on 3 variables and one constant; something like
CombinedPriority = k * (cd - d) + p
Where k is a coefficient expressing the relative importance of the date vs. the priority value, and cd is the current date.
How/why does this work?
- (cd - d), expressed is day units, indicates how late (if positive) we are, or how many days we have left (if negative), relative to d. The bigger the value the more "blown" the delivery date; the smaller the value, the more time we have before it comes due.
- k is used to "convert" this days-late-or-early value, in whatever rank units of the variable p.
- take the sum of the two, and you have a rating value for a given task (i.e. a d and p value pair), relative to other tasks, for today (this will of course change tomorrow, as when we move in time, d matters more).
Another, similar but less intuitively tractable approach is to increase the degree of the equation, to express the fact that, say, when we are two days late is the importance of the date should have a bigger impact on the CombinedPriority than when we are just one day late.
The function would the look something like
CombinedPriority = kd2 * ((cd - d) ^ 2)
+ kd1 * (cd - d)
+ kp2 * (p^2)
+ kp1 * p
Where kd1, kd2, kp1, kp2 are constants, expressing the relative importance of the four elements of the addition. some of these constants may even be zero; in that sense, the first function is a particular case of the second function, one where
kd2 = 0, kp2 = 0, kp1 = 1 and kd1 = k
To summarize: the difficulty is not so much with the math per-se, but with defining a good set of constants which expresses the relative importance of d and p, and possibly the scale on which d and p are measured.
The first function assumes that each of these two factor is on a linear scale (a job with p = 6 is twice as urgent as a job with p = 3, and/or a job 3 days late is three times as urgent as a job due yesterday etc.), whereby the second function allows the d and/or p factors to be on a quadratic scale.
A tentative plan to help define the coefficient(s) is to:
- first consider the p factor individually (as if the d factor didn't exist). Only considering the p factor, how urgent is a job with p = 3 relative to a job with p = 6 (or p = 9) etc. ?.
- second consider the d factor individually. (Similar to above: how urgent is a job which is due 5 days from now, relative to a job due tomorrow? Or a job due two days ago?
- these two steps help define if any of the scales is not linear, and orient us toward a function or the another
- then we're just left defining the relative importance of the "normalized" p and d factors; this is done by tweaking the k (or kpn, kdn) constant(s).