# Building a Permudoro: Theory and configuring the Permudoro framework in MATLAB

Matlab @ 03 November 2010

Originally, I’d planned on writing a small article focusing on the coding aspect of a MATLAB application I wrote to optimize my work/rest-flow based on the Pomodoro time management system. However, once I’d started work on it, I realized that my particular implementation was quite a departure from a basic time-management system; rather, what I had developed was more like a system of activity-diversification built upon the aforementioned time-management framework.

I’ve since given this system the moniker “Permudoro” as a conjunction of its underlying framework (the Pomodoro) and the basis of its method of diversification – which is to impose a certain number of independent and random constraints upon each segment of time so as to create novelty through combination and permutation. In its use thus far, I have observed a marked reduction in subjective work-related boredom/fatigue, related increase in productivity (indeed, I went through 2002 Organic Chemistry and Physics problems in the last week and a half, wrote explanations for each question and converted them to quiz format on my other blog) and much less hesitancy due to inability to decide between multiple competing tasks; however, I cannot guarantee that this observation is neither a placebo nor is it necessarily generalizable to persons other than myself. Nevertheless, I think that this system can be quite useful for anyone (given certain affordances).

So having indicated that the basis of diversification had something to do with combinations and permutations, it seems like a good time to discuss both the nature of those combinations and certain principles which have appeared (subjectively) rather relevant to their application.

Types of combinations

First, the major types of combinations are: sequential combinations, volumetric combinations, environmental combinations, and directive combinations.

Sequential combinations

Sequential combinations confer novelty related to order of process. For example, if you have some list of tasks to complete, sequential novelty is that which is related to the particular order in which those tasks are performed. Generally, this is the only set where the number of members is either equal to or less than the number of values in the associated output so it is the only set wherein permutation (as opposed to true random selection) is specifically applied. The generalized form of this combination is as follows:

function [output]=functionhandle(task1,task2,task3,task4)
% For now let us restrain ourselves to the pomodoro framework
% which allows 4 units of, 25-minute duration, task-oriented periods of activity.
tasks=char(task1,task2,task3,task4);
index=size(tasks);
if index(1)==4
   order=randperm(index(1));
   else
       order=randi(index(1),4,1);
end

Volumetric combinations

Volumetric combinations confer novelty through varying the quantitative criterion concerning some segment of activity/time. Because different tasks are quantized in vastly different manners (for example, one playthrough of a certain piano piece is quite different than one pushup), I’ve not yet found a good way to implement automated volumetric variation programmatically so volumetric variation is currently restrained to 3 periods of the permudoro which I refer to as the pre-task, break, and post-task periods. This will be demonstrated in a later section but a specific example is as follows:

 
%This is for the pre-task section where I choose to use a set
%of exercises as my exclusive pre-task activity.
 
volumeexercises=char('pushups', 'situps','tuck jumps','jumping jacks');
strengthexercises=char('DB squats','pullups','OHS','pistols','turkish getups');
volumequantities=20:10:40;
strengthquantities=3:3:9;
strengthindex=size(strengthexercises);
volumeindex=size(volumeexercises);
 
%Names of exercises along with reasonable numbers
%of associated repetitions considering 4 of them will be performed.
 
ex1=[num2str(volumequantities(randi(3))) ' ' strtrim(volumeexercises(randi(volumeindex(1)),:)) '.'];
ex2=[num2str(strengthquantities(randi(3))) ' ' strtrim(strengthexercises(randi(strengthindex(1)),:)) '.'];
 
disp(['Warm-up:' char(10) '1. ' ex2 char(10) '2. ' ex2 char(10) '3. ' ex1 char(10) '4. ' ex1]);

And here’s some sample output:

Warm-up:
1. 9 turkish getups.
2. 6 OHS.
3. 30 pushups.
4. 40 pushups.

Environmental combinations

Environmental combinations refer to different configurations of the audio/visual/tactile/postural/etc. setting. Due to the additive nature of sensation it is possible to even have more than one simultaneous condition associated with particular modes of environmental configuration (for example, playing 1 song is appreciably different from playing 1 song along with a background noise loop (e.g. Rainy Mood or Simply Noise) though I tend to refrain from doing so.

Environmental combinations can take both the form of verbal directives and automated processes. For example, let us consider the “environmental” modes of posture and music; in absence of some body positioning machinery, postural constraints such as directives to adopt “lotus position”, “kneeling position”,”standing position”, etc. can only be programmatically cued through text or perhaps through text-to-speech communication. In contrast, musical stimulus is readily provided through the web(‘url’,-browser) function.

Summarily, textual environmental combination directives are communicated in a manner similar to the code for the previously demonstrated pre-task directives while programmatically alterable environmental states are included as functions of the program. The following is an example of anonymous web function, embedded in a timer, which randomly selects some auditory stimulus from an array of provided urls:

t.pl=char('http://www.youtube.com/watch?v=q7bEUHJMIQY&feature=&p=CB6F8AD702747797&index=0&playnext=1','http://www.youtube.com/watch?v=9Qty8BU4Gvo&feature=&p=0562D2C1C91A09FA&index=0&playnext=1','http://www.youtube.com/watch?v=RRnVmCPXqxY&feature=&p=FC3745D37710A5E1&index=0&playnext=1','http://www.youtube.com/watch?v=GWpV7L4YHuU&feature=&p=A8BB608FBFB198B1&index=0&playnext=1','http://www.youtube.com/watch?v=O5raMK4Z9co&p=AD1B23120B3CDDE6&feature=BF&index=1','http://www.youtube.com/watch?v=Uv-cz5xX4hs&p=526620A5D5589ED3&feature=BF&index=1','http://www.simplynoise.com','http://www.youtube.com/watch?v=F9tmeWQBAjw&feature=&p=AAD3F0174E9F4174&index=0&playnext=1','http://www.youtube.com/watch?v=JkNb-XJtAaU&p=4C7D8B71058C04B1&playnext=1&index=50');
%URL array
 
i=size(t.pl);
activity1.StartFcn=@(x,y)web(t.pl(randi(i(1)),:),'-browser');
%where activity1 is a timer object (more detail later)

Directive combinations

Principally, directive combinations do not form combinations with themselves as directive combinations refer to the “goal” of a period task period with respect to general development. For example, a directive constraint may take the goal of “improving awareness”, “improving ease of performance”, “improving speed with which individual units of the task are carried out”, etc.. Each directive constraint takes up attentive resources so having more than one directive constraint is somewhat akin to simultaneously performing two methods of weightlifting. My directive constraints are related to generalized directions of improvement but the great thing about this sort of system is that it can also serve as a framework for further personalization. What I mean to say is, “direct your constraints however you wish.” :/.

Like environmental constraints, these directive constraints are also tied to the periods of activity and rest and so they are communicated through timer-related functions. Here is a sample directive constraint along with a few environmental constraints.

goals=char('Improve speed','Improve awareness','Improve  focus', 'Improve persistence', 'Improve weaknesses','Improve imagination','Improve intuition');
m=size(goals);
%directive constraint
postures=char('sitting','standing','half-lotus','kneeling');
n=size(postures);
fan=char('medium','high','low','off');
o=size(fan);
lighting=char('fan light','blue light','desk light','none');
p=size(lighting);
%sample environmental constraints
 
msg=(['Start ' subj ' for ' tnum ' minutes.' char(10) 'Goal: to ' strtrim(goals(randi(m(1)),:)) '.' char(10) 'Posture: ' strtrim(postures(randi(n(1)),:)) '.' char(10) 'Fan: ' strtrim(fan(randi(o(1)),:)) '.' char(10) 'Lighting: ' strtrim(lighting(randi(p(1)),:)) '.']);
 
activity1t.StartFcn=@(x,y)disp(msg);

And an example of the possible output:

Start Permudoro Blog for 25 minutes.
Goal: to Improve persistence.
Posture: half-lotus.
Fan: medium.
Lighting: desk light.

Temporal framework and function architecture

Now that we have some sense of the variations possible, we need to describe the temporal framework upon which these variations are applied. The basic version of the Pomodoro framework is to work in periods of 25 minutes. After each 25-minute period, you take a 5-minute break. After the fourth 25-minute period of work in a row, you take a longer break. In order to give a little bit more variation and force the inclusion of a few elements I feel are necessary, I’ve sandwiched the standard Pomodoro between a period of warm-up at the beginning and and cooldown at the end.


Warm-ups, cooldowns and breaks
The section on volumetric combination displayed the nature of the warm-up and the cool-down is similar except it selects from piano pieces in my repertoire and asks me to play through an old piece, learn a few lines of a new piece etc. Additionally, each of my breaks includes a directive to perform a combination of minor tasks related to either object manipulation, light exercise or meditation. There’s no new code here so there shouldn’t be anything to explain. Some sample output:

Cooldown:
1. Learn a bar from Moments Musiceaux 34 4
2. Playthrough Les Jeux Deaux de la Villa Este

Break:
1. 10 Clipper stalls
2. 50 Mills Mess (3-ball)

Function architecture and additional features

Timer objects use anonymous functions (syntax: @(input)functionhandle(args)) and, having been dissuaded from using function array, the only way I’ve come across to have multiple functions called at a particular period of time is to have n number of parallel timer series running at once where n is the maximum number of programmatically alterable constraints + 1. For example, if you only have the musical playlist, then n=2. If you’ve configured an arduino to interface with MATLAB and create lighting effects along with the musical playlist then n=3. The +1 is to indicate textually communicated directives because they can all be put into a single return string.

This means that a helpful subfunction would be one that creates parallel series of timers. Well, nothing to show here since I just brute-forced a parallel series as n only equals 2 for me.

Alarm
Of course you will want to create an alarm sound to notify you when each period has concluded. Conveniently, matlab offers some built-in audio data (I chose ‘handel’) which you can tie into your timer’s TimerFcn like so:

load handel;
t.y=audioplayer(y, Fs);
activity1.TimerFcn='play(t.y)'

The only downside to this is that I try to keep my speaker level low so now everywhere I go, any kind of lowish decibel melody sounds like “Hallelujah”.

Tracking Permudoro progression
Another desirable feature is the ability to track where you are in the Permudoro progression. One way is to make MATLAB’s tic function start with the Permudoro and save an anonymous function which you’ve configured to relay descriptive information from the accompanying toc. Here’s an example:

t.tic=tic;
t.toc=@(x,y)disp(['Pomodoro no.' num2str(ceil((toc(t.tic)-900)/1800)) ': '  num2str((1800-rem((toc(t.tic)-900),1800))/60) 'minutes remaining.']);

Such that calling feval(t.toc) from the command line gives something of the form:

>>feval(t.toc)
Pomodoro no.2: 15.4237minutes remaining.

Conclusion

Well that’s it for the explanation. Here’s some sample output generated over the course of one permudoro period.

>> t=Permudoro('Orgo Test','Orgo Practice','Orgo MCAT','Permudoro Blog');
Start Warm-up for 15 minutes.
Warm-up:
1. 9 OHS.
2. 9 OHS.
3. 40 tuck jumps.
4. 20 pushups.

Start Orgo Test for 25 minutes.
Goal: to Improve intuition.
Posture: sitting.
Fan: medium.
Lighting: fan light.

Start Break for 5 minutes.
Break:
1. 10 Clipper stalls
2. 50 Mills Mess (3-ball)

Start Orgo Practice for 25 minutes.
Goal: to Improve speed.
Posture: standing.
Fan: off.
Lighting: none.

Start Break for 5 minutes.
Break:
1. 40 Windmills (each side)
2. 20 Toe stalls

Start Orgo MCAT for 25 minutes.
Goal: to Improve awareness.
Posture: sitting.
Fan: medium.
Lighting: desk light.

Start Break for 5 minutes.
Break:
1. 20 Jumping jacks
2. 90 Cascade (30-ball)

Start Permudoro Blog for 25 minutes.
Goal: to Improve persistence.
Posture: half-lotus.
Fan: medium.
Lighting: desk light.

Cooldown:
1. Learn a bar from Ondine
2. Playthrough Dante Sonata

Pomodorover