简体   繁体   中英

Scheduling Algorithm for Scheduling Life

I am trying to write some code to schedule a set of real life tasks that are input by the user. These tasks are stored in an sqlite database. And at the moment, the only parameters I am taking into consideration are the,

The project to which a task belongs to --> p
The name of the task itself --> t
And the due date for this task --> d

The project and due date parameters are optional. But assuming that the user will always input at least the task name and due date for every task.. I was wondering if it is possible to schedule the set of tasks using a scheduler like the Completely Fair Scheduler (CFS) for example!. I realize that the CFS was written for scheduling tasks with much finer granularity(nanoseconds) than the set of tasks being proposed for this purpose... But I realized that it might be possible and maybe more efficient if I can modify it to work with tasks that are on the same time scale as our perception of time.

A typical entry in the database would be in the format (p, t, d). 'p' is optional. Here are a few examples..

(_, 'Call home', 29/2/2012)
(Work, 'Meet boss', 14/3/2012)
(Work, 'Ask for raise', 18/3/2012)
(_, 'Book tickets', 10/3/2012)
(Work, 'Quit', 14/4/2012)
(Personal, 'Get botox injections', 10/3/2012)
(Personal, 'Get breast implants', 10/10/2012)
(_, 'Dad bday', 7/10/2012)

Here is a situation to consider. I would like to wake up in the morning. Run this "yet to be coded" algorithm on the set of tasks.. like the ones given above.. and I would like to receive a schedule for the rest of day, that maximizes throughput. At a later stage, I would like to pass arguments to this algorithms that would allow me to control the scheduler to return a set of tasks depending on my current situation. Like if I am at work, I want to be able to pass arguments to the algorithm, to ask it to only return tasks that can be completed at work..

I hope I am able to convey the gist of it. I understand that the due date alone is not sufficient to schedule tasks using the CFS for example.. but if there are other parameters that I should consider, please do let me know. And any suggestions for the kind of scheduling algorithm to employ would be helpful.

Thanks.

the cfs is for scheduling slices of tasks on a cpu. you are a human and cannot multi-task like a cpu can. you are much better doing one task to completion.

the tools typically used to solve scheduling tasks for humans are related to constraint programming . they allow you to do things like optimise for certain variables (productivity, in your case, which i guess is related to tasks having different priorities) under various constraints (like there being only so many hours in a day, and being unable to do two things at the same time).

it turns out that, in general, this is a hard class of problems and there's no single, really good solution (although many are based around guided search in one form or another). you need to tweak approaches, try different algorithms, etc. because of this, various packages have been developed that provide fairly abstract interfaces which let you describe the problem in formal(ish) terms and then try to solve it in various ways.

having said all that, for any one particular case (like yours) it's probably going to be more productive to simply write a direct solution (rather than learn one of these complex packages). but i don't see using the cfs being part of any reasonable solution.

not sure if that's what you were looking for, or helpful - sorry. if i were in your position i guess i would try using choco because it's the one constraint package i've got some experience with. but you are not me and i doubt that's a good solution for you - you might be best just searching around based on the info here and then asking another question once you have a better idea of what is possible?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM