Tuesday, 29 March 2016

An app for better vehicle scheduling

I used to lecture a little about vehicle routing and scheduling.  One of the regular problems that came into the discussion of the reality of the subject - as opposed to the theory and mathematics - was that of vehicles returning empty.  A lorry would take a load from A to B and then have to return from B to A empty.  As a class, we would discuss ways that the haulier could avoid such empty returns - and as a mathematical exercise we would consider the availability of loads at C1, C2 and C3 (close to B or on the route from B to A) to be taken to near A.  Given the appropriate parameters of cost of the lorry per unit distance, when empty and loaded, the cost of loading and unloading, the cost of extra time on the road, and so on, it was a straightforward calculation to decide whether any of those loads was worth taking. 

Now I learn that a start-up company, Quicargo, has devised an app to help with this.  A customer needs a haulier, and broadcasts the specification.  Hauliers with the app can make a quote for taking the load, rather like the apps used for finding a taxi in many cities.  There are differences; some hauliers will not want to take loads on some routes, and other hauliers are contracted to a limited number of clients.  We will see what happens.

The size of wheels and castors

In the early 1960s, Dr Alex Moulton launched the bicycles that are known by his name.  They were a revolutionary design - for well over half a century, bicycles had (almost) invariably a diamond frame and wheels about 26inches in diameter, and no suspension.  Moulton bicycles had suspension, small wheels (17inches in diameter) and an open frame.  The smaller wheels meant that the tyre pressure had to be higher than was then normal, and the suspension was essential.  It was about 25-30 years before suspension became common on "traditional" sized bicycles.  Modern small-wheeled bicycles have slightly larger wheels (20inches is common).

There continues to be debate about the comfort and ease of riding bicycles with different sized wheels.  There is not much choice, because they are standardized.

Not so castors and wheels on trolleys used for moving goods around shops.  The first vendor that I found in the UK offers castors with diameters: 50mm, 75mm, 80mm, 100mm, 125mm, 150mm, 160mm, 200mm, 250mm, 260mm, 330mm, 370mm and 400mm (and I may have missed some out!).  If you want, you can have castors made to measure.

An assortment of castors
Bicycle wheels need to match the other components of their vehicle.  However, castors can be chosen for the purpose.  They don't need to match mudguards and frames.

The cleaner in the shopping centre this morning was struggling with his trolley, when I stopped to chat.  The shopping centre is paved with small slightly rough flagstones, about 300mm square.  The trolley was not designed for use on such a surface.  It had 100mm castors, and they didn't cope.  Actually, I think they were a little too small for use on a hard surface indoors, because of the load being carried.  Some designer had economised - someone who didn't have to move the trolley around that shopping centre - and there was no feedback to suggest a change in the design.   For the sake of a few pounds, the cleaner's work was being made harder.  Now, if the designer had applied a little operational research "What if?" analysis, things might have been much better.

Later in the day, I found a trolley of similar dimensions, with larger wheels, which was much easier to handle.  It was in a department store, and moved bags of clothing across the smooth floor with ease.  Well done, that designer!

Sunday, 6 March 2016

Supermarket plastic bags and credit cards

Since October 1st 2015, in England, supermarkets are not allowed to give away plastic carrier bags.  They make a charge of 5 pence (about 4 US cents) for each bag.  Up to that date, shoppers could take away a free bag in most of the larger chains of supermarkets.  There are some exceptions to this law, and smaller shops are allowed to give away a free bag, but very few do.  A few days ago, a news item recorded that one company making plastic bags for supermarkets had been forced to close, leading to 40 employees losing their jobs.  That was sad news, but was one demonstration of the way that the nominal charge of 5 pence had altered the behaviour of the shopping public.  Instead, people have bought long life plastic bags (see next paragraph and later) or cloth bags which they bring with them to the stores.  Estimates from the retail sector suggest that the consumption of "One trip" bags has fallen by 80%.  Hence the effect on the manufacturer.

Supermarkets sell long life plastic bags, which are tougher than the free bags - but most of them have a policy that you can exchange a worn-out long life bag for a new one for no charge.  The long life bags are, naturally, emblazoned with the shop's logo and name, to act as a mobile advert.  The same news item that revealed the closure of the manufacturer reported the obvious phenomenon that shoppers are taking the bags from company X when they shop at supermarket Y.  Tina and I have been doing that for ages.  We have a "bag of bags" which contains long life bags from at least four different companies. 

I wonder how effective the long life bags are as mobile adverts.  This is the sort of question which O.R. scientists might study with the aim of determining an appropriate marketing strategy.  My gut feeling is that they will have a tiny effect on other shoppers;  when did you last notice the brand of the carrier bags of the person at the neighbouring check-out?  Yes, I have been aware of them a few times - once when I passed a shopper with a bag for life from a French hypermarket, and a couple of times when the bag seemed out of place, with a discount supermarket bag in an upmarket store, and vice versa.  But there is a possible marketing opportunity to target the owner of the long life bag.  And it depends on using big data.

Supermarkets issue loyalty cards which offer their users different benefits (Tesco Clubcard, Sainsbury use Nectar, Morrisons has "Match and More", Waitrose use MyWaitrose).  Using one of these loyalty cards allows the supermarket to build up a picture of the shopping habits of the owner of the card, which can be coupled with the data that had been needed to register the card.  And some of the supermarkets have credit cards linked to the loyalty cards.  So, without giving away too many details, we have two such credit cards.  The first we use for most of our shopping, whether in the parent supermarket or not.  The second we use in its parent supermarket and for online shopping.  So the first parent supermarket can track how much we spend in some of its rivals, and know that we are not completely loyal to it.  The second can see that we do not do all our grocery shopping with them.

What incentive could these stores give us to try and change our habits?  Could they devise an extra incentive to encourage regular loyal shopping?  And I suggest that bags for life could be used. 

Consider the scenario.  This shopper has a credit card linked to supermarket Z.  According to the big data, that shopper spends 40% of their monthly food shopping at Z and the other 60% at two or three others.  Supermarket Z might find it to their advantage to offer the shopper a free bag for life with a minimum spend, or a discount if they do their shopping in Z with an old bag for life from Z.  The data exists - how do you want to use that data to make profits? 

Tuesday, 1 March 2016

Queueing at the traffic lights

My colleague came into the department, fuming.  He lived outside Exeter, and commuted by car along one of the main routes into the city.  Because the city is divided by the river, there was no alternative route for his daily journey.  And there were road works on the road.  His frustration was the setting of the temporary traffic lights, which controlled a section of the road where there was one-way traffic.  Over coffee, mid morning, we analysed the symptoms and tried to diagnose the underlying problem, and worked towards a solution.  I think it became an undergraduate discussion topic - we wanted the students to think about the topics they were learning about.
At each end of the one-way section, there was a set of traffic lights, which used radar to detect the presence of a car waiting.  But, he explained, the traffic flowing into the city in the morning and the traffic flowing out in the evening, would be limited to about 60 seconds' worth of green light, then the vehicles in the opposite direction would be allowed through, and they might have 60 seconds - or less - which would completely clear the queue from that direction, leaving the lengthy queue of commuters (in or out) moving forward in a succession of 60 seconds-worth chunks of traffic.  He regularly sat through five or six sets of changes before getting through the one-way section. 

It was a problem of queueing and the way that the "server" (traffic light) dealt with the queue.  There was clearly a setting on the system which used an algorithm like this:
(A) If the light is red and there is a car waiting, signal that the light should change at the next epoch;
(B) If the light is red and there is no car waiting, signal that the light should stay at red;
(C) If there is a signal to change the light, the next epoch is defined as the first of (i) 60 seconds after the lights last changed; (ii) there is no car waiting at the other end.
There was probably a further rule to change all lights to red if there was no car at either end

These rules led to the queues for commuters and their frustration at seeing the traffic in the opposite direction moving so quickly.

So what could be done about it?  The radar did not measure the length of the queue, it only detected the presence of a vehicle at the head of the queue, but common sense would have suggested that the traffic would be unbalanced during the weekday rush hours.  So we postulated a variation on (C)(i) to make it 120 seconds during the rush hour for the commuting traffic.  (120 seconds arises from a psychological observation about UK drivers - if traffic lights do not change in that length of time, then in this country, drivers start to think that the lights do not work and take risks.  As I recall, in other countries, drivers may be more patient or more impatient - there are national variations.) 

I don't know whether such rules have been included in the programming of temporary traffic signals; we were using common sense and knowledge of queues and statistics. 
French traffic lights - with handles and a wheel
Now, several years later, we have a related problem at road works near home.  There are temporary lights at a local crossroads, replacing the lights which are out of action for a short time.  Once again, the problem is the setting of an algorithm.  The lights are radar controlled, and at busy times behave like this:
  • green for westbound traffic for 50 seconds or until there are no cars (whichever is first)
  • red all round for 12 seconds because the westbound traffic must clear a narrow section (*)
  • green for eastbound traffic for 50 seconds or until there are no cars (whichever is first)
  • red all round for 12 seconds (#)
  • green for both northbound and southbound traffic for 50 seconds or until there are no cars (whichever is first)
  • red all round for 12 seconds (##)
(*) is sensible because of the narrow section
(#) and (##) are not sensible because the traffic does not need such a time to clear the junction - and that is the wrong setting which results in frustration
The permanent lights use 10 seconds in (*) and 3 or 4 seconds in (#) and (##)

I imagine that the installers would argue that they act with a safety margin - but the excessive safety leads to impatience and annoyance; a little application of queue modelling (and common sense) would improve the road user's lot.

Monday, 22 February 2016

Inspecting millions of items

This is a management problem without an obvious solution.  In the U.K., private motor vehicles must - by law - pass a test each year.  It is called the "MOT test", and people talk about "going for the MOT", even though the Ministry Of Transport (MOT) is now the DVLA (

What the test covers

Saturday, 6 February 2016

Measuring is not (necessarily) controlling

We refer to it as "Big Brother".  Our electricity utility company has replaced our consumption meter with a smart meter, which can be interrogated remotely, removing the need for an official to come and read the meter every three or six months.  They told us that the old unit was out-of-date.  In the conversation about when to replace the meter, I was asked what the mobile phone strength was like by the meter; I answered that I never had tried to make mobile phone calls from underneath the stairs in our house.  (There is a good signal under the stairs on one phone network - not the one that we use!)
Part of the deal with the replacement meter is that we were given a smart monitor.  This interrogates the meter several times each minute and indicates our usage of electricity, with a three-colour light (green, amber, red for increased usage) and with a segmented dial with the same colours.  It also indicates the usage for different periods of time.  Default is the cost of electricity since midnight, so I am getting used to coming down to the kitchen each morning to find that Big Brother tells me that we have used 12 pence worth of electricity so far.  This comes from the background usage - clocks, freezer, refrigerator, central heating pump, radios on standby, chargers, and about 2 pence for the first kettle of the day for a pot of tea as we wake up. 
We do not have the toy!  The blue sectors are for those who monitor gas use as well as electric
We have both muttered "Measuring is not controlling" because there are comparatively few ways that we can reduce the amount of electricity that we use.  Nonetheless, we haven't turned Big Brother off yet, because it is interesting to watch the costs rise during the day, and associate activities (microwave on, thermostat on the electric iron reaching operating temperature) with changes to the light and sector dial.  And maybe we do not now boil too much water because each litre boiled costs 2 pence.
But, in the wider world, monitoring and measurement can be a good first step to controlling; so good O.R. may start with monitoring to obtain a series of appropriate measurements

Saturday, 30 January 2016

Seasonal variation - cycle helmets

For a time, I once taught a module on time series analysis and forecasting to undergraduates.  One aspect of such a module is to show different sorts of time series and how to build reasonably accurate forecasting models for them.  As the models became more complex, we looked at real life time series to identify what sorts of models were best for each one.  Of course, sooner or later, we had to model seasonality.  After dispensing with the absurd series for the sales of Christmas trees. month by month, we looked at more serious examples.  As I cycled to work, I brought in two series related to cyclists in the UK.  The first showed the monthly distance cycled by people in the UK, month by month, based on surveys of people's travel habits.  The second showed the monthly numbers of accidents to cyclists in the UK, taken from hospital admissions.  Both showed strong seasonality, with peaks in the summer months.  (Many casual cyclists do not use their bicycles in the colder months.  I did and still do.)  With my tongue in my cheek, I graphed these two series and announced that it was clearly more dangerous to cycle in the summer ... and waited for a response.  Sooner or later, someone would point out that the total number did not represent risk.  So, what does represent risk?  A little more thought, and the answer came back; why not take the ratio of accidents to distance?  With appropriate scales, that gave a third time series, and that too had seasonality.  It peaked in September-October.  Now we moved into the psychology behind such a seasonal variation, and my researches had shown that in those months it was still warm enough for the casual cyclists, but many neglected to use lights.

The BBC radio programme "More of Less" earlier this month included Rob Eastaway, playing a statistical game with children on a bus in London - spot the cyclist.  One pupil scored the number of cyclists with helmets, the second counted those without.  First one to reach a score of ten wins.  Now helmet-wearing is not compulsory in the UK, but many cyclists wear helmets.  Rob espected the game to end at about 10:5, but in the end it was 10:9 for helmets.

Tina and I have amused ourselves doing this counting on several rides on the cycle paths by the river Exe recently.  Generally we find that about 20 to 25% of cyclists are without helmets on these paths, but there is some seasonal variation, by day of the week and time of day.  More riders are helmetless at weekends, when there are leisure cyclists.  Early morning cyclists are more inclined to wear helmets than those mid-morning.  More riders are helmetless within a 3 mile radius of the city centre - suggesting that those who do a longer commute tend to wear a helmet.  But there is another factor to the seasonality which the time series models would have difficulty representing- that of people cycling in groups.  Three of four people together will often affect one another's use of helmets - either all with or all without. 

I can't think of any serious reason for wanting to forecast the number of cyclists wearing helmets that you would see on a given day and time, but the analysis of past data would be an interetsing exercise for students.  Any offers?