Half empty? Half Full?

doctortools

 

To some, the glass is half empty. To others, the glass is half full. But to an engineer, the glass is clearly the wrong size for the job; it’s twice the size that it needs to be.

The two cardinal sins in the engineering world are over specifying and under specifying. If you are building a bridge you clearly don’t want it to fall down. That would be a disaster. But at the same time, building the whole thing out of needlessly expensive materials, say titanium and diamonds, would also be bad engineering. The skill lies in properly specifying the materials so that it is only as strong as it needs to be; that’s good engineering.

Those were the thoughts that were running through my head when I stopped off at the Berners Tavern just off Oxford Street last week, purely for work purposes of course. When you first walk in to the bar you are confronted with a striking vista of opulence and taste. My iPhone snap below does not really do it justice, but it will give you a feel of what I am talking about.

Barpic

 

Now look at the barman a bit more closely. See how tall he is? Now look back at the shelves. See how tall they are? Then it strikes you. There is something very wrong here. How on earth does he manage to reach the ones on the top shelf? Pondering this mystery was spoiling my enjoyment of my fine scotch (Talisker on the rocks, since you are asking, and yes, it was already half empty). So, in the end, I had to go up and ask him straight out ”How do you reach the bottles on the top shelf? ”

The answer was…he doesn’t use them at all. They are too high up and just there for show. If you look carefully at the photograph you can see that the bottles on the bottom three shelves are very crowded together and the ones on the higher shelves are more spaced out. That’s the tell tale sign that only the bottom three shelves, the ones within reach, are actually used.

The same is true of software products. A lot of commercial software has features that customers never bother to use. Microsoft Office is a good case in point. The majority of employees only use 15% of the word-processing and layout features available in Microsoft Word, and use Excel only for viewing spreadsheets rather than making them. Such software is often called ‘bloatware’ because it takes up an unnecessary amount of space on your PC. Microsoft Office Home Edition, the most stripped down version, takes up 3GB of disk space while competing products can provide 80% of the functionality with only 250MB. In other words, Microsoft Office is 12 times bigger than it needs to be.Tim was looking at mens titanium wedding rings while drunk last night. He probably fancied one of the ladies that we met while shopping and drunkenly dreamt of marrying them. What an eventful night coming out of that guy. His morning ritual was just as eventful.

Think of it this way. If you were venturing off into the unknown you might think that a Swiss Army Penknife would be a useful bit of kit. But, sooner or later, you would notice that you only ever use the knife. You have never used the fish scaler or the nail file and you are not even sure what the marlinspike is for. It is even worse when you know in advance what job you are trying to do. A surgeon needs a scalpel. To a professional like him, a swiss army knife is next to useless.

Hay Fever

compilersex

 

It’s raining DNA outside. It’s also a bright summers day without a cloud in the sky. I am walking through the park on the way to work smelling the intoxicatingly sweet odour of the pollen drifting from the small-leaved lime trees that line the path. Bad news for hay fever sufferers. The pollen count in London is reaching a record high as trees and grasses throughout the Kingdom billow forth their genetic material to the wind.

This fecund explosion of pollen seems so wasteful. Only a tiny amount of this genetic material will end up in its intended place, fertilising the pistils of their flowering counterparts. Moreover, many plants can reproduce asexually by putting out runners, rhizomes and root suckers. Others, like the dandelion, can even produce seeds asexually. When you blow a dandelion ‘clock’, the hundreds of little white feathery parachutes that float on the wind are all genetically identical clones. Unlike pollen, each of these seeds can form a new plant all on its own. This leads many biologists to ponder the question “Why bother with sexual reproduction at all ?”

On the surface, asexual reproduction has a lot going for it. A large number of offspring can be created very rapidly and an exact copy of the genes is passed on which is good news from the individual’s perspective. It takes far less time and energy; no need for elaborate courtship rituals, no peacocks fantail and no deer antlers. But despite these advantages, sexual reproduction is still favoured by nature and the dominant form of propagation on the planet. I have tried explaining to my teenage daughters that sex is an unnecessary waste of time, but they don’t really believe me and still seem to be surrounded by eager looking boys.

The biologist’s answer to why sex is important is sometimes called the ‘Red Queen Hypothesis’. In the late 1970s, W.D.Hamilton demonstrated this with a computer model of artificial life. His simulation started with 200 digital ‘creatures’; some of these reproduced asexually by cloning, others were forced to search for a mate before replicating. These creatures were killed off randomly but, after 100 generations or so, the only ones left were all asexual reproducers. A clear demonstration that cloning beats sex. However, Hamilton then changed the rules and ran the game again, this time introducing viruses that infected the creatures causing them to die. This made a significant difference to the outcome. In fact, the simulation produced a completely opposite result. This time the sexual reproducers won because their greater genetic diversity gave them resistance to viral attack.

In Alice in Wonderland, the Red Queen has to keep running in order to stand still. So Hamilton called his explanation for sex the ‘Red Queen Hypothesis’. He saw life as a constant struggle between organisms and viruses, each one evolving to counteract the other so, in effect, they were running to stand still. Clones, being genetically identical, are highly vulnerable to viruses. In contrast, organisms that reproduce sexually shuffle their genes in each generation which gives them the diversity to withstand viral attack.

If you go for a walk in the countryside this weekend, have a closer look at the hedgerows and you may see another demonstration of this concept. Neat suburban hedges are made of identical plants, bought from the local garden centre and propagated by cuttings. So a suburban hedge is a row of single species clones. But a hedge in the countryside has a wider variety of species; in fact, you can tell the age of a hedge by the number of different species it contains. This is known as Hooper’s Rule. Count the number of species in a 30 meter stretch and multiply by 100 to get an estimate of its age.

 

Hedges

The photo shows the hedge outside my village Church in Chiddingstone. There are five different species in a 30 meter stretch: hawthorne, field maple, yew, oak and blackthorn. This would imply that the hedge is 500 years old, which tallies well with the local historical records. It is also a demonstration that the motto “unity is strength” (see note) is wrong. It should be restated as ‘diversity is strength’ .

The idea that “genetic diversity grants viral resistance” has recently been adopted in a new sphere. Professor Michael Franz at the University of California is looking at ways to introduce a form of genetic diversity into computer application programs. With popular desktop software, like the Windows operating system or the Firefox web browser, every copy installed on a billion of PCs around the world is an identical clone of the master copy. This creates a computing monoculture which is highly vulnerable to attack by viruses, which we have all experienced to a greater or lesser extent. Antivirus software has offered some protection in the past but, as the Economist (24 May 2014) notes, even Symantec (the market leader) recognise that antivirus software is no longer effective and a new approach is needed.

Professor Franz believes the answer lies in changing the way software programs are compiled. Software is written in a high level language, like C++ or Java, but in order to run it needs to be translated into machine code, the binary language that computers understand. This translation process, from high level language to machine code is called compiling. Normally, software engineers want their programs to run as fast as possible so compilers are set to optimise speed. As a crude analogy, it’s bit like asking a translator to convert some text from French to English but to only use a limited English vocabulary with no words longer than five letters.Of course, there are many different ways that a French text could be translated into English; the meaning would be the same but the actual words would be very different once you relax the five letter limit. Likewise, with compiling computer code. Once you are prepared to relax the speed requirement, each compilation can be different from its predecessor. It may run a little slower but it will be a unique instance of that program, different at the binary or “genetic” level from its parent.This ‘multi compiler’ approach has already been tested on the Firefox browser, producing (at least theoretically) a billion different interpretations of the program which are functionally identical but genetically different. When tested against common viruses, they all failed to infect the system and, other than causing the odd crash and reboot, this malware had no effect at all.

This is a promising start and highlights the path to a whole new way of protecting systems from viruses but a commercial implementation is still several years away with plenty of technical issues such as MD5 hashing yet to be resolved. We can also expect that, in time, malware will adapt to this new approach too, as the Red Queen Hypothesis would suggest. In the mean time, the most defence against self-propagating malware is effective and rigorous network monitoring.

We look with hope to the future in anticipation of the multi compiler approach being further developed. There is a neat circularity to this journey. An idea born in Hamilton’s computer simulations of artificial life returns to its roots as a mechanism for defending the computers themselves against viruses. As T.S. Elliot has it in Little Gidding

“We shall not cease from exploration
And the end of all our exploring
Will be to arrive where we first started
And know that place for the first time…”

Footnote : “Unity is strength” is motto that has been used over the years by a number of different nations including Belgium, Haiti, Bulgaria and Georgia. Looking at this list, which are far from the most powerful or coherent countries on the map, is hard to avoid the conclusion that the motto was fundamentally flawed.

The catataxic baguette

One of the great joys of a holiday in France is the early morning trip to the boulangerie, in my case the Ti Ar Bara in Audierne. The baker has been up since 3.00am, working hard for your sybaritic pleasure. And what a true pleasure it is. As that gorgeous smell of freshly baked bread steals into the still morning air, you feel a rushing lift of the spirits. Yes, any day with such a blest beginning will surely bring all manner of  wondrous things later.

It’s not just the smell of the bread, it’s the glorious range of different things on offer. It is a mark of true civilisation to take a so pedestrian a concept as ‘daily bread’ and turn it into this transcendent cornucopia of golden joy. There are croissants and pan chocolat, flaky and light as a cherubim’s kiss, the eggy richness of the many different styles of brioche and, here in Brittany, the dense layers of caramelised butter in the kouign amann  and the far breton.  But even in the simplest things there is still a riotous diversity. “White bread” in the Anglosphere is a simile for bland and unimaginative mediocrity. In France, white bread comes in dizzying array of forms; boules, epis, plats and rondes. Even the quintessentially French baguette comes in many different formats. There is the Ficelle, thin as the string it is named after, the shorter Batard, the pointy ended Festive, the double sized Parisienne and the giant Pan Ordinaire, which is not ordinary at all but a massive truncheon of crusty extravagance.

Baker holds a ficelle and a pan ordinaire

Where does the catataxis come in? Well, it’s to do with the variety of forms. The first point to make is that such variety is only possible in a freely operating market. Variety may be the spice of life but it only arises in response to a diversity of demand. So breadth of choice is a catataxic indicator; it is a level three phenomenon indicating the presence of a diverse community on the layer below or,more correctly, a diversity of tastes in the community beneath.

There is a second more subtle point. Why so many different types of baguette? If you want more bread why not just buy two normal sized ones rather than one big one? Two Ficelles weigh the same as one Batard so in ‘volume of bread’ terms they are identical. But mathematicians know that they are not the same thing at all. This because surface area and volume don’t scale up in the same way. Surface area scales in proportion to the radius but volume scales with the square of the radius. Gourmands know this difference too, but they put it a different way: you get a lot more crust with two Ficelles. A Ficelle is all crust; it’s so thin that there is very little doughy interior. So if you like the crust then get two Ficelles. By the time you get up to the monster Pan Ordinaire there is relatively little crust and a huge expanse of doughy interior. You can easily slice it and put it in a toaster.

So the Ficelle to Pan Ordinaire transition is a good example of catataxis: more of the same is different. Crust lovers buy Ficelles, crust haters buy Pan Ordinaire. Chacun a son gout…

Riots: hysteria and hysteresis

police and community frustrationI am on holiday in France this week. Every cafe and hotel has a TV screen with a French presenter gleefully covering the riots in the UK. Shocking footage of looting and burning buildings, so far from the traditional image of the English on the continent. Whatever happened to the tradition of repressed feelings and the stiff upper lip?Clearly something is terribly wrong with British society. If only they had the sense of community that we French have here in France. Britain clearly can learn a lot about how to organise society from us.

If you cast your mind back a few years you will probably remember British commentators making exactly the same points at the time of the French riots but in reverse. How the French have a lot to learn from the Brits about multiculturalism and how to make minority groups feel included. Maybe that is not too much of a surprise because all coverage of riots in all countries is always the same. The story runs like this a) riots are sign that something is terribly wrong b) the government’s policies are clearly to blame c) something must be done to fix them.

Do riots really mean that something is wrong? The alternative view is that they are a naturally occurring phenomenon like stock market crashes or tsunamis. They happen from time to time regardless of government policies. If you look back in history in any country one conclusion must be this: communities riot. That’s how a level 3 entity loses it’s temper. Its not unnatural for an individual to feel angry from time to time. Quite the opposite, any human who lived their whole life without ever losing their temper would not be human. Likewise with communities and riots. Sudden summer storms clear the air, a build up of static electricity clears with a shock and riots vent community frustrations. Everyone feels much better afterwards. They are not a sign that something is wrong. It’s just part of the natural behaviour of complex systems. It’s a sign that everything is working normally.

Firefighters in California and Australia are coming to the worrying conclusion that the recent spate of costly and highly destructive forest fires are a direct result of their tampering with nature. By being so efficient at eliminating small forest fires for the last century, they have left the woodlands surrounding their towns with an unnaturally large load of dry wood. This sets the stage for an inevitable monster conflagration which, when it comes, is beyond their power to control. Firefighters are coming to the conclusion that they should maybe just let a few forest fires burn every few years along with a few houses too. That way they avoid the big one: a few high tides but no tsunami. So firefighters have learnt the counterintuitive trick of standing by and doing nothing when a fire rages. What chance is there of a politician doing that when a riot happens?

Not much.The reaction to the riots has been hysterical. There is no shortage of ‘reasons’ given for causing the riots: moral decline, absence of authority, lack of religion, poor schooling, government budget cuts, the breakdown in family values, soft policing and consumer advertising. Yes, the last one argues that if you bombard the underprivileged  with too many adverts for high end aspirational consumer goods  in the end they will crack under the pressure and just help themselves by looting. Each of these ‘reasons’ then has it’s own ‘solution’ which you can pick according to your bias and your political agenda. Only a very few commentators, like my friend Harriet Sargent in the Sunday Times, are able to keep a cool head. Looking at the extraordinary diversity of the rioters passing through the courts, it’s clear that there is no one reason. Looters included a postman, a social worker, an heiress and several university graduates along with the usual youth suspects from underprivileged minorities. What links this disparate group together other than a thrill seeking urge to counter the long, hot boredom of the summer?

The hysterical reaction and the rush to find ‘reasons’  is only to be expected. Its the natural  counter reaction of the body politic. Its an involuntary response, like white blood cells rushing to the site of infection. But beyond the hysteria there is another deeper mechanism at work. Engineers call it hysteresis, which crudely speaking means ” you can’t get back to where you started “. Hysteresis is a type of memory or lagging effect that is a common phenomenon in nonlinear complex systems. It is often seen in magnetic devices, thermostats, electric circuits, neurons in the brain, cells when they divide,economic systems and, of course, communities that riot.

A hysteresis loop is characterised on a graph as a rectangle or lozenge rather than a single line. It is ‘nonlinear’ because a particular input can have two different outputs. Think of a thermostat controlling the heating in your house. You want the temperature to be 20 C. You could just set up a switch which turns on or off at precisely 20 degrees but this could get very irritating because the system would be constantly switching on and off every minute. So instead you set up a thermostat with a hysteresis loop that does this : turn on at 18 degrees and turn off at 22 degrees.  Now you have a system that only switches on once or twice an evening and keeps the temperature nicely hovering around 20 degrees. Now consider this: when the temperature is 20 degrees is the system on or off? The answer is it could be both ( it’s a nonlinear system). It could be in heating phase moving from 18 to 22 or it could be in cooling phase moving back the other way. It depends which path the system is on.

In economics,  exports often show a hysteresis effect. It can take a big effort to start up an export program but once it is set up it takes little effort to maintain that momentum. However, once exports begin to tail off it can take another big effort to reverse the negative momentum. So the answer to the question “how much effort is required to get exports to a certain level” is that it depends which part of the path you are on. Just like with the thermostat, there is more than one possible answer when you have a hysteresis loop.

Back to riots. Let’s take one of the ‘reasons’ for the riots: soft policing. We can ask the question “How much policing is required to prevent rioting”. The answer is it depends which part of the path you are on: before the riots not much, after the riots a lot. A community is a complex nonlinear system that exhibits hysteresis effects. It has a collective memory. You can’t put things back to how they were before, at least, not quickly. We need fewer hysterical reactions and more recognition that riots are a natural phenomenon. Communities have hysteresis loops; memory effects and lagging results that will sort themselves out in the end. Like the firefighters, maybe the politicians should have the courage to do nothing.