Monday, 29 October 2012

Mathematics in packaging design

Our household is committed to the four "R"s for purchases.  R for Reuse, R for Reduce, R for Repair, and R for Recycle.  It grieves us to put waste into the bin for non-recycleable items which go to landfill.  And we try to find alternative uses for items, rather than throw them out into the green bin.

We use old mushroom boxes, taken from the waste of our local greengrocer's shop, as boxes for storage; one box holds twelve jam-jars, and one box is a convenient size for office waste (just big enough for A4 paper and newspapers).  Latterly we noticed that the shape of the boxes had been changed very slightly.  The bottom corner of boxes used to resemble the corner of a cuboid, like the picture of the blue box below.



The newer boxes have a changed design, with the sharp corner cut away as in the black box below.  Geometrically, it is like the change from a cube to a truncated cube, with equilateral triangles in place of the box corners.

Why the change?  These black boxes will be easier to make, because the three-dimensional right-angle is a little difficult to ensure it is properly made in the plastic moulding.  Sharp corners are slightly tricky to make with the kind of plastic used for these boxes.  There are obtuse angles instead, and moulding processes will be simpler and more reliable.

So someone has spotted a problem, and devised a solution.  Where's the operational research component?  The box has to hold a specified weight of mushrooms, in this case 6 pounds.  (Not a metric size!)  So, the volume of the box cannot be reduced by very much, as the supply chain is familiar with the external dimensions of these boxes..  On the other hand, the dimensions of the cutaway corner involve some mathematics.  The "ease" or cost of manufacturing will depend on those dimensions, so perhaps somebody has applied a little modelling to determine an acceptable compromise of strength and cost, subject to the volume being within some constrained amount.



Wednesday, 24 October 2012

You paid how much for the seat in the grandstand?

The Independent newspaper carried a two-page spread the other day about dynamic pricing for spectators at sports events and theatre performances.  See: link
The article starts with the usual comment that dynamic pricing (yield management or revenue management) is widely used in the travel industry, and then continues:

Dynamic pricing, a system used widely by airlines, is revolutionising the British box office. It’s already happening in sport. When Derby County play Blackburn Rovers on Saturday, the price of thousands of tickets will have been determined by computer servers in Indiana, and may go up or down in the days before the game according to demand — or even the weather forecast (not great, as it happens).

The report in the paper describes some of the advantages of variable pricing for customer and service provider, with the usual accounts of how spare seats can be filled and provide revenue for the sports club.  The article was up-front about the problems: many football supporters buy season tickets (full price); there is a risk of making a loss; national rules forbid too many price promotions per year.  But it is clear that more and more sports and theatre events in the UK will use dynamic pricing in the future.

I confess that I was sad that the clubs have had to go to expertise across the Atlantic to find a company that will provide the data analysis and programming to implement the system.  Knowing that there are several airlines and travel companies using such a system already in the UK, it is a shame that it couldn't be provided in the UK.

And I suspect that one passage in the article is not strictly accurate.  This reads:

Witness the outrage this week among Rolling Stones fans about the price of tickets to their 50-anniversary gig (up to £375 for standard tickets). Dynamic pricing wouldn’t work here — the biggest gigs sell out faster than any algorithm could respond 

I am sure that the algorithms could respond fast enough; the problem is the interface with the potential customer, who spends several minutes on the interface, and in that time the algorithm could have changed the price being charged to that type of customer many times. 

However, here is an OR model which is going to affect millions of people in the UK in years to come, and we shall probably get used to it, just as we generally accept dynamic pricing of rail fares and air fares.

Thursday, 11 October 2012

Garbage in, garbage out

Between school and university I had a gap year (nine months because of the need to do entrance examinations for university in November).  I spent most of that time in a low-temperature physics research laboratory, where I had the job of writing computer programs to help the research team.

The laboratory was served by a computer centre, and the only language available was Algol 60.  (Hands up if you have ever heard of Algol!  And a gold star if you know the differences between Algol 60, Algol 68 and Algol R!)  I still think about programming in the structured way that I learnt in those very distant days.  One of the questionable joys of Algol 60 was that the language specification did not describe input and output routines.  So these were dependent on the computer centre or the computer manufacturer.  The staff at our computer centre had written their own input/output routines.  Because there were numerical analysts in the team, they had implemented input in a way which honoured their calling and expertise.  Inputting real numbers could be done either by the command "READ" or the command "EXACTREAD".  The latter corresponds to every input routine that I have used since then.  It treated the input number as being exact, so the number 10. meant 10.000000000000 and not somewhere between 9.5 and 10.5.  Input 10.0 and it meant the same.  But if you used the command "READ" the internal representation of 10. was less precise than that for 10.0, and even less precise than for 10.000.  I guess it was stored in a binary variable with a different number of bits.  (The implementation of this is left as an exercise for the reader.)

The reason for this was to help the scientists doing their physics experiments design ways of analysing their data that were robust as far as the accuracy of calculation was concerned.  If you made measurements to three significant figures on the lab machines, then you could not expect more than three significant figures in the output from your programs.  And if you were careless and started to do arithmetic which lost some of those significant figures, then the compiler would "Punish" you, and you would see that you had lost accuracy.

I learnt this the hard way, because I constructed some theoretical models to support the physics team.  Why, I wondered, did my model give the same results when one key parameter was 6. as when it was 7.?  Answer - I had input that parameter with "READ".  In the process of the calculations of my theoretical model, I had lost accuracy and the result was garbage.

It was an important lesson for me.  Ever since then, I have been conscious of the dangers of squeezing too much accuracy out of an imprecise piece of data, and of the need to design computer programs which do not waste significant digits.  Hopefully most O.R. people are aware of the potential for errors of poor computer design.  In Excel2003 (which I have on my computer) standard deviations are found the "lazy way".  Try it.  Find the SD of 1, 0, -1 (you get the answer 1).  Now try finding the SD of 10^15+1, 10^15, 10^15-1 (and I get 16777216)

When does this matter?  In my postgraduate LP course we were warned about the accuracy of inputs to LP models; it may be apocryphal, but the story goes that the oil company O.R. team wanted to know how accurate the measurement of viscosity was.  Who entered it into the data?  A man who dipped his thumb and forefinger into the latest batch, rubbed them together, and pronounced a number for the viscosity.  It meant that efforts to make the LP model more accurate were limited by the accuracy of this input measurement.

If one of your research papers has crossed my desk as a referee, I may have included comments about the spurious accuracy of your tables of results.  Even the highest ranked journals allow papers through where there are tables with six or more significant figures, based on parameters given to two significant figures.  Even the best computer models cannot generate more accuracy than is present in the data.  And anyway, why should anyone be really interested to know that your model took 131.4159 seconds to converge rather than 130 seconds?

Elsewhere I have commented on the habits of the publishers of food recipes to give the number of calories per serving to three significant figures when the recipes include such variables as "one onion", "about 50 grammes of hard cheese" and so on.  One of my colleagues used to give lectures about this accuracy (or lack of it) under the title "How much does a kilogramme of bananas weigh?"

One can address the same criticism to the statisticians who month by month trot out that the average price of houses sold in the UK in month X is £Y - and there are six significant figures in Y.

All of this came to mind when I was cornered and asked to complete a survey on tourism.  Having once written a paper when I took a sideswipe at a university report on tourism, based on a self-selecting group of respondents, who were about 2% of the number attending the event, I was curious to know what would be asked.  My sideswipe in that case was addressed at the amazing precision that the university team produced for the revenue generated for the tourist economy by the event; it was slightly less than £1million, stated to the nearest pound.  (Six significant figures, on that sort of sample!)  The survey that I was taking part in was done using a tablet computer, which meant that inappropriate questions could be left out.  When it came to finance - how much have you spent on food, transport, accommodation, outings - all the entries were in broad intervals.  Perhaps some clever statistician knows that when respondents say that they spent between £101 and £250 on food, then it means that the average for such respondents is exactly £132.  Perhaps not.  And the interviewer knew the categories, and guided me towards what she considered the likely answers.  Anyway, it is difficult to say exactly how much you have spent on food in one day on holiday, let alone recalling the previous few days and estimating what you will spend for the rest of the holiday.  So, once again, I will view the output as suspicious.

The sad thing is that numbers from all these suspicious sources may be used in somebody's model; I just hope that the modeller knows what he or she is doing when they are included.

Otherwise, as the title says, Garbage In, Garbage Out!

Monday, 8 October 2012

Putting O.R. in the start-up business plan

The other day I had a serendipitous meeting with the owner of a small business.  It was my birthday, and we had gone out to lunch in an unusual restaurant about 20 miles west of here.  As I parked the car, we noticed that there was a waste collection vehicle in action.  While Tina took our guests into the restaurant, I checked that the car was not going to be an obstacle to the collection truck.  The driver was the owner of the company, standing in for the usual driver, and we stopped to discuss the business.  The vehicle collected all the food waste from the restaurant, both that from food preparation and uneaten food.  What happens to that waste?

The vehicle was going to take all the food waste to an anaerobic digester where it is turned into an energy source and organic fertiliser.  Food waste is macerated into tiny pieces to allow for better digestion from the bacteria in the digester. As the organisms eat their way through the waste, methane gas is created as a by-product. This gas is siphoned off and used to power an engine and, in turn, an electrical generator.  Whilst some of the heat generated is used as an eco-power source for a local dairy, the surplus is directed to the National Grid for electric power. The only waste product from this process is organic digested material which, when dry, is an effective fertiliser.

We talked about the process, which seems to have widespread application.  It is a new business, hence the title of this article referring to "start-up".  And we spoke about several aspects of the process and business, including the radius that could be served by the plant, which is in Plymouth (about 20 miles further west).

Afterwards, I reflected on the scope for O.R. in such a business.  Even in a short conversation, I could see that there are now - now the business is up and running - several opportunities for an O.R. professional to help with decision-making (such as inventory control, vehicle routing, scheduling, forecasting).  But, I realised that the scope for O.R. in the first stages of a start-up is limited.   We tend to assume that there are datasets which we can analyse from the past history of the enterprise - datasets which the entrepreneur will not have.  What help could I have offered this man if he had come to ask for O.R. help before he launched the business?   The answer is surprisingly little.  In O.R. we are biased towards the enterprise that is up and running.

Postscript:  From the Western Morning News of 26-Nov-2012, reporting on the South West Green Energy Awards:
Best renewable energy scheme went to Langage Farm in Devon, which has integrated an anaerobic digester into its operations. The plant uses waste material to provide enough heat and energy to run both the farm and the dairy produce factory.
The bio-fertiliser output is applied to the farmland which grows the grass, which cows eat to produce milk, which is then used to make dairy products, creating a carbon- neutral, closed loop.

An expensive way to be insulted ...

An expensive way to be insulted ... by someone half your age.

Years ago, some cynic gave that sentence as a definition of Operational Research.  It reflected the youth of many O.R. consultants, compared with the maturity of the managers for whom they did projects.  In addition, it hinted at the cost of consultancy and the cynical belief that consultants tell the client what the client already knows.

I brought this cynical definition into a recent discussion about a topic which is often raised by our profession.  Why is it, that given the benefits that O.R. can bring, the discipline is so little known.  And that leads on to questions about how to publicise the benefits of O.R..  How do you let people in industry/commerce know that there are people with the specialisms and expertise that will benefit their decision-making?

It is generally acknowledged that there are many people who are aware of specific techniques of O.R., such as linear programming, and may even use that techniques, but do not realise that one technique is not the sum total of skills that O.R. can bring.  This has been shown by several surveys of managers and decision-makers.  So how do you move from a little knowledge (which may be a dangerous thing) to being willing to use the breadth of expertise that an O.R. professional can bring?

In the discussion that ensued, we talked about ways of publicising O.R. - but they seemed to be "more of the same";  magazine articles and press releases simply add to information (over)load for busy people.  Successful projects are useful adverts.  One client may talk about the way that they have been helped, but a second client may believe that O.R. was good for one type of problem only. 

There's another problem in large organisations, where there is a culture of management services.  The O.R. professional may be seen as a threat to the decision-maker.  This is because the way that O.R. analyses problems requires extensive knowledge of the situation faced by the decision-maker.  When the O.R. person is investigating, the client may feel threatened because of the extent of data/information acquired.  As a result of the O.R. work, the O.R. person will know about the way that the client does his/her day-to-day work - and this may be threatening, since the consultant can do this part of the client's work!  This situation is not so threatening for studies by other types of management services workers, whose data collection is restricted to specific areas of work.

So, we are left with the perennial problem.  However, let's be positive.  O.R. - the science of better - can help many decision-makers.  O.R. workers are not all young, and whatever their age, they will bring an incredible breadth of experience of solving management decisions.  Their work won't be very expensive compared with the potential cost of a poor decision.  And O.R. workers seldom insult their clients!

Wednesday, 3 October 2012

The risks of a rail franchise

Today the headline news at 7am was about a story that broke from the British Government late last night, after the newspapers had been published, so that there were contradictory messages in the press and on the radio/TV.  The story was that the government has back-tracked on awarding FirstGroup the franchise for the West Coast rail line.  (here)

(note to readers outside the UK.  Our railways run as franchises for several years - 15 in this case - and the franchises for different services are awarded on the basis of competitive  bidding.  Four companies bid for the west coast line, roughly from London to Glasgow via Birmingham and Manchester.)

When this franchise was awarded in the summer, one of the defeated bidders called "Foul" and was ready to go to court. 

The news this morning is possibly related to the call of "Foul", but nobody admits that.  Little has been said about the reasons, except that the government recognised that the measurement of risk had been less than perfect.

The word "risk" suggests operational research - we do risk analysis as a matter of course.  So either there has been some less than perfect O.R., or there has been no O.R. at all.  There is some mention of the use of a government "model" to evaluate the bids, and the finger is being pointed at incorrect data - which probably implies scenario analysis for the risk assessment.

I went to one of the news sites about this story, one which allows readers to comment on the story.  There were over 1000 comments.  I searched them for the word "risk".  And nobody had mentioned it in their comments.  They were all about politics, the way that the railways are managed and the call of "Foul".  Nobody seems to have considered the way that risk analysis had been done. What a shame that there has been so little recognition of the flaws in the analysis and how it might be done in a better way!