Saturday, September 30, 2017

How Computability Could Help Understand Procrastination

The weather has been fine this summer for any sane-minded person to sit at home writing blogs, but today it's clear that summer has come to an end. I brewed myself a cup of coffee this morning to sulk at the rainy mist outside of my window while reading an article about how Apple is bad at design since 2013, which sent me spiral-minded to reminisce an anecdote about a boss asking me to do something to which I said is technically infeasible, and he bemoaned "you scare me when you say that." It reminded me of the introduction in Computers and Intractability book by Garey and Johnson where this poor chap has to defend himself to his boss why he can't find a tractable algorithm for a problem.

In computer science, an algorithm is intractable when even a modestly sized problem, say a problem that involves analyzing only hundreds of items, would take all the computing power in the universe until the end of time and still won't find an answer. More formally, such algorithm is said to take an exponential time to compute. If you multiply 2 times 2 times 2 and so on for just 90 times, you reach a figure \(2^{90} \approx 10^{27} \) that is bigger than the age of the universe in nanoseconds (roughly in terms of one computing cycle of a computer), and keep multiplying for 300 times, you reach a figure \(2^{300} \approx 10^{90} \) that is bigger than the number of atoms in the universe. So a problem size of 400 would not be solvable even if all the atoms in the universe were to compute until the end of time.

Several strategies were illustrated in the book what this poor chap might say to his boss.
  • He could say "I can't find an efficient algorithm. I guess I'm just too dumb." The boss is unimpressed.
  • He could also say "I can't find an efficient algorithm because no such algorithm is possible." But it is hard to justify why the algorithm is impossible to the still unimpressed boss.
  • Finally, the chap would say "I can't find an efficient algorithm, but neither can all these famous people." Sadly, the boss is still unimpressed.
I think the reason for the boss to be unimpressed throughout is that the cartoonist copied the same drawing of the boss from the previous cartoons, but he's perhaps doing it to make a point. You can't impress a boss if he doesn't get what he wants.

Or the chap could say to his boss, well I know there is an efficient algorithm that will give you a figure that is generally good enough but will be off by a factor of 2 in the worst case. Would you take it? This is known in computer science as an approximation algorithm.

It's not hard for common folks to understand that there are intractable problems in life, and you just have to make do with something that is good enough. You can be a perfectionist, but finding the optimal solution to a problem will keep you busily procrastinating until the end of the universe. To counter this tendency, Steve Jobs famously said "real artists ship!"

One could argue whether Apple's design ills since his passing is due to procrastination, or perhaps they took the anti-procrastination to an extreme and shipped a premature product, but it's clear that Steve Jobs and Tim Cook would take different approaches. Whereas Tim Cook would be unimpressed when his designers tell him the problems are intractable, Steve Jobs would understand what can be reasonably accomplished within a given time frame and plan accordingly.

When solving an intractable problem, one has to plan ahead: it's better to take the complete output of an approximation algorithm than to interrupt an optimal but intractable algorithm and use the incomplete output.

Friday, September 15, 2017

How to restart emulationstation on RetroPie over SSH

tl;dr: over ssh, run:
sudo systemctl restart autologin@tty1.service
You are probably looking for how to restart emulationstation on RetroPie, after running killall emulationstation in the first place. And you probably did everything over ssh so far.

After booting up, RetroPie starts emulationstation automatically using systemd autologin as the "pi" user, on the console terminal /dev/tty1. If you use a physical keyboard, you can switch to this console by pressing Alt-2, whereas the boot messages are in Alt-1.

The autologin actually starts a regular bash login shell, which runs /etc/profile, which bootstraps /etc/profile.d/ In that latter script, it checks the terminal is /dev/tty1, and only starts emulationstation if the terminal matches. If you quit emulation station from the console, it will drop back to the bash login shell, and if you exit from the bash shell, the autologin sequence starts over and runs emulationstation again. Note that the autologin sequence is not managed by systemd-logind, so it will not show when running the loginctl command.

Every time you login to ssh, the same /etc/profile.d/ script runs, but since the terminal is not /dev/tty1, the script does nothing.

Now I wish to air some grievances. When googling how to do this (I figured someone must have figured this out before I did), I came across some misguided but well-intentioned answers (e.g. RetroPie forum, Reddit), but nothing is as egregious as this one in the Raspberry Pi forum. This poor chap asked a question, received some unhelpful responses from the moderator, and understandably became frustrated. Now this power-tripping moderator Jessie went all indignant, banned the user, locked the topic, and proclaimed "let other users take note here."

Even though I have nothing to do with that conversation, reading the thread made my blood boil. This Jessie character is exactly the repellant that Raspberry Pi needs to alienate more of its users. I am not impressed. I would not be surprised if there are other incidents of abuse by this moderator, and would recommend that he steps down if he had not done so already.

Sunday, April 16, 2017

Prediction of the world in 2075

It's one thing for Steve Wozniak to be asked off-guard about his predictions of the world in 2075, during an interview where he was supposed to promote the Silicon Valley Comic Con. I suppose it's not totally far-fetched since some comic books have a futuristic setting. Nonetheless, it's fun for a layperson to wonder about these things.

Predictions grounded on truth tend to be accurate though it may be a question of sooner or later. I think many of Woz's predictions are truth-grounded. Some of my predictions differ because I may have a different perspective of truth. Or because I just have more time to think about them as supposed to answering interview questions on the spot.

When asked whether Apple will be around in 2075, Woz affirmed, making the comparison to IBM founded in 1911. He also later clarified that Apple had the cash to do many restarts. My own prediction is that Apple, Google, and Facebook will be around, but they are likely going to become a conventional company like IBM. Once a company is filled by tenured people who have found their place in the hierarchy, they tend to resist change. The only way to prevent it is to force all employees (including the founders) to retire after 10 years, no exception; if you allow any exception, then institutional squatters will figure out a way to game the system. However, I don't imagine anyone would want to work in a company like that.

Also, conventional companies continue to deliver value, so there is nothing wrong with being conventional. The only folks complaining are the Wall Street investors who reap profit from the disruption but shoulder none of the responsibilities.

Reinventing a conventional company requires incremental steps. There will be disruptions, but the leaders will have to figure out a transition plan to minimize the effects of disruption. It's like refactoring code, then rolling out the software update across many data centers. Tech companies are probably more adapt at treating their people with finesse because they already do that with machines.

Woz predicted that machine intelligence will become ubiquitous in governing everyday lives. I think it is not going to be feasible due to liability issues. Machines already fail a lot. Conventional algorithm failure modes are theoretically predictable even though people don't always anticipate them. Machine intelligence glitches, however, are utterly unpredictable (e.g. there is an odd strategy for beating machine playing Super Mario Smash Bros). It is challenging to figure out exactly what is going on in a neural network, though some introspection techniques are possible through synthesis.

My prediction is that we will end up using machine learning to help us improve conventional algorithms. We will continue to develop introspection techniques into machine learning in order to help us understand how it works, and then put this understanding into developing conventional algorithms instead. I had written previously about how AlphaGo may inspire a new class of Go algorithm based on divide and conquer.

About Mars colony, Woz predicted that Earth will be zoned for residential use and Mars for heavy industry. This is probably inevitable. However, because shipping from Mars to Earth takes 150-300 days, my prediction is that it will be further limited to manufacturing goods that are: (1) inherently toxic to make, (2) do not become obsolete in several years (e.g. no iPhones), and (3) made by companies that can afford a long product cycle where initial investment and profit may be separated by several years. At the moment, it seems like making nuclear reactor fuel on Mars is the only feasible application.

Do you like my predictions? Leave your predictions in the comment below.