Wednesday, December 14, 2011

Room-Bore-Rhythm - Roomba's traversal algorithm


We have had Miss Roomba as our cleaner for over 2 years now, and she has played an important role in my life. Her availability and ability has been partly responsible for my obesity. I have been obsessed with trying to understand her algorithm for floor coverage and have spent hours on the couch fascinatingly watching her in action. I am enamored and at the same time intrigued by this sexy little cleaner.

As far as getting the job done is concerned, she is very adept and efficient. If you wanted a number to quantify her performance, I would say she is about 95% efficient. To put that number in perspective, a human being with good eyes using an average vacuum cleaner is about 90% efficient, which is same as a human being with OCD and bad eyes. An human being with OCD and good eyes is about 80% efficient, because at some point they forget all about the actual purpose of the exercise and become obsessed with organizing the collected dirt in a desired pattern. In short, Miss Roomba is an efficient cleaning machine.

Most vacuum cleaners have to be grabbed by the neck and subjugated into cleaning a room, which they then proceed to do with great reluctance and greater noise. Miss Roomba operates unassisted once a few appropriate buttons on her head have been pressed correctly. You can also give her a cleaning routine for the week and she will remember that and execute it correctly unless there is a bug in her clock which makes her go faster or slower than the rest of the world. In one sentence, Ms Roomba is awesome. She is the best gift you can give to a lazy person who wants his room clean.

But lets consider a different metric - area covered in sq. ft/time taken in seconds. By this criteria, the Roomba will qualify as arguably the slowest vacuum cleaner ever made, even if one were to include the earliest model built by the cavemen in Peru - body made from the skin of a bear wrapped around the rib-cage of a goat, the bag made from the stomach of a pig and the handle from the tusk of an elephant, and operated by wind-power.

Here is the simplified version of Roomba's floor traversal algorithm (with edge cases, error handling and boundary conditions left out for brevity):
1. Select a random integer between 1 and 10 (let's call it x).
2. Select a random integer between 0 and 155 (let's call it y).
3. Select a random integer between 30 and 60 (let's call it t).
3. Turn around y degrees clockwise and travel x feet.
    3.1 If the path being traversed has dirt, clean it.
    3.2 If you encounter obstacles or bump into walls, stop and go to Step 1.
4. If the time elapsed is greater than t minutes, stop and declare success, else go to Step 1.

The closest analogy to Roomba's path traversal is how my one year old baby girl walks. She just gets up and goes, in an assumed angle for an assumed distance, bumping into every obstacle in her way, and bouncing off of every wall she encounters. When she does that, she falls down, stares at me to see my reaction. If my face registers shock or fear or concern, she starts bawling her eyes out. If not, she gets up, picks two more random numbers and off she goes again.

Now that Neato has finally designed a Robotic vacuum cleaner with a laser guidance system which makes a map of the room before it starts cleaning, iRobot might have to try and upgrade Roomba's algorithm to at least match the walking patterns of my four year old boy. I think just doing that will decrease the time taken by the Roomba to traverse a room by a factor of 10.

But if that happens, the novelty and charm of watching Miss Roomba in all her fumbling, bumbling glory will be lost.

Thursday, October 27, 2011

Are you fat?

So you thought that if an Android app did not exist for a problem, then that problem is either a) not a problem at all; or b) does not deserve a solution. Well, that's not true. I will give you an example (although there might be an Android app to solve this problem, in which case just pretend that there isn't. I am a dinosaur, I still use a Blackberry, so I wouldn't know if such an Android app existed.)

Problem: Fellow males of the human species (and females who like to wear apparel traditionally designed for men), when and how do you know that you are fat?

Explanation: I have talked to women weighing 95 pounds who would suddenly go on an oatmeal-only diet because they thought they were gaining weight. I also know skinny women who suddenly start starving before the imminent advent of summer because they have to get into their bikinis and look good. But that is not what I mean. I mean F.A.T, like you look like a huge lump of shapeless flesh and adipose tissue that has suddenly sprouted human features.

Solution: There will be several answers at this point, involving one or more of the following:
a) machinery and gadgets, e.g., bathroom scales, sophisticated weighing machines that can measure fat content;
b) smart-phone apps and numerous  metrics, e.g., BMI, weight-to-height ratio, body structure;
c) plethora of subjective data points, e.g., broken furniture, creaking beds, tying shoelaces, ruptured or tight apparel;
d) imbibed behavioral jargon, e.g., lack of mobility, lack of alacrity,
etc.

While none of them would necessarily be incorrect, none of them are the most accurate, or the simplest. Clothes can shrink, apps and machines can be faulty, and subjective data is exactly that - subjective. The most accurate assessment of the direction in which your girth is going is provided by the insignificant little thing you wear around your waist - your belt. If you are shifting between holes on your belt in a counter-clockwise direction, and the angle of the buckle from the ground is beginning to reduce from the desired right-angle, then you know for sure that you are fattening up. This is an indicator that cannot go wrong; it is fault-proof. And it is not an Android app.

If you don't agree, you can ask Siri - she can tell you anything once she understands what you are saying to her. Now that Paul is dead. Unless Paul has been reincarnated as an Android app.

Saturday, July 16, 2011

Bid Adieu While Protecting Your BEEP


One of our 'superstar' developers is leaving the company to seek an alternative career. Yesterday the bosses of his project had arranged a farewell company-sponsored lunch and I was one of the invitees in lieu of being associated with the same project. One of the requirements for this lunch gathering was that everyone had to say something nice or funny about the beneficiary of this farewell.
Now, speaking about a co-worker at his farewell lunch gathering is tricky as well as risky. There are several implicit restrictions.
First, the person is alive and kicking as opposed to being in a blue box covered with floral wreaths. So you have to be chronologically and factually accurate in your statements.
Secondly, you have to be subtle - both with your praise so that you don't embarrass him, and also with your criticism so that you don't end up with a broken nose. So you cannot go down on your knees and say something like, 'Jacob, you are the God of coding and the most adorable human being I have ever met and I love you.' Also, you cannot stick up a particular finger of your right hand and scream, 'Jacob, you are a BEEP BEEP, a thick-BEEPed and BEEP BEEP-BEEPer and I am here only for the food.
Thirdly, you are usually in mixed company - subordinates, peers and superiors. So you have to ascertain that what you say in this gathering does not change your professional and personal dynamics with the rest of the group in a detrimental way. So you cannot say things like 'Jacob, if you had not pointed out that I am a lazy, mediocre and unprofessional employee, I would never have realized that my pretending skills suck. I am working harder on that.'
So after a lot of mental data-mining on the 'Jacob data' in my head, and strict application of the above-mentioned suppression rules, I was ready. But, at the last moment, just as I about to leave, one of my best friends (emergency production issue) showed up and kept me behind.
Regardless, here are a few tips for software developers that can be used while eulogizing a colleague at a farewell lunch. I have accounted for some boundary conditions to prevent the speaker from making a BEEP of himself. I am making the assumption that you do have something to say. You are not there just for free food.
1.       If you don't like him, don't attend.
2.       If you 'more than' just like him, don't attend.
3.       Be brief, concise and factual when you speak.
4.       Partially reveal an inter-personal incident involving this colleague that was beneficial to you. Just reveal enough details so that the group understands your gratitude to the colleague. Don’t narrate the whole story.
5.       Try to deliver the meat in three sentences:
a.       One about some lighter moments that your colleague may have facilitated.
b.      One about your interactions in a professional capacity that stand out in your mind.
c.       One about point 4 (or replace it with a sentence of praise for his professional skills).
6.       Try to end with a final sentence which says good-bye and wishes him luck. A simple and safe example is - 'It has been a pleasure, (slightly tip your head downwards at this pause) and (pause) good luck’ (throw your hands in a resigned manner to demonstrate a tinge of sadness and slowly sit down). If this colleague speaks a different first-language or is going away to a non-English speaking country, use your favorite language translation method to say good luck in that language. Rehearse it before you speak.
7.       Try to make this speech appear to be an impromptu one (take random pauses, say ‘hmmm’ or ‘aaaa’ a few times) but definitely go prepared.

Friday, February 11, 2011

Do men grow up (no pun intended)? Part I - the catch-222

A recent Bollywood movie is titled 'Dil Toh Baccha Hai Ji', which literally translates to 'Heart is a kid, Sir!' and which implies - ‘Heart is a child at heart'. In order to ensure that women don't take umbrage with this title, because apparently their heart is all grown-up, the makers have added a tagline, 'Love grows, men don't!!!’ Not growing up is the most common accusation that has ever been thrown at man, albeit mostly by women. In today's advanced day and age, some men have also been known to hurl this accusation at other men, but that's all right. There is nothing wrong with that.

Personally, I am yet to meet a man (myself included, the males on the accusing party mentioned above excluded) who has not been accused of being an imbecile at least once. We get it from all corners - from frustrated mothers, from frantic girlfriends, from fuming ex-girlfriends, from furious wives, from flame-erupting ex-wives. In fact, this accusation has been thrown at man so frequently and with such consistency that man has almost accepted it to be true. If you walk on the streets and stop 100 random men and ask them 'Do men grow up?', 57 of them will ignore you and walk away faster (a clear case of hedging an issue because in your heart of hearts you know it to be true), 23 will either deny it with extreme vehemence (because they are convinced that this actually is true) or shrug and smile (either because they are partially convinced or they are really just dumb), 10 will say they don't care (because they don't), and 9 will agree with you. 1 will turn out to be a woman in disguise.

And this accusation is not a contemporary accusation that has been created by women's lib and the rise of feminism. This one has existed since Adam. I am sure that from Adam to Jesus to King Arthur to Lincoln to Churchill to Hitler to Gandhi to Clinton - each one of them has been asked this question - Why don't you grow up? (We will ignore Adam and Clinton for this debate because Eve's accusation had nothing to do with Adam's lack of emotional, psychological or mental growth, as was the case with most of Clinton's accusers). However, the response to this accusation has changed over time, from total denial to angry protest to subdued protest to almost complete acceptance. King Arthur pulled out his sword and beheaded his accuser, so enraged was he. Michelangelo did not understand at all that the accusation was not anatomical and went on a 'carving male nudes out of stone' spree. Leonardo da Vinci decided that becoming ambidextrous and writing left-to-right on a paper with his left hand would definitely show his accuser who was grown-up. Hitler thought that although this accusation didn't apply to him, it certainly did to a large number of his fellow men. So he did what he did. Gandhi just looked at his accuser with his big sad eyes behind egg-shaped glasses and decided that he will stop wearing clothes as a sign of protest. Lincoln stopped shaving, Churchill decided to go on an eating binge, and Columbus, da Gama, Vespucci and Forrest Gump left home in a huff and tried to run away as far as they could.

But gradually over time, the number of accusers and number of accusations per accuser kept increasing at such an alarming rate that man has finally capitulated and has started agreeing to or at least has stopped disagreeing with the accusation. Some have tried protesting, albeit half-heartedly, by mimicking their favorite historical personality's mode of protest. Mel Gibson tried both Hitler and King Arthur in equal measure, replacing the sword with a gun in the latter case, Arnold Schwarzenegger, Andre Agassi, and Salman Khan tried to go the Gandhi route, but didn't have the conviction or chutzpah of the original act. Another section of men have completely accepted this accusation. As a result, they have given up on trying growing up, since in their minds, it is impossible. At some point in their lives all these men must have had very powerful and convincing women around them. Some members of this club are George W. Bush, Osama Bin Laden, Tiger Woods, Saddam Hussein, Ben Johnson, O.J., Barry Bonds and George Costanza.

And hence we come to the crux of this issue - the situation. Just like love, maturity is a perception and all perceptive movements are based on how the perceiver perceives this movement, which in turn is totally dependent on the perceiver's perceptive prowess. So, the fact is that men grow up, but women don't possess or have lost the perceptive ability required to perceive this growth. This is partly because of the fact that by believing in this accusation down the ages, women have managed to convince themselves that men cannot grow up. Therefore, they turn a blind eye to all symptoms of maturity in men. And in doing so for generations, based on the principle of 'what you don't use, you lose', women have lost their power to perceive growth in men. And we have a catch-222 situation here
- for men to grow, women have to perceive this growth,
- for women to perceive growth, they have to develop the ability to perceive growth,
- for women to develop the ability to perceive growth, men have to grow,
- for men to grow, women have to perceive this growth.
Catch-222 (also known as 2-catch-22 or transitive catch-22) is the most tangled of human situations and has proven to be irresolvable till date.

In Part 2 of this blog, I am going to provide statistical and graphical evidence that will provide an insight into the growth patterns in men, and I will provide growth perception enhancement tips for women. My goal will be to break the transitiveness of this situation, which is the only way to resolve a catch-222 situation.