My life as a program.

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
kriel
Posts: 923
Joined: Thu Feb 07, 2008 2:58 pm UTC
Location: Somewhere I'm not.
Contact:

My life as a program.

Postby kriel » Mon Feb 25, 2008 3:23 am UTC

Woohoo. To start this off, I'd just like to say that navigating forums using a text-based browser is... interesting. To say the least. (My SO has control of the only GUI-based computer at the moment... and is busy leveling a nightelf hunter on said computer.) But, in any case, Here goes. For awhile, I've had the idea of writing psuedo-code for my life. I like a certain sense of order, and though life rarely cooperates, it should at least prove to be a fun project. However, I manage to get myself stuck on my first topic. That of scheduling. My original idea was to schedule my life according to two databases, one similar to a cron daemon setup (Execute task x at time y) and the other a FIFO que. (Do laundry, do dishes, get groceries, etc.) However, this has some disadvantages. For starters, I don't always recieve tasks in the order I need to do them. (I can put off laundry for a few days (or weeks... -cough-) but groceries is a bit harder to delay.) Thus, I thought of having a prioritized que, sorting by deadline for said task. However, again, there are complications. I can put off the groceries I need to get tomorrow in order to work on the twenty page paper due in a week. Maybe some sort of two-criteriad (criterion? Hopefully the resident grammarian knows what word I mean) two-criteriad sort. So, What are your opinions? Suggestions? Oh, and if I'm in the wrong board, forgive me. I figured this might be a better locale than the off-topic (Er... Serious Matters) board.

Edit: Ugh. Sorry. My browser ate the \n's in the post. Hopefully blocktext dosen't bug too many of you.

User avatar
Poochy
Posts: 358
Joined: Wed Feb 20, 2008 6:07 am UTC

Re: My life as a program.

Postby Poochy » Mon Feb 25, 2008 5:24 am UTC

Suggestion using object-oriented programming languages: Each task creates a TaskToDo, which among its attributes has an Priority value, calculated based on the importance and urgency of the task as well as how hard it is/how much time it will take up. Tasks that can be easily combined will gravitate towards their average value. All the TaskToDo objects are put into a data structure that is kept sorted by Priority, and are removed to be completed one at a time starting from the high-Priority end.
clintonius wrote:"You like that, RIAA? Yeah, the law burns, doesn't it?"
GENERATION 63,728,127: The first time you see this, copy it into your sig and divide the generation number by 2 if it's even, or multiply it by 3 then add 1 if it's odd. Social experiment.

User avatar
Marz
Posts: 156
Joined: Mon Dec 10, 2007 9:13 pm UTC
Location: UK
Contact:

Re: My life as a program.

Postby Marz » Mon Feb 25, 2008 7:27 pm UTC

The Urgency of a task would probably tend towards a maximum Importance value over time, so that the 20-page paper would not be as Urgent as buying groceries a month beforehand, but steadily grows in Urgency, so that it may climb up the Stack (or, probably more efficiently, Linked List). This also means you could incorporate your cron daemon setup into this, by giving them an Importance of 100% but an Time Leniency (time before deadline it can be executed) of 0. By that I mean, it's Priority 0 until it reaches the time at which the task must be completed, at which point it shoots up to the top of the Stack.

User avatar
kriel
Posts: 923
Joined: Thu Feb 07, 2008 2:58 pm UTC
Location: Somewhere I'm not.
Contact:

Re: My life as a program.

Postby kriel » Tue Feb 26, 2008 3:58 pm UTC

This also means you could incorporate your cron daemon setup into this, by giving them an Importance of 100% but an Time Leniency (time before deadline it can be executed) of 0. By that I mean, it's Priority 0 until it reaches the time at which the task must be completed, at which point it shoots up to the top of the Stack.


The problem with that is, say I start executing a 2h task 30m before it's due. It would jump up to the top of the priority stack... but I wouldn't see it until an hour and a half too late.

My original idea was..

Code: Select all

loop
     grab highest priority task;
     check next time on cron;
     if(can finish task by next cron)
          do task;
          continue;
     else
          if(taskque not empty)
               grab next task;
               continue;
     waste_time(time left till cron);


However, still got issues with the priority. Yech.

Each task creates a TaskToDo, which among its attributes has an Priority value, calculated based on the importance and urgency of the task as well as how hard it is/how much time it will take up.


I really like this. (And it would efficiently put two conditions into one value.) The only problem would be finding a good calculation to find said priority, though I suppose a little trial and error could find an acceptable (though not optimal) solution.


I was experimenting with ways to fit the objects in the stack 'into' the cron's schedule. Say, for instance, monday is empty with the exception of a class from 2-4p. You could pack a lot of other tasks around that class. All You'd have to verify is that you could get every task done before it's deadline.

hm..

You'd have to sort by both time required AND deadline.

sort by time required, and you get a bunch of 6h projects done, but miss a lot of the 5m tasks due tomorrow
sort by deadline, and you get all your 5m tasks done, but nowhere left to put that 6h monster.

sort by calculated priority... maybe. Not sure.


Maybe I'm misunderstanding you. Both of you suggest that the priorities will gravitate/climb towards an average, but I don't see that happening..

EDIT(s): Psuedocode was wrong. It annoyed me.

der_bAUer
Posts: 74
Joined: Wed Nov 01, 2006 9:55 am UTC

Re: My life as a program.

Postby der_bAUer » Tue Feb 26, 2008 4:37 pm UTC

After I had read David Allen's book "Getting Things Done", I went through at least five attempts to program something which would digitally implement his methodology, and I thought a lot about time management in the process. Finally, I have something which seems to work: I use a custom text-mode* program to manage the "Next Actions" by context and the excellent Leo outliner for project support material.

Having your computer automatically calculate what you should do seems nice, but if you would want to provide your computer with all the data it would need to make an optimal decision, you would waste lots of time entering tasks. Of the systems I went experimented with, those which required me to enter the least data worked best.

Another thing to keep in mind (and one of David Allen's main points) is that you also have to plan your tasks by context: when you are not at home, you could make phone calls with your mobile but you couldn't take the trash out. Additionally, you have to take your current physical and psychic energy into account when deciding what you should do next.

The decision about what to do next has to be yours - the computer's job is to always list all your current options at a glance.

-- off topic section follows --
* This was actually my very first design and started out as a python/curses text mode program, which then broke when I moved back to windows (no curses there) and then didn't work when I switched to Ubuntu (UTF8-locale). After at least four other attempts (mostly webapps), I decided that this first attempt had been the only one I hadn't scrapped because I didn't like it any longer, but because it didn't work anymore. So I implemented the subset of curses I needed using Tkinter (called "tkurses") so that this program would support umlauts through unicode.

User avatar
kriel
Posts: 923
Joined: Thu Feb 07, 2008 2:58 pm UTC
Location: Somewhere I'm not.
Contact:

Re: My life as a program.

Postby kriel » Tue Feb 26, 2008 4:59 pm UTC

The thing is, I'm doing this as a thinking experiment, not as a working model. A working model would have much more (or maybe less :) ) input, and prioritization would be less important. (It would show the next few things that need to be done, and let you prioritize it yourself.)

User avatar
tiny
Posts: 771
Joined: Tue Oct 23, 2007 5:34 pm UTC
Location: Below the fifth cellar.
Contact:

Re: My life as a program.

Postby tiny » Tue Feb 26, 2008 10:25 pm UTC

I don't know if this info is helpful in any way, but when I have Tasks Of Doom that take several days or even weeks to complete, I divide them up into units.
So a paper for uni that will take me 15 hours to complete will be chopped into five units of 3 hours, having high priority on each of the five days that I'll work on them.
That implements a deadline for the whole project as well as a daily priority.
"I write what I see, the endless procession to the guillotine." ~ de Sade

Parsifal
Posts: 113
Joined: Thu Feb 28, 2008 1:35 am UTC

Re: My life as a program.

Postby Parsifal » Thu Feb 28, 2008 4:02 am UTC

Here's an idea I got from rereading "I, Robot". Remember the story about the robot who needed to get a mineral from the surface of Mars to save two humans? As it got closer and closer to the objective, it detected extreme danger to itself, so eventually it started orbiting at a distance which equalized these two very good and very bad outcomes.

The point is that people aren't, and shouldn't be, as rational as robots, or else you have to trade the ability to react to changes with inefficiency as you drop a now-unimportant task and rush off to something else. People constantly weigh whether they want to, or need to, do something to decide whether to keep at it or go do something else.

I propose that each task have an "enjoyment" value and a momentum value which corresponds to the time already spent doing it. By multiplying these values together and factoring in the relative importance of the task, you can more accurately decide when task-switching is called for. If you've been doing something you don't enjoy for hours (like writing a term paper) you should probably stick with it and finish. On the other hand, two hours of WoW probably means it is time to take out the garbage or do some dishes.

Basically it might help prevent task starvation by utilizing a lot of knowledge about task importance in a given context.

btilly
Posts: 1877
Joined: Tue Nov 06, 2007 7:08 pm UTC

Re: My life as a program.

Postby btilly » Thu Feb 28, 2008 4:38 am UTC

This thread reminds me of http://hiveminder.com/splash/. If you want to organize yourself with a computer program, try that one.
Some of us exist to find out what can and can't be done.

Others exist to hold the beer.

User avatar
silverwmoon
Posts: 18
Joined: Wed Feb 27, 2008 8:10 pm UTC
Location: Canada, asleep

Re: My life as a program.

Postby silverwmoon » Thu Feb 28, 2008 8:39 pm UTC

Call me a girl, but how flexible will the code be? How will you handle errors (like trying to get multiple things done down to the minute but something else comes up?)? I'm intersted to see how you'd handle things like that in your code.

Though I like the object-oriented approach especially for getting tasks done. How do you propose to schedule things if you're not feeling well? (Sorry, I just see too many conditionals, maybe I'm totally off base with what you're trying to do though =/)
Image

User avatar
psykx
Posts: 408
Joined: Sat Feb 23, 2008 11:24 pm UTC
Location: England
Contact:

Re: My life as a program.

Postby psykx » Sat Mar 01, 2008 1:25 am UTC

Ok with almost all tasks the more important it it the rarer and longer it takes e.g
thesis 10 weeks
eat 5 hours

each task is given a points value. then the longer the task _is in_ the system the more important it is (the more points) and the time you spend doing it takes away points. The cunning part is the more time you have to do a task overall, the faster points increase and decrease. This allows tasks such as sleep to eventually override the coding task. Tasks such as sleep and eat can be given a non ending status

for fun you should have a random number generator that make you randomly go out get drunk and get laid while you should be doing much more important things
Berengal wrote:Only if they're killer robots. Legos are happy robots. Besides, even if they were killer robots it wouldn't stop me. You can't stop science and all that.

Parsifal
Posts: 113
Joined: Thu Feb 28, 2008 1:35 am UTC

Re: My life as a program.

Postby Parsifal » Sun Mar 09, 2008 8:12 pm UTC

I submit that eating is more important than working on your thesis. It all depends on context... you shouldn't run to McDonald's to avoid doing your work, but if you're starving, eating trumps pretty much anything else.

User avatar
psykx
Posts: 408
Joined: Sat Feb 23, 2008 11:24 pm UTC
Location: England
Contact:

Re: My life as a program.

Postby psykx » Sun Mar 09, 2008 10:32 pm UTC

the post should read the less time you have to complete an action the faster the points increase and decrease. this model doesn't work because it can't deal with deadlines and having to do tasks at once
Berengal wrote:Only if they're killer robots. Legos are happy robots. Besides, even if they were killer robots it wouldn't stop me. You can't stop science and all that.


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 8 guests