Tuesday, 21 July 2015

Regular road maintenace

How often should a road be completely resurfaced?  What criteria should be used to decide whether to repair damaged surfaces or not, and whether to resurface the whole road?  Interesting questions for operational research. 

Devon has an extensive network of roads, from the motorway (M5) through dual carriageways to minor roads which run through quiet parts of the county.  Each one needs to be cared for.  Finance for the repairs is limited, though it comes from different sources, depending on the importance (load) of the traffic on that road.

Tina and I were walking in South Devon last week.  To get to the starting point we used several minor roads, and part of our walk took in a mile or so of single track roads.

We joke that we enjoy driving on roads where there is grass growing in the centre, a consequence of the fact that the centre of the road is never touched by the wheels of vehicles in such roads. However, one consequence of the growth of vegetation is that the road surface is damaged by the roots.  The surface is also affected by the water which runs off to the road-side. 

In the walk, we noticed a contrast between the minor roads that run through woodland and those that run through farm fields, with hedges or fences.  The latter dry out much more quickly than the former, as they catch the sun.  But, more significantly, any debris on the road surfaces dries and can blow away; it doesn't accumulate.  On the other hand, minor roads in woodland accumulate wet woody debris which doesn't dry out; and then water running off these roads is forced into the road-side where it erodes the surface. 

So, thinking of these observations made me consider those questions of repair or resurfacing, especially for those single-track minor roads.  I suspect that the answer is that nobody has models for it, and work is simply carried out on the basis of inspections and reports from road users.  But there is a student project here for someone.

Optimal portfolios and "diworsification"

Among the mathematical techniques that Operational Research scientists use is Quadratic Programming (QP).  It isn't often included in introductory courses, partly because it is hard to devise simple examples for classroom use.  I suspect that most courses including QP use portfolio optimisation as their introductory example.  This assumes that an investor has a finite sum to invest, and can divide it between a set of investments.  A great deal is known about these investments; the expected return on each, and the variance of each return, and the covariance of the returns between the investments.  Given these data, the expected return of the portfolio is a linear function of the decision variables (amount put into each investment).  The variance of that portfolio is a quadratic function of the same variables.  Then the simplest model is to minimise the variance subject to a constraint on the return.  Since this model was put forward in the research literature in the mid-20th century, it has been widely copied, criticised and developed.  The assumptions have been questioned, particularly the belief that one knows so much data about the investments, and the belief that the distribution of returns follows a normal distribution.

I read somewhere that the proponents of these models do not use their models in their investment holdings; does anyone know if this is so? 

Recent studies by financial analysts have looked at theoretical investments to investigate the effect of the number of alternative investments on the variance of the return, and - as one might expect- the more possible investments, the smaller the variance.  For variance, read "risk".  But, and this seems intuitive, the variance tends to a limit, so that adding one new investment to a choice of five has much more effect than adding one new one to a choice of fifteen, and that in turn has more effect that adding one to a choice of twenty-five.  The phenomenon has been named "deworsification", a portmanteau word combining diversification and worse. 

Analysts claim that once a stock portfolio reaches 20-30 holdings, there is little additional benefit to be gained from adding even more holdings.  Furthermore, a financial manager would like to have the chance to switch holdings, so as to grasp "investment opportunities", and the size of a holding in  a larger portfolio would not be enough to do this.  So there is another psychological advantage to this composition of holdings. 

Discovery of the term "deworsification" made me wonder whether specialists in QP had been involved in the studies mentioned above.  One of my memories of QP models of portfolios is that the optimal solution often occurs at a flattish region of the objective function, so the optimal mix can be varied from the theoretical optimum without significant effect on the "risk", and this phenomenon ties in with the idea of "deworsification"; changing one decision variable from its optimal value to zero (taking it out of the model) has little effect on that measured "risk". 

For many small investors, unit trusts are the way  to start.  Most unit trusts have more than 30 holdings, so they probably could have fewer holdings without serious effect on performance.  But, would a small investor be willing to put money in such a unit trust?  I wonder.


Friday, 29 May 2015

Operational Research, psychology and bus fares

Tina and I use the bus service of Devon to travel several times a month, sometimes when we shop in the city centre, sometimes when we want a walk and the bus is a convenient means of transport.  In the UK, there is a concessionary bus travel scheme, so that we have free passes on most bus services after 9:30am on weekdays and at any time at weekends. 

This is not the sort of bus that we use, in Devon or anywhere else. 
We were waiting for a bus in Somerset (county town Taunton) earlier this week, when we noticed an advert for the local service "go anywhere" tickets.  And we were fascinated by the prices charged.  Clearly, somebody had done some calculations about how to encourage bus use by making the offers attractive.  Behind the figures are some models and some adroit psychology.  So, here are the figures.

Go anywhere for one day: Adult £10, Child £5, Family (2 adults and as many children as the parents want to look after) £20
To interpret these a little more, no return bus fare in Somerset can exceed £7.50, even if the journey needs changes of bus service.  Within Taunton, return fares on one bus service cost £3 maximum.  And one needs to know that the bus services radiate outwards from Taunton

Go anywhere for one week: Adult £15, Child £7.50, Family £30
Go anywhere for one month: Adult £55, Child £27.50

So a go anywhere ticket for one day has been priced at less than the maximum of two return journeys.  It is likely to appeal to someone starting in Taunton who needs to make two or more journeys out of the county town, or to someone who likes bus rides.  The appeal to the holidaymaker or shopper is small; such a customer will probably only make one return trip per day ... but the price may encourage the faint-hearted to take the bus and save on fuel for a car and car-parking charges

But a go anywhere ticket for a week has been priced to encourage commuters and holidaymakers to use the buses.  Commuters (five days per week or less)  within Taunton will not get an advantage, but those from outside will do so.  Holidaymakers and shoppers will be able to use the bus service on two or more days and benefit (even more if fuel and car park charges are considered), and the family ticket has been priced to treat all sizes of family equally. 

The clientele for the go anywhere monthly ticket is likely to be regular users of the service, so the price has been set to give a small discount over the price of four weeks' weekly tickets.  Holidaymakers don't stay for four weeks.

How does the bus company benefit?  Once the bus timetable and route has been set, income from passengers is mostly marginal income.  The cost of running an empty bus from A to B is a little less than running a full one, so the company benefits from every ticket sold.  So it is in their interest to maximise the number of passengers, and offering incentives such as the weekly ticket, and (less so) the daily and monthly tickets, will increase the number of customers.
Nor is this a local bus in Devon or Somerset
I have identified three customer types: commuters, shoppers and holidaymakers and they have different behaviour and needs, and hence the psychology of charges will differ for them.  I wonder if there were three models (even mental models) or more?  However many, I salute "the buses of Somerset" for their work, their financial O.R. and their psychology.

Monday, 18 May 2015

Modelling a yacht race

English schoolchildren these days are assessed in examinations at the ages of 15-16 and 17-18, now known as GCSEs (General Certificate of Secondary Education) and "A"-levels.  In my youth I was examined by "O"-levels and "A"-levels (Ordinary and Advanced).  I remember very few aspects of these examinations  One exception is a question in mathematics, as it was thought-provoking.  "Assuming that a yacht's sail deflects the incoming wind as in a mirror, explain why the angle of the sail affects the speed of the yacht"  Quite obviously it was a matter of vectors of force from the wind against the sail and the resistance of the water on the hull.  But this question was different from the usual questions in books, where the forces were acting on idealised objects ("a pendulum on a rod of negligible mass ... ", "a perfectly smooth bead is on a wire ... ")

I hope that the examiner realised that this question would make the examinees pause and think, and allowed extra marks for the time that this might take; and I wonder if other students can remember the question so many years later.  (I have two other memories of that year's examinations - one that I realised ten minutes after a mathematics paper that I had subtracted 530 from 600 and got the answer 50;  the other that in a physics practical involving the cooling of water, I had poured my water away before measuring the volume - so I quickly measured the warm portion of the container, refilled it to the same depth with cold water and measured that, thus getting an answer which was "near enough".)

In the May issue of the Journal of the Operational Research Society, Robert Dalang, Frederic Dumas, Sylvain Sardy, Stephan Morgenthaler and Juan Vila describe how they modelled the forces acting on a racing yacht to determine the optimum course for that boat in the America's Cup races in 2007.  It was rather more sophisticated than my few lines on the "O"-level script in the 1960s. 

Stochastic optimization of sailing trajectories in an upwind regatta appears in the Journal of the Operational Research Society(2015) volume 66, pp 807–820,doi:10.1057/jors.2014.40 (abstract: In a sailboat race, the navigator’s attempts to plot the fastest possible course are hindered by shifty winds. We present mathematical models appropriate for this situation, which use statistical analysis of wind fluctuations and are amenable to stochastic optimization methods. We describe the decision tool that was developed and used in the 2007 America’s Cup race and its impact on the races.)

As the abstract points out, the winds are not constant in direction or strength.  Therefore, the model needs analysis of the past variation as well.  One simplification (realistic) was to model the first upwind leg of the race, as the yacht that leads at the first turn is likely to stay in the lead.  In the paper there are diagrams "Boat polars" which would have been useful in the "O"-level; they show the velocity of a selected boat in a wind of given speed and with the course set at a given bearing.  These lead to the optimal bearing for the wind speed.  The paper discusses tacking (changing the direction of the boat when going upwind) and the choice of whether to start on a left-hand tack or right-hand tack.  And then this feeds into an optimisation model which uses a discrete space for the progress of the yacht.  

Boat polars for a given speed of wind showing (on the right) the optimal course to maximise speed against the wind (from the cited paper)


All well-worth reading.  Towards the end of the paper there is a wistful comment:
Given that the Swiss team implemented our strategy software into their onboard computer system, trained to use it, and finally actually won the 2007 America’s Cup race, we can consider that stochastic optimization techniques were useful to the team. However, since a typical team’s budget is on the order of 100 million dollars, it is clear that a team of a few mathematicians only makes a small contribution to the overall effort.

With hindsight, how much should the mathematicians (O.R. scientists) have charged for their services?

Thursday, 7 May 2015

Comparing apples with oranges

Long ago, teaching a course on the statistics of surveys, I reminded my classes, repeatedly, that they should make sure that the comparisons that they made between results were rigorous.  If not, the saying goes, you are in danger of "comparing apples with oranges".  The point is that the underlying populations, and the measurements on them, should be comparable.  Apples and oranges are different fruits, grown in different countries, and their agriculture is different.  So, to be ridiculous, one could not measure the cost of producing one orange with the cost  of producing one apple, because one could not grow oranges in an apple orchard and vice versa.

So, today, an advert on a bus in Exeter caught my eye.  "More people see bus advertisements than use social media daily".  Apples=People see an advert on a bus in the course of ... how long?  The text suggests "in a day".  Oranges=People using social media daily.  Measurement in both cases=total number. 

My interest was aroused.  Not everyone who sees an advert on a bus will read it.  Very few will have gone out of their homes saying "I really must read a bus advertisement today".  But people are purposeful when they use social media.  Measurements on apples are not measurements on oranges.  I managed to find estimates of the number of daily users of social media in the UK.  It is roughly 20 million but may be as high as 25 million.  So how many people see a bus - let alone a bus advert - daily?  Guesstimating that number suggested that a figure between 15 and 25 million would be about right, knowing the population of the UK, and the working population who would be commuting and might see a bus.  So the two numbers are in the same ballpark - if the bus advert figure is for daily sightings. 

That was when my search found the website of the company making the claim.  There I found the claim:
30 million people have seen advertising on the outside of a Bus in the last week  - See more at: http://www.exterionmedia.com/uk/what-we-do/our-media/bus-advertising#sthash.jYIkaMpL.dpuf
30 million people have seen advertising on the outside of a Bus in the last week  - See more at: http://www.exterionmedia.com/uk/what-we-do/our-media/bus-advertising#sthash.jYIkaMpL.dpuf

 30 million people have seen advertising on the outside of a Bus in the last week


Aha!  the time scale for apples is now a week.  (And why write "Bus" with a capital "B"?)  My guesstimate is reasonable, since one can assume that in seven days, some people will see adverts on several days, while others will see them on one.

I hope the thousands or millions who see the advert that I saw this morning will recognise that you can't compare random exposure to an advert on a bus in one week with purposeful use of social media.  If they don't, then they shouldn't be entrusted with buying apples; they might buy oranges, or grapes, or tomatoes!
30 million people have seen advertising on the outside of a Bus in the last week  - See more at: http://www.exterionmedia.com/uk/what-we-do/our-media/bus-advertising#sthash.jYIkaMpL.dpuf
30 million people have seen advertising on the outside of a Bus in the last week  - See more at: http://www.exterionmedia.com/uk/what-we-do/our-media/bus-advertising#sthash.jYIkaMpL.dpuf
30 million people have seen advertising on the outside of a Bus in the last week  - See more at: http://www.exterionmedia.com/uk/what-we-do/our-media/bus-advertising#sthash.jYIkaMpL.dpuf
30 million people have seen advertising on the outside of a Bus in the last week  - See more at: http://www.exterionmedia.com/uk/what-we-do/our-media/bus-advertising#sthash.jYIkaMpL.dpuf

Monday, 20 April 2015

Clement Attlee on Operational Research in 1944

I was born several years after the second world war, so do not have any personal experience of that period of world history.  However, for various reasons, I have known about the secrecy associated with the work of British scientists during the war.  So I have been mildly annoyed when reading novels set in that time which make anachronistic reference to that work.  I won't name the guilty parties.  One had a character talk openly about going to Bletchley for a message to be decoded, when the existence of the operations there was a secret for a generation afterwards.  Over the last weekend, another book had a character assuming that the enemy bombers in a raid on Britain in 1942 had "flown under the radar".  Again, the word radar was seldom used at that stage in the war, although there was no way that the radar masts could be disguised, their purpose was secret and the term "radar" was little used, so the expression "under the radar" would not be in civilian usage.  By 1944 the government had admitted the existence and efficacy of Britain's radar system.

So, as I was a little irked by the anachronism, today I turned to an index to newspapers of the period, to find when the press had first used the term "radar".  The Times had used the term twice by 1942, and neither time was there reference to British radar systems.  But it was a 1944 reference which caught my eye. 

On Thursday April 20th, 1944 (six weeks before D-Day) there was a debate in Parliament about support for science; the debate seems to have proceeded on the assumption that the Allies would win the war.  Clement Attlee (then Lord President of the Council, later to be Prime Minister in the peace-time government after the election in 1945) said:
  • The country owed a great debt to scientists, for to a far greater extent than ever before the war had seen the application of science to the production of weapons of offence and defence in all three elements [land, air and sea].  In quality of research we fully held our own.  In the study and the laboratory the brains of our scientists had been pitted against the best brains of the enemy and they had not been found wanting.  Perhaps the most striking instance had been the development of radar.  Another was in operational research.  Today, after operations had taken place, there was a kind of post-mortem by trained scientists to make a careful examination of the facts which had led to success or failure.
So, there we have it.  Praise for operational research in the war effort, both for planning and for the analysis afterwards. 

Clement Attlee, British Prime Minister in the post-war government (picture from history.blog.gov.uk)
 I wonder, on that April day exactly 71 years ago as I write, how many readers of The Times would have known anything about operational research? 

Friday, 17 April 2015

What is a system? A 19th century answer.

Frederic Bastiat is a name that is little known in Operational Research circles.  Actually, I hadn't heard of this nineteenth century economist until earlier this month.  Yet he wrote about one of O.R.'s essential features, the extent of the system being modelled or studied.  Frederic was a French economist, an essayist and member of the French assembly.  In 1850 he published a pamphlet containing his essay "Ce qu'on voit et ce qu'on ne voit pas" ("What is Seen and What is Unseen") which included a story, sometimes called a parable, about the economic effects of a child breaking the glass in a shop-window.

He didn't use the word "system" in the essay.  I shall use that word, because it is part of the language of O.R.  Bastiat simply asked the reader to consider the extent of the effect of that damaged window pane.  "The glazier comes, performs his task, receives his six francs, rubs his hands, and, in his heart, blesses the careless child. All this is that which is seen."

But is that the extent of the system?  Bastiat argued that there is a larger system which is unseen.  "as our shopkeeper has spent six francs upon one thing, he cannot spend them upon another. It is not seen that if he had not had a window to replace, he would, perhaps, have replaced his old shoes, or added another book to his library."

"The window being broken, the glazier's trade is encouraged to the amount of six francs; this is that which is seen. If the window had not been broken, the shoemaker's trade (or some other) would have been encouraged to the amount of six francs; this is that which is not seen."  So the system affected by the broken window extends beyond the glazier to encompass the alternative businesses where that six francs could have been spent.

(some of Frederic's thinking was concerned with what would happen, economically, if all the buildings in a part of Paris were to be destroyed.)

Economists claim that this is the earliest discussion of "opportunity cost".  That is another term which arises in O.R., especially in the context of the sensitivity analysis of a linear programming solution, where the reduced cost (opportunity cost) is the amount by which an coefficient in the objective function would have to improve before it would be possible for the corresponding variable to enter the optimal basis of the solution.

So, rise up, you O.R. scientists, and praise the name of Frederic Bastiat!