Monday, 13 February 2017

A piece of operational research (and graph theory) trivia

Graph theory was "born" with Euler's problem of the seven bridges of Königsberg.

Those seven bridges were named: Krämer, Schmiede, Holz, Hohe, Honig, Köttel and Grüne.

Tuesday, 7 February 2017

Improving the Urban Environment

"What would you do if you had a million pounds to spend on improving Exeter for cyclists?"

It was a strange question to be thrown at me in a discussion about recruiting an operational research scientist for a local enterprise.  Out of the blue I had been invited to the offices of a hi-tech company on the business park east of Exeter.  Someone there had read this blog and knew that I was interested in O.R. and lived locally, and that there are not many O.R. specialists in the city - or its environs.  The organisation wants (as of the date of writing) to recruit a modeller for sustainable transport planning, with an ambitious project in mind which would help improve the environment in various ways.  So we were talking about transport models, and the problems of a medieval city with a road system that is little changed over many years.  On top of this historic legacy, Exeter has a catchment area which stretches across a radius of 20-25 miles - and these commuters bring their cars into a city which is close to gridlock.  So obviously, making Exeter even more cycle-friendly is important, but the question came quite suddenly.  I wrote about this topic from a different perspective in this article.

I wondered if it was one of those searching interview questions that are used to see how well a candidate can think "outside the box", rather like those reputedly asked at interviews for Oxbridge colleges, or to work for dotcom giants like Google. 

So how might I spend a million pounds on improvements for cyclists?

My gut reaction was that the arterial roads should be made more cycle-friendly.  I had ridden my bicycle to the meeting, and the route-finder had shown what I already knew, that if I followed cycle-paths and quiet roads, it would be more than 10% longer in time and distance than the arterial road which is more direct.  The downside of going direct was the large number of vehicles, but I accepted that.  For some journeys in Exeter, following cycle-paths and quiet roads can be significantly longer than the direct route; sometimes it is worth it.  However I am not sure how much could be achieved with one million.

The next reaction was to use the money to provide locked cycle storage at the "Park-and-Ride" car parks on the edge of the city.  Buses run from these car parks to the city centre, and one or two major employers, but they are not convenient for everyone.  Hence offering an option for cycling rather than bus-riding.  As an extra for this, one could have bike-hire stands at the car parks; already, Exeter has some bike-hire points with electric bikes (and no doubt I will write about these in the near future).

Tina and I ran the question past each other in the evening, once I had dried out from cycling home through a storm.  Thinking outside the box, our first idea was to use the money to impose a 20mph speed limit across the whole city, which would make travel by bicycle almost as rapid as by car or bus.  We decided that an outright ban on cars would not be feasible, and too low a speed limit would annoy the motorist.

Then we proposed that the city council should send out a £25 voucher to every household in the city, to be redeemed in cycle shops for equipment - and every voucher would also qualify for as many free hi-viz jackets and sets of cycle lamps as the householder had bicycles.  (there are about 40,000 homes in the city).

Our third proposal was to require that every new house or flat should have covered storage for bicycles as a local by-law.  Here, new properties must have either a garage or a dedicated parking space.   The former would offer space for cycles, the latter would not. 

With these three off-the-wall ideas, we started to consider another aspect of the commuters into the city.  In various places in the Exeter catchment area there are ad hoc car-sharing schemes, whereby two or more drivers agree to meet at a convenient place to leave cars for the day and share the remainder of the journey.  Some of the trysting places are the park-and-ride sites which are free to use (you pay for the bus fare), some are lay-bys near road junctions, some are on patches of waste ground.  (In some countries, planners deliberately create such places to park at intersections.)  Bureaucracy has closed one local site, by imposing a two-hour maximum stay on vehicles using a lay-by.  And that is a shame.  However, we realised that several local dormitory towns have out-of-town supermarkets with car parks.  Only customers are allowed to use these spaces, and the shop imposes penalties for those who stay too long.  Some, I suspect, monitor the parking with CCTV as well as patrols.  But, suppose Exeter City Council negotiated with the store to provide a limited number of spaces for park-and-share commuters.  There would be a charge, and users would have a permit to display, but many supermarket car parks are over-designed. 

And all these thoughts stem from that one quick question.  If you are coming to Exeter for an interview about working in O.R. and sustainable transport, this may have spoilt the surprise.  But there will be others, and the bigger question - can you handle the proposed project?

Wednesday, 1 February 2017

Games that Trees Play

I never expected to find the term "Game theory" in a book about trees, but - I was wrong.  Reading Max Adams' "The Wisdom of Trees" I read the following:
Seeds and their germination ... are hailed as an example of so-called game theory, whereby (in its biological context) evolution tests all possibilities to find successful strategies for an optimum number of best-fit species. (page 59)
I'm not happy with "so-called" applied to game theory - users of the subject know what it is, and because of my faith, I would be inclined to apply the mind of God to evolution as well, but the idea is intriguing.  Adams lists six characteristics of the seeds of trees which vary to fill niches in ecology: seed size; quantity of seeds; age of first production; method or means of distribution; how the seed germinates; frequency of seed production.  The OR person spots that four of those are numerical, even if slightly fuzzy. 

The author goes on to discuss some of the varied combinations of those six characteristics which may be observed with different species.  An oak tree produces medium to large seeds, in a quantity which is somewhere between the fine dust of tens of thousands of hazel seeds and the dozens of giant nuts of a coconut palm, and starts to produce when the tree is forty years old or more - while the fruit trees in my garden produce their first crop after four or five years.

The qualitative characteristics are extremely varied.  Seed that is spread by the wind, by birds which bury the nuts and forget (or die), by being buried until there is a fire or a flood.  There are so many possibilities, and so many subtle differences between them.  As a challenge, consider two native trees that you know growing close together, and see how they compete to survive.  (Theey ought to be native, because imported plants may not fit the ecological niche here that they belong to at home.)

Adams goes on to discuss yet another dimension to ecological niches; the variation from year to year in the number of edible seeds produced by trees.  This leads into another topic from OR - predator-prey models.  If a tree species produced the same number of seeds every year, then the population of a bird or animal that fed on those seeds would tend to a stable value by Lotka–Volterra models.  The predator would consume the harvest and there would be very few seeds left to be the potential for the next generation.  So trees do not yield similar crops every year.  In some years there is a bumper harvest for future plants and the predator species, in others, the predator may be starved.  The plum trees in my garden vary in their yield, partly through natural variation from the species, partly through my intervention in pruning, and partly through the random effect of climate at the time of the plum blossom.  And my story could be repeated over countless orchards and plantations of fruit. 

Now, what is the game theory approach to weeding my garden?

Thursday, 29 December 2016

Should historians learn system dynamics?

The magazine Mathematics Today (published by the Institute of Mathematics and its Applications) recently published an article: "Green Transport Planning Paradoxes".  The authors (Stuart Berry, Chris Parkes, University of Derby) used basic ideas of system dynamics to show that mass transport systems grow and expand until a fresh system replaces the first one.  They take as examples from UK history, the development of canals, replaced by railways, replaced by road transport, and - in some places, the introduction of mass transport rapid systems.  However, the theme of the article is that there are spin-off effects on society which are not always 100% desirable.  In particular, although mass transport rapid systems are greener than road transport, they lead to urban sprawl and increased house prices.
To illustrate their arguments, they take some simple feedback loops, such as this:
The loop works like this:
  • Rail demand growth leads to Rail network growth
  • Rail network growth leads to Travel time by rail reduction
  • Travel time by rail reduction leads to Rail demand growth
  • and
  • Rail demand growth leads to Rail network growth
and so on
The same loop applied to the boom in canals in the UK during the late 18th and early 19th centuries, until the railways provided a "better" means of transport.   So the feedback loop for canal, similar to that above, interacts with the feedback loop for rail.
But rail network growth also leads to urban sprawl and the concept of the commuter.  All over the UK there are streets of houses built during the late 19th and early 20th centuries by workers (especially office workers) who found that they could commute by rail from the nearby stations.  Now that some of those stations have closed, those houses (such as those in Okehampton, below) lack the advantages they had a century earlier.
Houses below the former station in Okehampton, near the railway, a long way from the town's main street
The same phenomenon was particularly evident in the spread of the London Underground system in the late 19th century and the first three or four decades of the 20th century. 
This is illustrated by the feedback diagram above; plus signs by an arrow mean that "up leads to up" and "down leads to down", and minus signs mean "up leads to down" and "down leads to up".  So, as rail demand increases, it leads to increased house prices, more rail development, more urban sprawl, more rail passengers, fewer road users and more rail demand. 
When I came across the article, I intended to include mention of it in this blog to ask the question - how does it apply in other nations and societies where transport systems have not followed the same successive phases of development.  In countries where there were no canals, what did the railways displace?  Can one model the growth of domestic air flights in the USA as replacements for inter-city rail travel? 
You don't need a deep knowledge of system dynamics to understand these diagrams.  But their applications are very widespread in human history.  Thanks to my flat-mate as a student, I am a co-author of a research paper in a journal of history (it gives me bragging rights in some academic circles!); he was looking at the growth of coal mining in Cumbria in the 18th century, and there were some statistical questions to be answered.  There the feedback loops were concerned with changing transport and changing technology for mining.
  • Increased demand for coal led to Expansion of the mines
  • Expansion of the mines led to Construction of wagonways to carry the coal to the port
  • Expansion of the mines led to Investment in new technology such as steam pumps
  • Investment in new technology led to (eventually) Reduced prices for coal
  • Construction of wagonways to carry the coal to the port led to Reduced prices for coal
  • and
  • Reduced prices for coal led to Increased demand for coal
More recently, I picked up a book in Exeter Library which - at first sight - seemed to have been shelved in the wrong place.  It was about the history of Roman roads in Britain, and had been shelved with books on warfare.  It transpired that the author's thesis was that the road system in Britain was not created by the Romans, but the Roman occupation was one element in its development.  Roads pre-dated the arrival of the Romans in 43AD, and the system developed to meet the needs of successive rulers, through medieval times to modern days.  The author catalogued numerous battles fought on British soil (hence the library's shelving) and their proximity to the major roads of the country.  With system dynamics in my head, I thought that the book had missed a trick or two by ignoring feedback loops.  Two struck me:
  • Increased unrest in the land leads to Increased military strength by the ruler
  • Increased military strength by the ruler leads to Increase in the road system
  • Increase in the road system leads to More communication of grievances among the populace
  • More communication of grievances among the populace leads to Increased unrest in the land
  • and so on

  • More subdivision of the land into power blocs leads to More strife at the boundaries
  • More strife at the boundaries leads to Reduction in transport between the blocs
  • Reduction in transport between the blocs leads to Deterioration of roads between blocs
  • Deterioration of roads between blocs leads to More subdivision of the land into power blocs
  • and so on 

So, maybe historians should learn system dynamics.

References:  Green Transport Planning Paradoxes by Stuart Berry and Chris Parkes: Mathematics Today, volume 52, no 4, August 2016, pp193-197
The Secret History of the Roman Roads of Britain by M C Bishop (Pen and Sword, 2014, ISBN 978 1 84884 615 9) 
The Land Tax Returns as a Source for Studying the English Economy in the Eighteenth Century by J V Beckett and D K Smith Bulletin of the Institute for Historical Research 54(129):54 - 61

Friday, 23 December 2016

Designing the best tarpaulin for the world

Sometimes there are problems which have conflicting objectives which have few numbers associated with them.  Not all operational research needs numerical data.  There are qualitative aspects to O.R. as well as quantitative ones.  And this is about one such problem.

Tina and I support the medical charity MSF, Medecins sans Frontieres, Doctors without Borders.  A recent issue of their newsletter for supporters included a two page spread by Patrick Oger about designing the perfect humanitarian tarpaulin, or tarp.  You can read the article, with pictures, here.  Another blogger has picked up this story, here.

Tarp is used for many different things in emergency situations; it makes shelters for people and animals and equipment; it makes fences; you can cover food with it to protect it from the sun, wind, rain, snow, chemicals; you can use it as ground cover when you are sharing out supplies.
  • It has to be tough so must have strength in all directions.
  • It has to be waterproof.
  • It has to last a long time in harsh conditions, such as strong sunshine or high, gusty winds or heavy rain.
  • It has to be the right size.
  • It should be easy to repair
  • It should be light enough that large numbers can be carried to the place of need easily and quickly
And ... it has to be cheap.  Relief organisations will use thousands of tarps every month.  A tarp that is tough, not heavy, waterproof, and long-lasting, but which costs a fortune to make will not be acceptable.

Patrick Oger was responsible for finding the best tarp at the best price.  He looked for the faults in the tarps which were on the marketplace.  As an engineer, he repeatedly asked the question, "Why?"  Why is this material unsatisfactory?  Why is material A better than material B?  And he asked the question that marks out operational research work - "What happens if ...?" Having found the base material, which used black fibres, he found that the question "What happens if we make the tarp black?" would be answered by "It will be too hot for human shelter".  So he knew that it couldn't be left as a black product.  So he experimented with a coloured coating, to find the optimal colour.

Inevitably, there were some questions which were answered with numerical measurements.  But the psychology was important too, as it is for operational research to gain acceptance by the client; would the relief agencies use something new?  Would the people they served use the tarp?  If so, why?  If not, what was wrong? 

This Chinese company now makes tarps to the MSF specification
His research, carried out on top of his regular job, took three years.  But the product that he specified is now used by many NGOs across the world.  I don't know if he knew the concept of operational research (recherche opérationnelle as Patrick is French), but he has followed the methodology successfully.  And if, having read this, you want to support a relief charity, one of Patrick's tarps will only cost about 10 US dollars.

Christmas is a time of good cheer (for humans and robots)

It was a very good Christmas party ... and my friend started talking about an aspect of his life of which I was completely unaware.  And, once again, I found myself in the company of an enthusiast, whose hobby raised some interesting questions about optimal design.
He said that he and his son had worked together on a battle robot which had been good enough to appear on the TV series "Robot Wars".  The series, and similar ones in other countries, features radio controlled robots whose aim is to incapacitate or destroy another one.  There are some "house robots" which are created with sophisticated weapons.  One of the house robots is "Shunt"
Shunt from "Robot Wars"
There are numerous sources of information about how to start designing such a device.  This blog entry is not about those sources.  It is simply a short reflection about the conflicting objectives faced by the designer.  The robot needs to have offensive and defensive equipment.  Offensive equipment will protrude from the body, and poses a weakness in the defensive shield.  (Medieval castles, wartime pillboxes, army tanks, navy ships - all have the same conflict - in order to be able to shoot arrows, firearms, tank missiles ... there must be an opening, which becomes a target for hostile fire.)  So you protect your offensive equipment especially well.  But the more weight you add to the armour, the more power you need, and the less manoeuvrable the robot.  
Another conflict arises between weight and abiliy to manoeuvre.  The heavier the robot, the harder it becomes to accelerate and turn, so to make it easier, you add more powerful engines  which adds to the weight.  
I could go on.  Suffice it to say that different people have solved these conflicting elements in many different ways.  Next time one of these programmes is on TV, just think - operational research has been used, unknowingly, to solve the problems of conflicting objectives.

Monday, 12 December 2016

Memories of Lyn Thomas

Earlier this year, Lyn Thomas, one of the UK's leading researchers in Operational Research, died.   He had been professor at the University of Southampton, and a prolific writer about many topics in O.R., particularly about credit scoring, start-up firms and finance  His contribution through articles, books and lectures over the past 30 years has been immense.
I met Lyn many times and he was always a perfect gentleman and good correspondent.  I was thinking about him recently when I recalled correspondence we had exchanged about the lighter side of O.R.  I had presented a paper at a conference about dynamic programming and board games, which was eventually to become a published survey paper on the subject.  Lyn was researching and modelling for his paper "The best banking strategy when playing The Weakest Link" published in the Journal of the Operational Research Society (, Volume 54 (issue 7) pp 747–750) whose abstract reads: The paper uses dynamic programming to investigate when contestants should bank their current winnings in the TV quiz show, ‘The Weakest Link’. It obtains the optimal strategy for the team as a whole and then looks at two possible reasons why the contestants tend to use other strategies in reality.
He sent me his models to test and comment, and that led to a further exchange about models for the Microsoft online solitaire game "Freecell"In my presentation I had commented on the original version of this which had 32,768 starting positions and all but one were soluble.  He asked about the way that this analysis had been done, and whether some starting positions were harder than others.  The answer to the first question is that people had solved the 32,767 soluble cases, and then had used a Dynamic Programming approach to show that the final one was not soluble.  For the second question, I could point him to some analyses of the moves to a solution.  Solving a given starting position requires a sequence of moves.  For some starts, there are numerous possible opening moves, and the tree of possible moves becomes very broad.  For others, there is a unique sequence of moves which transforms the starting position into one from which a tree of possible moves follows on.  The longer that sequence, the harder the problem.  Other problems have a diversity of opening moves, which converge on one bottleneck position, which all sequences pass through.  Lyn saw parallels between this solitaire game and some of his work on scoring, and I was delighted to be a distant part of that work.  
Why think of this now?   Freecell is one of the solitaire games provided by Microsoft as a free game, but with twists.  Along with other games, there are four standards of difficulty in the "Daily Challenges".  For Freecell, with complete information available to the player, the problem is to find an appropriate sequence, which may be unique or one of a small number, or one of very many.  So, somewhere, Microsoft have access to a solution tool which measures the complexity of the set of possible sequences for this game.  I wonder how it is calibrated.  I am sure that Lyn would have been interested too.