Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculate urgency of a task from two variables

I am trying to figure out a formula to calculate the urgency of a set of arbitrary tasks, based on the number of days until a 'deadline' and the % completion of the task already completed.

So far I have a 'function' which gives the represents:

U = ((dd * 25) - (100 - cp))

Where: 
dd = Day difference from deadline to current date (in an integer value)
cp = current completion % (in an integer value - in increments of 5 currently)

This gives me a linear function, and the 25 in the function indicates a 25% per day progression of the task.

So that at any given date:

Where U <0 task is urgent
Where U =0 task is on schedule
Where U >0 task is ahead of schedule
(The actual display on if a task is on schedule (within a range) would be handled separately)

Is there any other methods to calculate the urgency of a task, from the difference of two dates and weighted by a variable? From current responses: Using the start date,end date and current date differences along with completion % to calculate urgency

Possibly using a non-linear function to increase U when cp >75% and decrease U when cp < 75%. Are there any advantages for linear vs non-linear functions?

This will be used in MySQL & javascript, as I'd like a way to display how on track a task is using the U value. So finding a method to correctly (more so than my current method) calculate the value for U is what I'm attempting to do.

Solution

The solution I went with (based on marked solution):

((((((end_date - now) / (end_date - start_date)) * 100) * (100 - cp)) * 10) * -1)

Minor Changes made

Using the rule of three as a start, multiplied by 10 just to increase the values & create a wider range without needing to factor for float values too much. Also multiplied by -1, this was so that completed tasks then give a negative number, while incomplete tasks show a higher number (makes sense: higher urgency of a task therefore a higher number) I may in future add to this, adding a velocity for a task as suggested & also taking into account for the number of people assigned to a given task. This function is only going to be used for a rough guide to show someone what tasks (in a given list) the might need to do first.

Also as I used this in MySQL the function needed to be wrapped in a IFNULL (due to existing data in my case)

IFNULL( *function* ,-200)

An initial arbitrary value of -200 if it was null value (as some tasks do not have an start/end date)

Thanks for the assistance & suggestions

like image 215
rStyles Avatar asked Nov 03 '22 02:11

rStyles


1 Answers

Given that:

  • due is day difference from deadline to current date
  • estimated is the time needed for a task
  • done is the progress in percentage

This would be a simple rule of three:

var rest = estimated / 100 * (100 - done);

if(due < rest) {
    state = 'behind';
}
if(due == rest) {
    state = 'on';
}
if(due > rest) {
    state = 'ahead';
}

Note that possibly very few tasks would be "on schedule" because they'd have to match exactly, you could also check in ranges like rest < due + 0.5 && rest > due - 0.5 or so, imitating a non-linear prioritizing.

like image 110
Simon Avatar answered Nov 09 '22 05:11

Simon