-
Notifications
You must be signed in to change notification settings - Fork 8
Algorithm to compute tasks for each day
Author Palvit Garg
Terminology used in aPAS:
Unscheduled Events: The events which have a deadline but its start date is generally not useful for example Income tax filing for most people only deadline is something that matters :p.
As per agile methodology aPAS follows sprint based model, where each sprint is of 7 days from Monday to Sunday. User is supposed to add all his/her unscheduled events on the first day of sprint. Let's say today is monday and below events are in my unshceduled events:
- SE project | Thursday -> need to spend 6 more hours before submission
- Leetcode practice | Sunday -> need to spend 6 hours in this week
- Apply for internships | Sunday -> need to spend 3 hours in this week
- Read CLRS book | Sunday -> need to spend 10 hours in this week
Let's say my each day working time is 10 hours(excluding sleeping, daily chores etc) In my Google Calendar, let's say I have few scheduled events(part of working hours) as below:
- Monday -> 3 hours classes + 1 hour Professor discussion + 1 hour coding test = 5 hours booked
- Tuesday -> 1 hour classes + 3 hours job = 4 hours booked
- Wednesday -> All free = 0 Hours booked
- Thursday -> 4 hours Surplus sale + 3 hours classes = 7 hours booked
- Friday -> 3 hours job + 2 hours quiz = 5 hours booked
- Saturday-> 7 hours Conference = 7 hours booked
- Sunday -> All free = 0 hours booked
Total available hours in one working week = 70 hours
Total scheduled events time = 28 hours
Total unscheduled events time = 25 hours
- First aPAS will collect list of all events from your calendar and compute available bandwidth for each day.
- The available bandwidth for each day(for above scenario) is 5:6:10:3:5:3:10 ratio.
- Now sort all events on the basis of their deadline firstly (earliest deadline first), and then number of hours secondly (largest remaining hours first).
- Sorting in above way gives highest priority to the event which is to be completed first(deadline soon) and then if some event have same deadline then on the basis of needed hours to finish it.
- Now maintain 7 buckets(for each day) of size representing its available hours. We will keep filling it in next steps.
For each unscheduled event from sorted list:
- Check if this unscheduled event's needed timing is less than or equal to total available bandwidth untill its deadline. If this condition fails indicate this to user to try to find more time from daily chores or sleep time.
- Since if we are able to accomodate this event, so we will divide this task timing between all days on the basis of their available bandwidth. Think of it as weight based division, where weight is the run time bandwidth for each bucket.
- Once computed add those time blocks in each bucket and update the available bandwidths.
#Iteration 1 for given data: SE project has earliest deadline so we need to first accomodate this event. 6 hours to be accomodated in monday, tuesday, wednesday and thursday. Divide six hours in ratio as 5:6:10:3. Thus on monday I need to spend around 1.25 hours on monday, 1.5 hours on tuesday, 2.5 hours on wednesday and 0.75 hours on thursday. New bucket size can be reduced accordingly.
Once all above are completed, finally our model is ready to give suggestions. For each day we just need to show each bucket to user. Also don't forget to show those events which you were not able to accomodate.
This algorithm can easily accomodate any changes after updation. Let's say user made changes on tuesday. So we can recompute each bucket considering bucketsize for monday as 0(already passed) and for tuesday consider the remaining working hours and so on.
