An important issue for crowd safety is how long it would take to evacuate a venue. Like the last article this is not to attempting to figure out the exact right answer to how large entrance/exits need to be but to try see if someone with a limited knowledge and a search engine could easily see in advance that the entrance/exit to the love parade was dangerous. Even large venues can require evacuation in the case of a natural or manmade disaster. These disasters could be weather related as happened here here and here. In the case of man made safety risks venues also are sometimes evacuated. As described here
"On December 12, 2004, the stadium Santiago Bernabeu in Madrid was evacuated because of a bomb threat.... In eight minutes, more than 70,000 people left the premises without incident."
The respected Spiegel says
"Much of the critique has centered around the fact that the tunnel where the panic took place was the only entrance to and the only exit from the party site. "
If this tunnel was the only exit available (another tunnel seems to have been reserved for emergency vehicles) how quickly should people have been able to exit?
This soccer stadium with a capacity of over 25,000 claims 'The target evacuation time for the entire Stadium at full capacity is 8 minutes.'
This document on evacuation planning states
"The maximum Emergency Evacuation Time for sports ground varies between two and a half minutes and eight minutes"
Stadiums do not have as much free space as larger venues but they still allow for moving people onto the pitch as happened at a baseball game after the 1989 San Francisco earthquake. In the case of some natural disasters or terrorist threats a site wide evacuation might be needed so even large sites probably need to be able to be evacuated reasonably quickly.
The acceptable evacuation time for a stadium seems to be under ten minutes. If Spiegel is correct and this tunnel really was the only exit any evacuation would have taken hours which is not be acceptable.
The pictures here give a very good impression of what happened. The width of the tunnel does indeed look like 16 meters. And the 'ramp' described earlier just looks like something people tried to escape up rather than a designated route.
Wednesday, July 28, 2010
Monday, July 26, 2010
How many people can pass through a tunnel?
A tragedy happened at the love parade when 19 people lost their lives. This will be investigated by professionals who will come out with detailed analysis on how this incident took place. I want to see what someone in half an hours worth of searching can say about how wide a tunnel you need to fit that number of people.
I worked as a volunteer at the special Olympics some years ago. The job mainly involved making sure spectators could get into and out of the events easily, that emergency services can easily gain access and that spectators and athletes were kept separate. The venues were not huge and the spectators were happy and sober. Still I got some impression of the kinds of things needed to ensure crowd safety at events.
I want to put a figure on how many people could safely fit through the tunnel that was the sole access point to the love parade venue. A 16 meter width is given by most media outlets.
But some say it is 30 meters wide. Most seem to put the number of people there at 1.4 million but others at only 500,000 'an event set up for 250,000 ended up with an estimated 500,000 to 1 million'.
How long does it take to get everyone into a venue? How many people an hour will try enter a venue? I do not think all 1.4m people try enter in an hour. But I would guess most people try to enter a venue in a three hour period. Each hour you could expect over 300,000 people to try and enter through the tunnel. People are unpredictable meaning that you would need to be able to have more than this safely in case loads turn up at the same time.
Who else deals with crowd volumes like this? Every few years during the Muslim Hajj there is a crowd related accident. They are building a new bridge to improve safety. There is a description of this bridge here (pdf).
The engineers describe these 4 floors as at least 60 meters wide. Each 60 meters in width is supposed to handle .75 million people if scaled linearly to 16 meters that would be 200 thousand people during the day. The new Saudi bridge is designed with a much larger channel to move people than they had in Germany. Pilgrims may act differently to other crowds as they stop to perform religious ceremonies.
Another terrible crowd incident was the Hillsborough disaster where 96 people died. A quick search about football crowd safety found this document. It is a very interesting article and well worth a read
The document states
"the safety limit for crowd density is defined as 40 people in 10 square metres for a moving crowd" the tunnel at 16m wide and 100 meters long should only hold 6400 people. Walking at 38 meters per minute. 100 meters would mean it would take 156 seconds to get through the tunnel. 6400 people every 156 seconds is 147,000 in an hour. This means it would take ten hours for 1.4 million people to safely travel through.
Reuters here states
"Authorities have not yet been able to explain how exactly the tragedy happened -- near a tunnel that led to a ramp into the festival grounds. Most of the victims were found dead on the ramp and none in the tunnel, authorities said"
The football document also in Section '2.8 Wembley Complex Station' gives this equation
No. of Units of Exit Width = Number of Persons (1)
required (each width = 0.55m) Flow Rate (2) x Evacuation Time (3)
"Where number of persons (1) means the maximum number of people that could be expected to be on a platform at any time. Flow rate (2) means 40 persons per minute for escape routes incorporating stairs, and 60 persons per minute for level escape routes (without stairs). Passenger walking speeds should be assumed to be 38 metres per minute for horizontal circulation."
Using the Wembley equation above 16 meters *.55 meters means 29 people can safely span across the tunnel. 40 flow past a minute if the escape route has a stairs and 60 if it is flat. The ramp sounds like it would hinder flow in a similar way to a stairs.
Once again this is all back of the envelope and as more facts come out a much better estimate of how many people could safely negotiate the site will emerge. A reasonable estimate of the number of people who could travel through the tunnel in an hour is (tunnel width/person width)*number or people per minute * 60 minutes
which in a 16 meter wide tunnel with a stairs at the end is (16/.55)*40*60=70,000
Best case scenario with a wider tunnel and no stairs 30 meters/.55 meters *60 people *60=200,000 which is less than the expected number of people.
This calculation indicates that a cursory look at at the venue entrance would give someone grave concerns about safety for a smaller crowd than turned up on the day.
I worked as a volunteer at the special Olympics some years ago. The job mainly involved making sure spectators could get into and out of the events easily, that emergency services can easily gain access and that spectators and athletes were kept separate. The venues were not huge and the spectators were happy and sober. Still I got some impression of the kinds of things needed to ensure crowd safety at events.
I want to put a figure on how many people could safely fit through the tunnel that was the sole access point to the love parade venue. A 16 meter width is given by most media outlets.
But some say it is 30 meters wide. Most seem to put the number of people there at 1.4 million but others at only 500,000 'an event set up for 250,000 ended up with an estimated 500,000 to 1 million'.
How long does it take to get everyone into a venue? How many people an hour will try enter a venue? I do not think all 1.4m people try enter in an hour. But I would guess most people try to enter a venue in a three hour period. Each hour you could expect over 300,000 people to try and enter through the tunnel. People are unpredictable meaning that you would need to be able to have more than this safely in case loads turn up at the same time.
Who else deals with crowd volumes like this? Every few years during the Muslim Hajj there is a crowd related accident. They are building a new bridge to improve safety. There is a description of this bridge here (pdf).
the new, multi-level bridge structure which will accommodate and ease the flow of 3 million worshippers during a single daylight period. The proposed new Jamarat bridge is a superior structure formed of 4 platform levels... each of the bridge’s 4 floors is roughly 600 m-long, with variable widths (ranging from 60 m to 97 m
The engineers describe these 4 floors as at least 60 meters wide. Each 60 meters in width is supposed to handle .75 million people if scaled linearly to 16 meters that would be 200 thousand people during the day. The new Saudi bridge is designed with a much larger channel to move people than they had in Germany. Pilgrims may act differently to other crowds as they stop to perform religious ceremonies.
Another terrible crowd incident was the Hillsborough disaster where 96 people died. A quick search about football crowd safety found this document. It is a very interesting article and well worth a read
The document states
"the safety limit for crowd density is defined as 40 people in 10 square metres for a moving crowd" the tunnel at 16m wide and 100 meters long should only hold 6400 people. Walking at 38 meters per minute. 100 meters would mean it would take 156 seconds to get through the tunnel. 6400 people every 156 seconds is 147,000 in an hour. This means it would take ten hours for 1.4 million people to safely travel through.
Reuters here states
"Authorities have not yet been able to explain how exactly the tragedy happened -- near a tunnel that led to a ramp into the festival grounds. Most of the victims were found dead on the ramp and none in the tunnel, authorities said"
The football document also in Section '2.8 Wembley Complex Station' gives this equation
No. of Units of Exit Width = Number of Persons (1)
required (each width = 0.55m) Flow Rate (2) x Evacuation Time (3)
"Where number of persons (1) means the maximum number of people that could be expected to be on a platform at any time. Flow rate (2) means 40 persons per minute for escape routes incorporating stairs, and 60 persons per minute for level escape routes (without stairs). Passenger walking speeds should be assumed to be 38 metres per minute for horizontal circulation."
Using the Wembley equation above 16 meters *.55 meters means 29 people can safely span across the tunnel. 40 flow past a minute if the escape route has a stairs and 60 if it is flat. The ramp sounds like it would hinder flow in a similar way to a stairs.
Once again this is all back of the envelope and as more facts come out a much better estimate of how many people could safely negotiate the site will emerge. A reasonable estimate of the number of people who could travel through the tunnel in an hour is (tunnel width/person width)*number or people per minute * 60 minutes
which in a 16 meter wide tunnel with a stairs at the end is (16/.55)*40*60=70,000
Best case scenario with a wider tunnel and no stairs 30 meters/.55 meters *60 people *60=200,000 which is less than the expected number of people.
This calculation indicates that a cursory look at at the venue entrance would give someone grave concerns about safety for a smaller crowd than turned up on the day.
Tuesday, July 20, 2010
Science grows 2.5% annually why doesn't the economy?
What causes economic growth? Much of the world still lives in grinding poverty, figuring out a way to get them out of this is important. The best way seems to be for their economy to grow.
There are many theories as to what causes economic growth. The founder of Google claims
"Virtually all economic growth (in the world) was due to technological progress. I think as a society we're not really paying attention to that," Page said. "Science has a real marketing problem. If all the growth in world is due to science and technology and no one pays attention to you, then you have a serious marketing problem."
If technological progress causes growth there should be a link between the amount of scientific progress and the amount of growth. Here is a very interesting article about the rate of the increase in scientific knowledge.
'What I found, using this simple proxy for difficulty, in each field — biology, astronomy, chemistry — was a curve with the same basic shape. In every case, the ease of discovery went down, and in every case it was a curve called an exponential decay ...[I] discovered asteroids get 2.5 percent smaller each year. So while the ease of discovery drops off quickly as early researchers pick the low-hanging fruit, it can continue to “decay” a long time, becoming slightly harder without ever quite becoming impossible"
Say science increases in the level of knowledge by 2.5% a year.
What is the rate of economic growth? 'Since 1820, world development has been much more dynamic. Per capita income rose more than eightfold, population more than fivefold.' 190 years growth 8 fold increase is a growth rate of about 1.1% per annum. Or for two specific countries the UK from 1830 to 2008 had average real GDP 1.97%. The US 1830 to 2009 real GDP of 3.62%.
Other things cause economic growth
-Demographics more people of working age means more stuff gets made.
-Institutions. The rule of law matters. If people think anything the build will be plundered off them they wont build much.
-Governments. Some ways of running a country seem to result in more economic growth than others. Communism was never that good at creating economic growth for example.
-Taxation. At a certain point if you tax people too much they wont work anymore. If you dont tax people enough you might not be able to afford schools. Knowledge of what level of taxation is beneficial to economic growth should improve over time.
-Financial innovation. By getting capital to the people who best use it financial innovation is supposed to help economic growth. If it doesn't we should not spend money bailing out investment banks.
-Foreign aid: Aid to developing countries seems to have a mild positive effect on their economic growth rate though in specific areas it seems to have a negative effect
What else can affect economic growth and how great an effect does it have?
There are many theories as to what causes economic growth. The founder of Google claims
"Virtually all economic growth (in the world) was due to technological progress. I think as a society we're not really paying attention to that," Page said. "Science has a real marketing problem. If all the growth in world is due to science and technology and no one pays attention to you, then you have a serious marketing problem."
If technological progress causes growth there should be a link between the amount of scientific progress and the amount of growth. Here is a very interesting article about the rate of the increase in scientific knowledge.
'What I found, using this simple proxy for difficulty, in each field — biology, astronomy, chemistry — was a curve with the same basic shape. In every case, the ease of discovery went down, and in every case it was a curve called an exponential decay ...[I] discovered asteroids get 2.5 percent smaller each year. So while the ease of discovery drops off quickly as early researchers pick the low-hanging fruit, it can continue to “decay” a long time, becoming slightly harder without ever quite becoming impossible"
Say science increases in the level of knowledge by 2.5% a year.
What is the rate of economic growth? 'Since 1820, world development has been much more dynamic. Per capita income rose more than eightfold, population more than fivefold.' 190 years growth 8 fold increase is a growth rate of about 1.1% per annum. Or for two specific countries the UK from 1830 to 2008 had average real GDP 1.97%. The US 1830 to 2009 real GDP of 3.62%.
Other things cause economic growth
-Demographics more people of working age means more stuff gets made.
-Institutions. The rule of law matters. If people think anything the build will be plundered off them they wont build much.
-Governments. Some ways of running a country seem to result in more economic growth than others. Communism was never that good at creating economic growth for example.
-Taxation. At a certain point if you tax people too much they wont work anymore. If you dont tax people enough you might not be able to afford schools. Knowledge of what level of taxation is beneficial to economic growth should improve over time.
-Financial innovation. By getting capital to the people who best use it financial innovation is supposed to help economic growth. If it doesn't we should not spend money bailing out investment banks.
-Foreign aid: Aid to developing countries seems to have a mild positive effect on their economic growth rate though in specific areas it seems to have a negative effect
What else can affect economic growth and how great an effect does it have?
Monday, June 07, 2010
How scared should you be of nut allergies?
The wife today was selling nuts and parents kept telling her that nuts were banned in their kids school to prevent deaths from nut allergies. How many life years are saved from banning nuts in schools versus those lost through not eating nuts?
I will look at American figures as they are available and have a large sample, which are both handy. "about 150 people die annually from serious allergic food reactions" which compares with "2,000 children drown each year" according to here. So 150 people out of the 2.5 million who die each year in America die from some food allergy. Imagine all these people had 80 years left to live. You have lost 1200 human years.
Now if you happen to be the one with the allergy you would want some reasonable precautions taken. My argument here is a guesstimate on how the over anxiety about how nuts might affect us.
“We try to relieve anxiety about nut allergy by signs saying, ‘this is a nut free zone,’ which suggests that nuts are a clear and present danger,” Dr. Christakis said. “But in doing so, we increase the anxiety.” So imagine this sort of fear of nuts made everyone stop eating nuts. How many life years would be lost? "those eating nuts daily had up to 60% fewer heart attacks than those who ate nuts less than once per month". Given four hundred and fifty thousand people die each year from heart attacks. Preventing 60% of these would be 270 000 lives. Say you only saved one year off each of these that is 270000 life years as opposed to 1200 from banning nuts. This 60% figure seems really high but other studies show massive improvements here and here says '1 ounce of nuts more than 5 times/week can result in a 25 to 39 percent reduction in coronary heart disease risk among people whose characteristics match those of the general adult U.S. population'.
Now just because people who eat nuts don't get heart attacks does not mean the nuts stop the heart attacks. But the googleable studies take this correlation versus causation problem into account. Also banning nuts in schools and telling kids they might kill people wont stop all nuts being eaten. But its not hard to imagine these warnings will severely curtail nut eating.
Not many kids have nut allergies. So a blanket ban without good reason wont save many lives. There is good evidence eating nuts is very good for your health. It is reasonable to assume telling kids nuts could kill them wont encourage them to eat them.
I think this nut fear illustrates a problem many of us have with comparing sudden risks with long term risks. For example when schools ban running by kids because they might be sued but they ignore the long term health effects of kids not exercising. There are risks everywhere but when someone wants to minimise one it is worth asking how dangerous that risk is and what consequences minimising it will have.
I will look at American figures as they are available and have a large sample, which are both handy. "about 150 people die annually from serious allergic food reactions" which compares with "2,000 children drown each year" according to here. So 150 people out of the 2.5 million who die each year in America die from some food allergy. Imagine all these people had 80 years left to live. You have lost 1200 human years.
Now if you happen to be the one with the allergy you would want some reasonable precautions taken. My argument here is a guesstimate on how the over anxiety about how nuts might affect us.
“We try to relieve anxiety about nut allergy by signs saying, ‘this is a nut free zone,’ which suggests that nuts are a clear and present danger,” Dr. Christakis said. “But in doing so, we increase the anxiety.” So imagine this sort of fear of nuts made everyone stop eating nuts. How many life years would be lost? "those eating nuts daily had up to 60% fewer heart attacks than those who ate nuts less than once per month". Given four hundred and fifty thousand people die each year from heart attacks. Preventing 60% of these would be 270 000 lives. Say you only saved one year off each of these that is 270000 life years as opposed to 1200 from banning nuts. This 60% figure seems really high but other studies show massive improvements here and here says '1 ounce of nuts more than 5 times/week can result in a 25 to 39 percent reduction in coronary heart disease risk among people whose characteristics match those of the general adult U.S. population'.
Now just because people who eat nuts don't get heart attacks does not mean the nuts stop the heart attacks. But the googleable studies take this correlation versus causation problem into account. Also banning nuts in schools and telling kids they might kill people wont stop all nuts being eaten. But its not hard to imagine these warnings will severely curtail nut eating.
Not many kids have nut allergies. So a blanket ban without good reason wont save many lives. There is good evidence eating nuts is very good for your health. It is reasonable to assume telling kids nuts could kill them wont encourage them to eat them.
I think this nut fear illustrates a problem many of us have with comparing sudden risks with long term risks. For example when schools ban running by kids because they might be sued but they ignore the long term health effects of kids not exercising. There are risks everywhere but when someone wants to minimise one it is worth asking how dangerous that risk is and what consequences minimising it will have.
Monday, May 24, 2010
Eurovision Voting Fraud
Forget hanging chads in Florida. Some really important vote rigging is about to happen.
I was investigating the Eurovision Song Contest last week as a prediction problem. No really it is an area of major research into how corruption agreements implicitly develop between countries. There are papers here, here and here.
But then I saw the odds for this year and there is something really odd happening. The odds from Paddy Power are here
Azerbaijan 11/8
Germany 4/1
Israel 9/1
So Azerbaijan a country that no one can spell is hot favorite. Which would not be too suspicious if they had ever had a song that wasn't entirely made up of goats being strangled before. The singer Safura and her Drip Drop has her obvious talents on display but is there something odd going on here?
Wikipedia says
So why does an old soviet country, with a pretty dodgy political system, that is 95% Muslim want so badly to win the worlds gayest contest? Turns out its a giant fight with Armenia. There is a war going on between them using the Eurovision as a battleground. I cannot wait till they get Johnny Logan in as a peace negotiator.
The Azerbaijan state broadcaster blocked out the voting number for the 2009 Armenian entry like some corporate logos in a rap video. Then and you can only read this in a full Borat accent "in August 2009, a number of Azerbaijanis who had voted for Armenia's entry during the 2009 Contest were summoned for questioning at the Ministry of National Security in Baku, during which they were accused of being "unpatriotic" and "a potential security threat". One of those summoned, Rovshan Nasirli, said that he was told by his interrogators that they had the names and addresses of all 43 Azerbaijanis who had voted for Armenia".
What is the cause of all this? According to the over 2000 word wiki article on the "Armenia Azerbaijan relations in the Eurovision Song Contest" it is Nagorno-Karabakh an area they both claim.
So it looks like Azerbaijan are willing to buy masses of fake simcards, bus people to other countries, bribe students and track down a few dozen people who voted the 'wrong way'. I wonder what is going to happen this time now that they seem to take the eurovision seriously?
I was investigating the Eurovision Song Contest last week as a prediction problem. No really it is an area of major research into how corruption agreements implicitly develop between countries. There are papers here, here and here.
But then I saw the odds for this year and there is something really odd happening. The odds from Paddy Power are here
Azerbaijan 11/8
Germany 4/1
Israel 9/1
So Azerbaijan a country that no one can spell is hot favorite. Which would not be too suspicious if they had ever had a song that wasn't entirely made up of goats being strangled before. The singer Safura and her Drip Drop has her obvious talents on display but is there something odd going on here?
Wikipedia says
After the conclusion of 2009 Eurovision, it was reported in Belarusian media that unknown people had allegedly paid and bribed students from Belarus to vote for Azerbaijan in the contest, and had even transported them to the Belarusian-Lithuanian border in 10 buses. The cost of this alleged action was claimed to be about 55 million rubles. They purportedly voted for Azerbaijan using Belarusian SIM cards, and then received Lithuanian cards to repeat the process. The Azerbaijani entry "Always" received 10 points from Belarus and 5 points from Lithuania.
So why does an old soviet country, with a pretty dodgy political system, that is 95% Muslim want so badly to win the worlds gayest contest? Turns out its a giant fight with Armenia. There is a war going on between them using the Eurovision as a battleground. I cannot wait till they get Johnny Logan in as a peace negotiator.
The Azerbaijan state broadcaster blocked out the voting number for the 2009 Armenian entry like some corporate logos in a rap video. Then and you can only read this in a full Borat accent "in August 2009, a number of Azerbaijanis who had voted for Armenia's entry during the 2009 Contest were summoned for questioning at the Ministry of National Security in Baku, during which they were accused of being "unpatriotic" and "a potential security threat". One of those summoned, Rovshan Nasirli, said that he was told by his interrogators that they had the names and addresses of all 43 Azerbaijanis who had voted for Armenia".
What is the cause of all this? According to the over 2000 word wiki article on the "Armenia Azerbaijan relations in the Eurovision Song Contest" it is Nagorno-Karabakh an area they both claim.
So it looks like Azerbaijan are willing to buy masses of fake simcards, bus people to other countries, bribe students and track down a few dozen people who voted the 'wrong way'. I wonder what is going to happen this time now that they seem to take the eurovision seriously?
Friday, May 21, 2010
Craig Venter creates synthetic life form
There are stories about this everywhere. But one quote from wired sticks out
“Over the last five years the field has seen a 100-fold increase in the length of genetic material wholly constructed from raw chemicals,” said synthetic biologist Drew Endy of Stanford University. “This is over six doublings in the max length of a genome that can be constructed.”
Doubling in abilities in less than a year is amazing. Pretty much any exponential improvement like that ends up being a big deal if it carries on for a reasonable length of time. This is 1 million base pairs of synthetic DNA. A human is 3 billion base pairs. So at this growth rate that is less than 12 years. Not that you would artificially create a human or anything but it gives you some impression of how rapidly this technology could develop.
“Over the last five years the field has seen a 100-fold increase in the length of genetic material wholly constructed from raw chemicals,” said synthetic biologist Drew Endy of Stanford University. “This is over six doublings in the max length of a genome that can be constructed.”
Doubling in abilities in less than a year is amazing. Pretty much any exponential improvement like that ends up being a big deal if it carries on for a reasonable length of time. This is 1 million base pairs of synthetic DNA. A human is 3 billion base pairs. So at this growth rate that is less than 12 years. Not that you would artificially create a human or anything but it gives you some impression of how rapidly this technology could develop.
Sunday, May 02, 2010
NO DEPOSIT...NO WORRIES
If we do not learn our lesson from the property bubble and collapse we will wind up back in the same trouble again.
There is a semi ghost estate on my bus route. It is beside the M50 beside Finglas and an area called Scribblestown in murder news reports. The estate is opposite and beside a halting site.

This Heathfield estate seems less than half full. This week I noticed the sign they have flogging houses had a new banner on it. "NO DEPOSIT...NO WORRIES"

We have learned nothing.
There is a semi ghost estate on my bus route. It is beside the M50 beside Finglas and an area called Scribblestown in murder news reports. The estate is opposite and beside a halting site.
This Heathfield estate seems less than half full. This week I noticed the sign they have flogging houses had a new banner on it. "NO DEPOSIT...NO WORRIES"
We have learned nothing.
Tuesday, March 30, 2010
We Hate You. Please Save Us
There is an episode of the Simpson's where Springfield unites against Lisa Simpson who questions the veracity of an angel skeleton. In a very short time, the citizens launch a mob attack against the town's scientific institutions, Moe decides to destroy the skeleton of a woolly mammoth at the Springfield Natural History Museum, yelling "Take that, science!" Predictably, the tusk falls off, crushing him. "Oof, I'm paralyzed," observes Moe. "I only hope medical science can cure me."
Ireland will be saved by science. Here is a document from the Taoiseach about the new smart economy.
One main idea is to "invest heavily in research and development, incentivise multinational companies to locate more R&D capacity in Ireland, and ensure the commercialisation and retaining of ideas that flow from that investment;"
So how does Ireland treat science? Well take the LHC launched fully today. There is a great article here about the disdain this project is meet with by our government. We won't spend the 10 million annually that would make us a part of the project.
Not that no Irish people are helping out but they have to work with foreign research groups if they want to help figure out how the universe works.
“Nobody knows what is going to happen, that is why we are doing it,” stated Dr Steve Myers, the Irish physicist in charge of the largest atom smasher ever built.
So no 10 million annually out of a total of 6.5 billion it will cost to work out how the nature of the universe.
Irish scientists are not valued either. There is a poll of the greatest Irishmen of all time. There is no scientist on the list. Dr Noel Browne is the closest but he is there as a politician. No Walton, Robert Boyle or William Rowan Hamilton.
But you do have Joe Dolan, Colin Farrell, Stephen Gately, Ronan Keating, Daniel O'Donnell and Louis Walsh.

We have space for Daniel O'Donnell but not Nobel prize winner Ernest Walton. We don't have 10 million for CERN but we do have 32000 million for the governments friends.
What can you say? I'll leave it to another Nobel prizewinner
What need you, being come to sense,
But fumble in a greasy till
And add the halfpence to the pence
And prayer to shivering prayer, until
You have dried the marrow from the bone?
For men were born to pray and save:
Romantic Ireland's dead and gone,
September 1913
William Butler Yeats
Ireland will be saved by science. Here is a document from the Taoiseach about the new smart economy.
One main idea is to "invest heavily in research and development, incentivise multinational companies to locate more R&D capacity in Ireland, and ensure the commercialisation and retaining of ideas that flow from that investment;"
So how does Ireland treat science? Well take the LHC launched fully today. There is a great article here about the disdain this project is meet with by our government. We won't spend the 10 million annually that would make us a part of the project.
Not that no Irish people are helping out but they have to work with foreign research groups if they want to help figure out how the universe works.
“Nobody knows what is going to happen, that is why we are doing it,” stated Dr Steve Myers, the Irish physicist in charge of the largest atom smasher ever built.
So no 10 million annually out of a total of 6.5 billion it will cost to work out how the nature of the universe.
Irish scientists are not valued either. There is a poll of the greatest Irishmen of all time. There is no scientist on the list. Dr Noel Browne is the closest but he is there as a politician. No Walton, Robert Boyle or William Rowan Hamilton.
But you do have Joe Dolan, Colin Farrell, Stephen Gately, Ronan Keating, Daniel O'Donnell and Louis Walsh.

We have space for Daniel O'Donnell but not Nobel prize winner Ernest Walton. We don't have 10 million for CERN but we do have 32000 million for the governments friends.
What can you say? I'll leave it to another Nobel prizewinner
What need you, being come to sense,
But fumble in a greasy till
And add the halfpence to the pence
And prayer to shivering prayer, until
You have dried the marrow from the bone?
For men were born to pray and save:
Romantic Ireland's dead and gone,
September 1913
William Butler Yeats
Friday, March 19, 2010
Influential Books
Marginal revolution has an article on the 'books that influenced the me most'. There is a follow up article of others lists here.
No one in these lists seems to mention the Bible. And few the Odyssey and Iliad. Aesop and the brothers Grimm also seem to be ignored. Hansel and Gretel, Rapunzel, little red riding hood, Cinderella, Sleeping Beauty, Snow White, Rumpelstiltskin all come from one book. They are pretty much ubiquitious in the lives of children of my age even if they did not read the original.
Is it naive to think that these stories we heard as children probably influence our thinking far more than books read after our teenage years?
I seriously doubt there are many westeners who don't consider the three little pigs as a moral lesson more often than those from anarchy the state and utopia.
The most embarassing book most of the list writers will admit to is something by Ayn Rand which they now disown. But why is Atlas Shrugged allowable on the road to where they are but Rip Van Winkle and the works of Hans Christian Andersen's are ignored?
By most influential do we mean the book your willing to admit to that you think about while debating people? Rather than the ones that are so ingrained in our lives that they serve as a backbone to how society operates.
No one in these lists seems to mention the Bible. And few the Odyssey and Iliad. Aesop and the brothers Grimm also seem to be ignored. Hansel and Gretel, Rapunzel, little red riding hood, Cinderella, Sleeping Beauty, Snow White, Rumpelstiltskin all come from one book. They are pretty much ubiquitious in the lives of children of my age even if they did not read the original.
Is it naive to think that these stories we heard as children probably influence our thinking far more than books read after our teenage years?
I seriously doubt there are many westeners who don't consider the three little pigs as a moral lesson more often than those from anarchy the state and utopia.
The most embarassing book most of the list writers will admit to is something by Ayn Rand which they now disown. But why is Atlas Shrugged allowable on the road to where they are but Rip Van Winkle and the works of Hans Christian Andersen's are ignored?
By most influential do we mean the book your willing to admit to that you think about while debating people? Rather than the ones that are so ingrained in our lives that they serve as a backbone to how society operates.
Saturday, March 13, 2010
How much land do you drink?
Say you drink 35 liters a year of alcohol. 14 liters is the rather high amount the average Irish person does. There is a podcast here where Saul Griffith describes how due to carbon rationing in the future you will have to decide between a shower and a glass of wine each day. So the question of how much effort goes into each brew is important for the future where the amount of land and energy we consume may be heavily taxed and rationed.
What area of land do you need of a crop of apples, barley, wheat, potatoes, grapes or sugar to keep someone in booze for a year? There is a table here of the yield in terms of (kcal/sq m/year) each crop produces
Cane sugar 3500
Beet sugar 1990
Potatoes 1600
Apples 1500
Wheat, cereal 810
Corn 250
Milk 420
Beef 130
So in terms of calories per square meter Cane sugar seems to win. You do have to calculate how efficiently the calories in the crop get into alcohol in the booze you drink.
This guy tries get the alcohol out of sugar beat. "so the theoretical yield of ethanol produced is around 50%alc per weight of sugar"
Each square meter is 2000 kcal according to the earlier table. A kilo of sugar is 4000 kcal. So for 14 liters of alcohol is 28 kilos of sugar. 14 liters is what the Irish person drinks annually. So that is 56 square meters of sugar beat to keep you in (bad) booze for the year.
Now for cider.Say scrumpy is 6.5% abv then one liter of scrumpy is 65 ml of alcohol. So 14 liters is 215 liters of cider. Is that right? Does the average Irish person really drink the equivalant of a pint of scrumpy every day?
Anyway I want about 200 liters of cider which is about 400 kilos of apples. How much area of orchard do I need to get that many apples?
cider and apple juice are both about 400 calories per liter . Growing apples is 1500 kcal per square meter. I estimate 1/2 of that makes it into the juice which is 750kcal. Each liter is 400kcal so 200 liters is 80000 kcal. If a meter is 750 kcal after pressing etc then that is 106 meters squared to keep you in good alcohol for the year.
So back of the envelope it would take about 100 square meters of orchard to keep you in booze for the year.
4.5% Beer seems about 400 kcal per liter. And all grain is to be generous 75% efficient at getting out the sugars from grain. So each liter requires 533 kcal of grain very roughly. Wheat, cereal 810 kcal per square meter per year that is 2/3 of a meter square per liter of beer.
So how many liters of 4.5% beer is 14 liters of alcohol? It is about 310 liters of beer (which is a huge amount!) or back of the envelope 250 square meters of land to keep you in beer if you include malting loses.
Now wine. Each square meter grows about a kilo of grapes. As 1 acre grows about 5 tonnes according to here.
So 112 liters of wine is about 14 liters of alcohol.
3 kilos of grapes produce about 2 liters of wine from looking at various recipes. So 112 liters is about 170 kilos of grapes. So 112 liters is about 170 sq meters of vineyard. So you need about 170 square meters of grapes to keep you in booze for the year.
So in Ireland you could keep you in booze for a year of square meters you would need 56 sugar beat, 100 orchard, 250 barley and in france 170 grapes, roughly.
What area of land do you need of a crop of apples, barley, wheat, potatoes, grapes or sugar to keep someone in booze for a year? There is a table here of the yield in terms of (kcal/sq m/year) each crop produces
Cane sugar 3500
Beet sugar 1990
Potatoes 1600
Apples 1500
Wheat, cereal 810
Corn 250
Milk 420
Beef 130
So in terms of calories per square meter Cane sugar seems to win. You do have to calculate how efficiently the calories in the crop get into alcohol in the booze you drink.
This guy tries get the alcohol out of sugar beat. "so the theoretical yield of ethanol produced is around 50%alc per weight of sugar"
Each square meter is 2000 kcal according to the earlier table. A kilo of sugar is 4000 kcal. So for 14 liters of alcohol is 28 kilos of sugar. 14 liters is what the Irish person drinks annually. So that is 56 square meters of sugar beat to keep you in (bad) booze for the year.
Now for cider.Say scrumpy is 6.5% abv then one liter of scrumpy is 65 ml of alcohol. So 14 liters is 215 liters of cider. Is that right? Does the average Irish person really drink the equivalant of a pint of scrumpy every day?
Anyway I want about 200 liters of cider which is about 400 kilos of apples. How much area of orchard do I need to get that many apples?
cider and apple juice are both about 400 calories per liter . Growing apples is 1500 kcal per square meter. I estimate 1/2 of that makes it into the juice which is 750kcal. Each liter is 400kcal so 200 liters is 80000 kcal. If a meter is 750 kcal after pressing etc then that is 106 meters squared to keep you in good alcohol for the year.
So back of the envelope it would take about 100 square meters of orchard to keep you in booze for the year.
4.5% Beer seems about 400 kcal per liter. And all grain is to be generous 75% efficient at getting out the sugars from grain. So each liter requires 533 kcal of grain very roughly. Wheat, cereal 810 kcal per square meter per year that is 2/3 of a meter square per liter of beer.
So how many liters of 4.5% beer is 14 liters of alcohol? It is about 310 liters of beer (which is a huge amount!) or back of the envelope 250 square meters of land to keep you in beer if you include malting loses.
Now wine. Each square meter grows about a kilo of grapes. As 1 acre grows about 5 tonnes according to here.
So 112 liters of wine is about 14 liters of alcohol.
3 kilos of grapes produce about 2 liters of wine from looking at various recipes. So 112 liters is about 170 kilos of grapes. So 112 liters is about 170 sq meters of vineyard. So you need about 170 square meters of grapes to keep you in booze for the year.
So in Ireland you could keep you in booze for a year of square meters you would need 56 sugar beat, 100 orchard, 250 barley and in france 170 grapes, roughly.
Wednesday, March 03, 2010
Drug Delivery Service
I got a pamphlet in the door today offering a drug delivery service. The drugs are advertised as bath salts and plant food. Head shops selling these legal highs have been burned down in Dublin recently so this could be a way to avoid such attacks.


Sunday, February 14, 2010
The Perplexus Rocks
The perplexus is a 3-d maze where the aim is to move a ball around a series of obstacles. Makezine last issue had a great story on it here. The article described the journey from a school project through decades of effort to a toy and even a giant art piece.
There is an interview here with the creator Michael McGinnis. Usually my wife finds puzzles and games really boring but I have to keep fighting her to get a go on the perplexus. There is a page here on the history of the design. It shows some of the dedication and inventiveness that you can feel went into the puzzle when you play it.
It is not perfect, there are annoying etchings on the top that sometimes hinder viewing. It is slightly off spherical which is not what the designer wanted. It is made out of plastic like all toys. I presume trying to get this level of precision in wood would be nearly impossible. Still this is the best designed toy since the rubik's cube. Similar to the rubik's cube it is mainly aimed at children but not just for them.
This is really pretentious but the puzzle is like moving meditation. I cannot play this without feeling like part of zen and the art of motorcycle maintenance. You never get products anymore that have such obvious dedication built into them. Every step feels like some sort of Japanese mindfullness exercise. Basically the perplexus rocks. I got bought mine in the UK from here. The shipment to Ireland was really quick. You can get it from America here
Wednesday, January 13, 2010
Analytics X Prize Outside Bets
Black swans are not predictable but are there fairly rare events that could coour this year in Philadelphia that would skew the homicide rate in an area?
I know of nothing that would cause a sudden drop in the number of homicides in one particular area. Except a mass evacuation. There are a few things that could show up as a sudden rise though.
Terrorist attack. Philadelphia is not a well known terrorist target so any attack there would have to be pretty unpredictable. Terrorist attacks are also very rare so I do not think worth considering in a model.
Going Postal: These seem common enough in America. They have their own list here. I doubt you can predict where they will occur though. Might be worth considering.
Religious nutjobs:The solar temples and the kool aid drinkers in general tend to head off into the sticks before topping each other. So I think there is not much chance of a mass homicide by a cult in
Philadelphia.
Riots:Cities kick off on a fairly regular basis, The LA riots in 1992 resulted in 53 deaths for example. Philadelphia has had riots in the past. Riots in America seem to be mainly caused by racial tension. It might be possible to if not predict them localise where they are most likely to occur. Then submit a higher homicide count for that area in one of the analytics x prize submissions as an outside bet.
Prisoneers: They love a good ruck. In general prison populations have a higher homicide rate. So looking at changes in prisoner ecosystem in Philadelphia might be worth a look
Natural Disasters:After natural disaster people generally think the world turns into something from a Romero film.
The evidence for this is not that strong for example tales of post Katrina anarchy seem to be overblown. Also natural disasters could reduce the homicide rate as people leave an area after one. Philadelphia is unlikely to undergo a natural disaster though.
There are rare events that still occur often enough to make some sort of prediction on. I do not think any of these is worth including in a model with the possible exception of a riot. But predicting that would need more information about riots and Philadelphia than I have at the moment.
I know of nothing that would cause a sudden drop in the number of homicides in one particular area. Except a mass evacuation. There are a few things that could show up as a sudden rise though.
Terrorist attack. Philadelphia is not a well known terrorist target so any attack there would have to be pretty unpredictable. Terrorist attacks are also very rare so I do not think worth considering in a model.
Going Postal: These seem common enough in America. They have their own list here. I doubt you can predict where they will occur though. Might be worth considering.
Religious nutjobs:The solar temples and the kool aid drinkers in general tend to head off into the sticks before topping each other. So I think there is not much chance of a mass homicide by a cult in
Philadelphia.
Riots:Cities kick off on a fairly regular basis, The LA riots in 1992 resulted in 53 deaths for example. Philadelphia has had riots in the past. Riots in America seem to be mainly caused by racial tension. It might be possible to if not predict them localise where they are most likely to occur. Then submit a higher homicide count for that area in one of the analytics x prize submissions as an outside bet.
Prisoneers: They love a good ruck. In general prison populations have a higher homicide rate. So looking at changes in prisoner ecosystem in Philadelphia might be worth a look
Natural Disasters:After natural disaster people generally think the world turns into something from a Romero film.
The evidence for this is not that strong for example tales of post Katrina anarchy seem to be overblown. Also natural disasters could reduce the homicide rate as people leave an area after one. Philadelphia is unlikely to undergo a natural disaster though.
There are rare events that still occur often enough to make some sort of prediction on. I do not think any of these is worth including in a model with the possible exception of a riot. But predicting that would need more information about riots and Philadelphia than I have at the moment.
Tuesday, January 12, 2010
Survey the people of Philadelphia
In order to tell if a zip code in Philadelphia is getting more dangerous maybe we should ask people who live there.
So I created a survey here to ask them here. If you are or know someone living in Philadelphia if you could fill that out it would be great.
The idea is to find areas people think are changing in safety and see this turns out to help predict homicides. If it does this could be used to focus police resource in future to help reduce homicides.

I will release any data that is input as I am not the best person to do analysis on them. People going to the effort to submit a survey deserve to get the most out they possible. I will anonymise any data that does contain personal info before releasing it. There shouldn't be any info like this but I will check through the data in case.
I think ideally such a survey would let user place pins in a map in areas they think are improving/disimproving. Any thoughts on the survey? Or the idea of asking people for their local predictions in general?
So I created a survey here to ask them here. If you are or know someone living in Philadelphia if you could fill that out it would be great.
The idea is to find areas people think are changing in safety and see this turns out to help predict homicides. If it does this could be used to focus police resource in future to help reduce homicides.
I will release any data that is input as I am not the best person to do analysis on them. People going to the effort to submit a survey deserve to get the most out they possible. I will anonymise any data that does contain personal info before releasing it. There shouldn't be any info like this but I will check through the data in case.
I think ideally such a survey would let user place pins in a map in areas they think are improving/disimproving. Any thoughts on the survey? Or the idea of asking people for their local predictions in general?
Monday, January 11, 2010
Analytics X Prize
There is a competition here to try and predict what proportion of murders in Philadelphia will occur in each of the cities 47 zip codes. Many people who are interested in these sorts of puzzles have started submitting predictions.
So how would you go about predicting the murder proportion in each zip code?
Well if nothing changes in Philadelphia you would expect each zip code to keep exactly the same proportion of murders, well with some random variation you could not predict. So my first guess is a repeat of exactly what happened last year.
But in the real world things do change. Say the population changes if every person had the same chance of being murdered then the proportion of murders in a zip code would change proportionate to the change in population. If this was the case the prediction problem would become to find out what changes in population will take place over the year.

The dataset I am using is here and some errors in it need to be removed. Each dot is a zip code. It looks like number of murders does roughly follow population but it is not nearly an exact match. So changes in population are important but they are far from the only thing we need to predict.
How expensive the house in an area are or the average income or the number of people per house might help indicate the murder rate. Here I am looking at number of (murders/population)*10000.

So it looks to me a bit like areas with crowded houses could be more likely to have murders.

House cost looks like it is not connected to murder rate. This could be because zip code is too rough grained for this to be a good judge. Maybe the average cost of a house in a block would be a better measure of risk. Philadelphia has even been broken down into 60ft squares here

Does household income look like it is related to murder rate?
So if the graph is a random scattering of dots then it looks like the independant variable on the x-axis has no relation to homicide rate the dependant variable on the y-axis. If the dots form a line (well not just a line but that is another story) then the homicide rate may be related to that independant variable. It really is not this simple but that's the basics.

As Siah pointed out here young black males seem to be murdered out of proportion. The graph above does seem to suggest that predicting changes in ethnicity of a zip code may improve predictions. Age is another important variable and I do not have data on that so that might be the next thing to get.
There are interesting posts already on this puzzle
"Evaluating Spatial Predictions" and "Second Pass at Analytics X Prize" and "Homicides as non homogeneous poisson processes" are very informative.
So how would you go about predicting the murder proportion in each zip code?
Well if nothing changes in Philadelphia you would expect each zip code to keep exactly the same proportion of murders, well with some random variation you could not predict. So my first guess is a repeat of exactly what happened last year.
But in the real world things do change. Say the population changes if every person had the same chance of being murdered then the proportion of murders in a zip code would change proportionate to the change in population. If this was the case the prediction problem would become to find out what changes in population will take place over the year.

The dataset I am using is here and some errors in it need to be removed. Each dot is a zip code. It looks like number of murders does roughly follow population but it is not nearly an exact match. So changes in population are important but they are far from the only thing we need to predict.
How expensive the house in an area are or the average income or the number of people per house might help indicate the murder rate. Here I am looking at number of (murders/population)*10000.

So it looks to me a bit like areas with crowded houses could be more likely to have murders.

House cost looks like it is not connected to murder rate. This could be because zip code is too rough grained for this to be a good judge. Maybe the average cost of a house in a block would be a better measure of risk. Philadelphia has even been broken down into 60ft squares here

Does household income look like it is related to murder rate?
So if the graph is a random scattering of dots then it looks like the independant variable on the x-axis has no relation to homicide rate the dependant variable on the y-axis. If the dots form a line (well not just a line but that is another story) then the homicide rate may be related to that independant variable. It really is not this simple but that's the basics.

As Siah pointed out here young black males seem to be murdered out of proportion. The graph above does seem to suggest that predicting changes in ethnicity of a zip code may improve predictions. Age is another important variable and I do not have data on that so that might be the next thing to get.
There are interesting posts already on this puzzle
"Evaluating Spatial Predictions" and "Second Pass at Analytics X Prize" and "Homicides as non homogeneous poisson processes" are very informative.
Thursday, December 10, 2009
Dublin pubs and the El Farol Bar problem
I was in town last night and i noticed how empty the superpubs were. these are the giant warehouse like pubs that need to be packed all the time to pay for the giant rents they have.
They also need to be full to make it look like they are not just giant warehouses. This is a version of the El Farol Bar problem. The game theory is this
* If less than X% of the population go to the bar, It will be too empty and they'll all have a worse time than if they stayed at home.
* If more than X% of the population go to the bar, they'll all have a better time than if they stayed at home.
People realise the pubs will be empty so no one goes. It is a positive feedback problem. Which means these big pubs are in big trouble.
They also need to be full to make it look like they are not just giant warehouses. This is a version of the El Farol Bar problem. The game theory is this
* If less than X% of the population go to the bar, It will be too empty and they'll all have a worse time than if they stayed at home.
* If more than X% of the population go to the bar, they'll all have a better time than if they stayed at home.
People realise the pubs will be empty so no one goes. It is a positive feedback problem. Which means these big pubs are in big trouble.
Monday, November 30, 2009
Human Nutrient Needs
What nutrients does a person need per day?
I am not a dietician or indeed sober so don't take this as actual advice. But what does ten minutes googling give as a list of the needed nutrients?
This is item 1 of the list of things to do for a modern version of Stigler's diet. Wikipedia the universal source of all truth (TM) italic has an article on this here.
It gives the RDA for an average 25-year old male (for ones that use IU which appears to be nonsense so I have taken some figures from here and here)
all figures are in µg
And the upper limit as
The figures we are interested in are RDA's which must be met and Tolerable upper intake levels which cannot be exceded.
Macro nutrients are in grams
Also some nutrients must be minimised Cholesterol, Trans fatty acids, Saturated fatty acids. These will have to be aims of a optimiser for diets.
These are a bit more difficult to deal with so I will ignore them for the moment.
Cholesterol As low as possible
Trans fatty acids As low as possible
Saturated fatty acids As low as possible
Also two types of macro nutrients must be a % of calories.
Added sugar No more than 25% of calories
Fat 20–35% of calories
I am going to guess a 25 year old male needs 2500 calories until I am corrected.
So we have a first approximation of what nutrients people need.
So next up is getting a price and nutrient contents for loads of different foods.
I am not a dietician or indeed sober so don't take this as actual advice. But what does ten minutes googling give as a list of the needed nutrients?
This is item 1 of the list of things to do for a modern version of Stigler's diet. Wikipedia the universal source of all truth (TM) italic has an article on this here.
It gives the RDA for an average 25-year old male (for ones that use IU which appears to be nonsense so I have taken some figures from here and here)
all figures are in µg
param RDA:=
Vitamin_A 900
Vitamin_C 90000
Vitamin_D 5
Vitamin_K 120
Vitamin_B6 1300
Vitamin_E 15000
Biotin 30
Calcium 1000000
Chloride 2300000
Chromium 35
Choline 550000
Copper 900
Cyanocobalamin 2.4
Fluoride 4000
Folate 400
Iodine 150
Iron 8000
Magsium 400000
Mangase 2300
Molybdenum 45
Niacin 16000
Nickel 1000
Pantothenic_acid 5000
Phosphorus 700000
Potassium 4700000
Riboflavin 1300
Selenium 55
Sodium 1500000
Thiamin 1200
Zinc 11000
;
And the upper limit as
param UL:=
Vitamin_A 3000
Vitamin_C 2000000
Vitamin_D 50
Vitamin_B6 100000
Vitamin_E 1000000
Boron 20000
Calcium 2500000
Chloride 3600000
Choline 3500000
Copper 10000
Fluoride 10000
Folate 1000
Iodine 1100
Iron 45000
Magsium 350000
Mangase 11000
Molybdenum 2000
Niacin 35000
Nickel 1000
Phosphorus 4000000
Selenium 400
Sodium 2300000
Zinc 40000
;
The figures we are interested in are RDA's which must be met and Tolerable upper intake levels which cannot be exceded.
Macro nutrients are in grams
param Macro:
Waterb 3700
Carbohydrates 130
Proteinc 56
Fiber 38
Linoleic 17
alpha-Linolenic 1.6
end;
Also some nutrients must be minimised Cholesterol, Trans fatty acids, Saturated fatty acids. These will have to be aims of a optimiser for diets.
These are a bit more difficult to deal with so I will ignore them for the moment.
Cholesterol As low as possible
Trans fatty acids As low as possible
Saturated fatty acids As low as possible
Also two types of macro nutrients must be a % of calories.
Added sugar No more than 25% of calories
Fat 20–35% of calories
I am going to guess a 25 year old male needs 2500 calories until I am corrected.
So we have a first approximation of what nutrients people need.
So next up is getting a price and nutrient contents for loads of different foods.
Sunday, November 29, 2009
The Diet Problem
What is the cheapest way to feed yourself? This is not a minor issue our diets and health could be much better if they were optimised to provide the most needed nutrients at the smallest cost and also to provide the most palatable diet that is as healthy as possible.
Stigler in 1939 worked out a near optimal miminum price needed to supply a person with the nutrients they need for a year. The diet consists of five not very pleasant foods so is not intended to be realistic dietry advice.
Still given current knowledge of nutrition a list of prices from various supermarkets could you optimise you shopping basket to provide your family with groceries? Here we want to give people the nutrients they need in a form they will actually eat that is healthy and cheap.
We need a list of
1. What nutrients are needed by a person
2. Foods preferences of people.
3. A price list of foods
4. A Linear program to optimize a shopping basket based on these variables.
All of these requirements need some explanation. I think its best if each gets it's own post. So tomorrow I will have a post on what quantities of nutrients people require. If you have any suggestions please comment.
Stigler in 1939 worked out a near optimal miminum price needed to supply a person with the nutrients they need for a year. The diet consists of five not very pleasant foods so is not intended to be realistic dietry advice.
Still given current knowledge of nutrition a list of prices from various supermarkets could you optimise you shopping basket to provide your family with groceries? Here we want to give people the nutrients they need in a form they will actually eat that is healthy and cheap.
We need a list of
1. What nutrients are needed by a person
2. Foods preferences of people.
3. A price list of foods
4. A Linear program to optimize a shopping basket based on these variables.
All of these requirements need some explanation. I think its best if each gets it's own post. So tomorrow I will have a post on what quantities of nutrients people require. If you have any suggestions please comment.
Sunday, November 15, 2009
215 is the first Wikipedia dull number
I have always wanted my own constant and now for a short period I have one. Imagine numbers were 'interesting' or 'dull'. The first dull number would be interesting because it was the first dull number so no dull number can exist. So all number are interesting.
Now you would think any interesting number would be notable enough to have its own wikipedia page. The first number without a wikipedia page is 215. This should be notable enough to deserve a wikipedia page. So as long as 215 has no wikipedia page it is dull and thus as the first non notable number it is notable. The paradoxes of wikipedia notability were brought up here.
Now you would think any interesting number would be notable enough to have its own wikipedia page. The first number without a wikipedia page is 215. This should be notable enough to deserve a wikipedia page. So as long as 215 has no wikipedia page it is dull and thus as the first non notable number it is notable. The paradoxes of wikipedia notability were brought up here.
Sunday, November 08, 2009
Counting money across cultures
One great bit in the execrable Inglorious Basterds was where someone noticed that Germans and British people make the sign for three in different ways. I love these cultural comparisons that show how arbitrary much of what we do is. I looked at information from laces here
This is a video showing how money is counted in different countries.
How People Count Cash? - Click here for more free videos
I have heard Japanese people ring out clothes differently to the rest of the world but can find no evidence of this in spite of asking a few of them. Do you know of any other cultural differences?
This is a video showing how money is counted in different countries.
How People Count Cash? - Click here for more free videos
I have heard Japanese people ring out clothes differently to the rest of the world but can find no evidence of this in spite of asking a few of them. Do you know of any other cultural differences?
Thursday, October 29, 2009
Matchbox Maths Games
There is a great article here on Matches on India. No really read it.
The article then suggests using the matchboxes to spread public health messages
I would recommend selling the glamor of flushing toilets and chimneys and such rather than nagging in your images. But i do not know enough about rural Indians and their diseases to advise on what health images to provide them. There are some interesting studies on what does kill these people here.
However what if all you put on the boxes was games? Many people have a ludic philosophy of life. You see a love of games in maths nerds in particular. This love of games I believe adds a cognitive richness that aids intellectual development.
There is a great book called "everything bad is good for you". That claims the increase in IQ in recent decades is due to increased complexity in our culture. I have not studied the Flynn effect enough to be sure it is not caused by nutrition or even to be sure it is important. But I will assume it is and that intellectual challenges improve general cognitive abilities. I will go further out on a limb and claim that such improvements in cognitive abilities would aid rural Indians. Never having been a rural Indian this really is a big assumption.
So what intellectual challenges could fit on a matchbox and be read by an illiterate farmer? How about puzzles and games?
There are some face meltingly brilliant match puzzles here(pdf). Other then puzzles there are games like NIM, dots and boxes, chomp and loads of others you can play with matches. I would imagine if a brand of matches has a game on it that keeps the kids from bothering you this would be a popular feature.
So can you think of some way to explain a puzzle or the rules of a game on a matchbox without using text? Do you think it really could be useful to put mathematical games and puzzles on matchboxes?
In fact, 97% of rural households purchase matches on a monthly basis. Matches are a unique product because of their high, constant demand and low price point.Their ubiquitous presence provides fascinating insights into India's rural distribution networks, and offer potential ways to inform and interact with India's relatively untouched market.
The article then suggests using the matchboxes to spread public health messages
What if that space was used to relay information? Imagine the possibilities of spreading new health/educational information or advertising to 97% of rural families on a monthly basis. Simple pictorial designs would pique interest and accommodate India's vast differences in literacy rates and languages. Awareness of important topics such as the installation of chimneys to reduce smoke inhalation or cleaning and covering water containers to prevent stomach ailments could be spread to households across India, and potentially save lives
I would recommend selling the glamor of flushing toilets and chimneys and such rather than nagging in your images. But i do not know enough about rural Indians and their diseases to advise on what health images to provide them. There are some interesting studies on what does kill these people here.
However what if all you put on the boxes was games? Many people have a ludic philosophy of life. You see a love of games in maths nerds in particular. This love of games I believe adds a cognitive richness that aids intellectual development.
There is a great book called "everything bad is good for you". That claims the increase in IQ in recent decades is due to increased complexity in our culture. I have not studied the Flynn effect enough to be sure it is not caused by nutrition or even to be sure it is important. But I will assume it is and that intellectual challenges improve general cognitive abilities. I will go further out on a limb and claim that such improvements in cognitive abilities would aid rural Indians. Never having been a rural Indian this really is a big assumption.
So what intellectual challenges could fit on a matchbox and be read by an illiterate farmer? How about puzzles and games?
There are some face meltingly brilliant match puzzles here(pdf). Other then puzzles there are games like NIM, dots and boxes, chomp and loads of others you can play with matches. I would imagine if a brand of matches has a game on it that keeps the kids from bothering you this would be a popular feature.
So can you think of some way to explain a puzzle or the rules of a game on a matchbox without using text? Do you think it really could be useful to put mathematical games and puzzles on matchboxes?
Wednesday, October 28, 2009
A work sceduling problem
I saw this problem recently
A GLPK program to calculate this is
The answer is 19 and no one starts working at 8am.
This is a simplified version of the program described here. Not a major revelation or anything but always find these puzzle solving programs cool.
A city authority is considering placing a toll booth on its new bridge. The beginning
times for the shifts are 8am, noon, 4pm, 8pm, midnight and 4am. A collector
beginning a shift at one of the above times works for the next 8 hours.
The following staffing levels during each of the 24-hour periods have been estimated
Hour.................... Minimum Collectors Needed
8am - Noon.............. . 5
Noon – 4pm ................6
4pm – 8pm .................10
8pm - Midnight........... .7
Midnight – 4am ...........4
4am – 8am .................6
Find the minimum number of collectors that need to be hired to begin the 8 hour shifts
at each of the six times.
A GLPK program to calculate this is
var x1 >= 0, integer;
var x2 >= 0, integer;
var x3 >= 0, integer;
var x4 >= 0, integer;
var x5 >= 0, integer;
var x6 >= 0, integer;
/* objective function */
minimize z: x1+x2+x3+x4+x5+x6;
/* Constraints */
s.t. ctr1:x1 + x6 >= 5;
s.t. ctr2:x1+x2>= 6;
s.t. ctr3:x2+x3>= 10;
s.t. ctr4:x3+x4>= 7;
s.t. ctr5:x4+x5>= 4;
s.t. ctr6:x5+x6>= 6;
data;
end;
The answer is 19 and no one starts working at 8am.
This is a simplified version of the program described here. Not a major revelation or anything but always find these puzzle solving programs cool.
Sunday, October 18, 2009
Prediction with game theory
I am going to this talk on Thursday so I am reading the book Predictioneer by Bruce Bueno De Mesquita. He has a ted talk video on his prediction ideas.
The use of game theory in forecasting seems based on the axiom that people are rational. The problem is they are not, here is a list of the different ways they are not. If you know how they are going to be irrational you can alter your models to take this into account. However if you fail to do this you will end up with less accurate models.
In chapter 2 the book claims people are rational and particularly that we are transitive in our preferences. "to be rational.. their preferences must not go in circles. For instance if I like chocolate ice cream better then vanilla and vanilla better then strawberry i presumably like chocolate ice cream better than strawberry." So no rock paper scissors can exist in human preferences.
The problem is they do. There is loads of evidence that people can have intransitive preferences. For example May showed in 1952 that people can have intransitive preferences for wealth, looks and intelligence in a partner. So how can you have a mathematical system modeling the world where one of your axioms is false?
While on the subject of intransitive never play dice with Warren Buffet. There are loads of stories of how he tries to con people with a set of intransitive dice. Edward Thorpe for example. Or Bill Gates as described in Bill Gates Speaks: Insight from the World's Greatest Entrepreneur By Janet Lowe
Buffet once attempted to win a game of dice with Bill Gates using intransitive dice. "Buffet suggested each would choose one dice and discard the other two. They would bet on who would roll the highest number most often. Buffet offered to let Gates pick first. This suggestion instantly aroused Gates curiosity. He asked to examine the dice after which he demanded buffet choose first."
The use of game theory in forecasting seems based on the axiom that people are rational. The problem is they are not, here is a list of the different ways they are not. If you know how they are going to be irrational you can alter your models to take this into account. However if you fail to do this you will end up with less accurate models.
In chapter 2 the book claims people are rational and particularly that we are transitive in our preferences. "to be rational.. their preferences must not go in circles. For instance if I like chocolate ice cream better then vanilla and vanilla better then strawberry i presumably like chocolate ice cream better than strawberry." So no rock paper scissors can exist in human preferences.
The problem is they do. There is loads of evidence that people can have intransitive preferences. For example May showed in 1952 that people can have intransitive preferences for wealth, looks and intelligence in a partner. So how can you have a mathematical system modeling the world where one of your axioms is false?
While on the subject of intransitive never play dice with Warren Buffet. There are loads of stories of how he tries to con people with a set of intransitive dice. Edward Thorpe for example. Or Bill Gates as described in Bill Gates Speaks: Insight from the World's Greatest Entrepreneur By Janet Lowe
Buffet once attempted to win a game of dice with Bill Gates using intransitive dice. "Buffet suggested each would choose one dice and discard the other two. They would bet on who would roll the highest number most often. Buffet offered to let Gates pick first. This suggestion instantly aroused Gates curiosity. He asked to examine the dice after which he demanded buffet choose first."
Friday, October 16, 2009
Boy in Balloon, did the balloon have enough lift?
I love this story, it reminds me of the time myself and my dad nearly burned down the house. We made a tinfoil hot air balloon with a gas camping cooker to power it. The cooker was tipped onto the lino and the melting began. It was my mums fault for leaving us alone in the house together. In general I love these homemade balloon stories, like Larry Walters across California.
Could we have told in advance it was a haox? "Few had raised the issue of whether such a balloon could even lift off with a 50-pound kid inside, and then float the way it did"
So how big was the balloon? "Authorities said the silver balloon, 20-feet long and 5-feet high, at times reached 7,000 feet above the ground while adrift. It was found more than 90 minutes later in a field near Colorado Springs."
Then it would have a diameter of 6 meters and a height of 1.5m high. Taking the balloon as a cylinder then according to here would give it a volume of 42.5 cubic meters.

Gross Lift (Helium) = Volume (cubic meters)*1.05kg
So 42.5 * 1.05=44.625 kg lift.
Now that seems just within the bounds of possibility as the kid weights about 20 kilos and the balloon itself should be light. But could the balloon have gotten to a height of 2000 meters? There are all sorts of tables for these I might work it out later
Another site gives "Helium provides about 9.8 newtons of lift per cubic meter, at sea level and room temperature. That's enough to lift 1kg". So 20 kilos would require 20 meters squared to lift it. Same result as before.
Thanks to the best program on Television we know how many balloons it takes to lift a small child.
"It would require such a large number of balloons (3,500) to lift an average four-year-old girl of 44 pounds (20 kg) just a few feet off the ground that there is no way the myth could have happened unintentionally."
Update: Wired have an article here about how people should have realised the balloon was empty. Their estimation of the carrying capacity of the balloon is similar to mine. they point out that the balloon does not move like it has a heavy weight hanging from the bottom of it.
Could we have told in advance it was a haox? "Few had raised the issue of whether such a balloon could even lift off with a 50-pound kid inside, and then float the way it did"
So how big was the balloon? "Authorities said the silver balloon, 20-feet long and 5-feet high, at times reached 7,000 feet above the ground while adrift. It was found more than 90 minutes later in a field near Colorado Springs."
Then it would have a diameter of 6 meters and a height of 1.5m high. Taking the balloon as a cylinder then according to here would give it a volume of 42.5 cubic meters.
Gross Lift (Helium) = Volume (cubic meters)*1.05kg
So 42.5 * 1.05=44.625 kg lift.
Now that seems just within the bounds of possibility as the kid weights about 20 kilos and the balloon itself should be light. But could the balloon have gotten to a height of 2000 meters? There are all sorts of tables for these I might work it out later
Another site gives "Helium provides about 9.8 newtons of lift per cubic meter, at sea level and room temperature. That's enough to lift 1kg". So 20 kilos would require 20 meters squared to lift it. Same result as before.
Thanks to the best program on Television we know how many balloons it takes to lift a small child.
"It would require such a large number of balloons (3,500) to lift an average four-year-old girl of 44 pounds (20 kg) just a few feet off the ground that there is no way the myth could have happened unintentionally."
Update: Wired have an article here about how people should have realised the balloon was empty. Their estimation of the carrying capacity of the balloon is similar to mine. they point out that the balloon does not move like it has a heavy weight hanging from the bottom of it.
Wednesday, September 16, 2009
NAMA, how much is 54 billion euro?
Nama, the Irish governemts agency to take on bad loans, is paying 54 billion euro to buy property. How much money is that? There is a great visualisation here about how much is a trillion.
So lets picture Croke Park. Its pitch is 144.5 m x 88m. That is much bigger then a soccer or rugby pitch. A 20 euro note is 133 × 72 milimiters. So to pave Croke Park pitch with 20 euro notes requires. So that is 1087 notes long 1223 wide or 1,329,401 notes are needed to pave croke park pitch in 20 euro notes. So that is roughly 2 layers of 20 euro notes being 54 million and paving it two notes deep. A billion is a thousand million so 54 billion is 1000 times this. So 54 billion is paving Croke Park in 20 euro notes 2000 deep.
So if your looking at the game on Sunday imagine there is a 20,000 euro pile of cash on the pitch that you now owe. That is 54 billion divided among the people who pay tax. So you and the person sitting next to you owe a 2000 deep 20 euro sized chunk of the Croke Park pitch.
A comment vaguely asked how much euro coin is this? "Did you know its also enough Euros placed end to end to reach the moon". According to here a 2 euro coin has
Thickness (mm): 2.20
Weight (g): 8.50
So 27 billion 2 euro coins are needed. So in weight that is 229.5 million kilos.
"The maximum gross mass for a 20 ft (6.1 m) dry cargo container is 30,480 kg" so that is 7540 containers full of 2 euro coins.
How long would the stack be? 2.2 * 27 billion millimeters = 59 400 kilometers. Or enough to go around the earth one and a half times. But less than a fifth the distance to the moon.
So lets picture Croke Park. Its pitch is 144.5 m x 88m. That is much bigger then a soccer or rugby pitch. A 20 euro note is 133 × 72 milimiters. So to pave Croke Park pitch with 20 euro notes requires. So that is 1087 notes long 1223 wide or 1,329,401 notes are needed to pave croke park pitch in 20 euro notes. So that is roughly 2 layers of 20 euro notes being 54 million and paving it two notes deep. A billion is a thousand million so 54 billion is 1000 times this. So 54 billion is paving Croke Park in 20 euro notes 2000 deep.
So if your looking at the game on Sunday imagine there is a 20,000 euro pile of cash on the pitch that you now owe. That is 54 billion divided among the people who pay tax. So you and the person sitting next to you owe a 2000 deep 20 euro sized chunk of the Croke Park pitch.
A comment vaguely asked how much euro coin is this? "Did you know its also enough Euros placed end to end to reach the moon". According to here a 2 euro coin has
Thickness (mm): 2.20
Weight (g): 8.50
So 27 billion 2 euro coins are needed. So in weight that is 229.5 million kilos.
"The maximum gross mass for a 20 ft (6.1 m) dry cargo container is 30,480 kg" so that is 7540 containers full of 2 euro coins.
How long would the stack be? 2.2 * 27 billion millimeters = 59 400 kilometers. Or enough to go around the earth one and a half times. But less than a fifth the distance to the moon.
Tuesday, September 15, 2009
Ask the waiter
If you want to know what someone is like ask their waiter. Because as a waiter you are far down the social rung anyone who is just a poseur treats you like dirt. Keith Floyd who died yesterday used to come into an Indian restaurant I worked in. He was much quieter then his media image and a complete gent. As was Liam Neeson BTW. I am not claiming to have known him just that he always treated the waiters well, which I believe is a good sign about someone.
Belinda Carlisle owes me a set of cutlery, she may think I have forgotten but I haven't. She promised she would bring them back and didn't. Try saying "if you cannot trust the singer of the Go-Go's, who can you trust?" to a middle aged Bangladeshi and see if your wages don't get docked.
Apart from an unfortunately forgetful singer I have a long list of who is a complete wanker. I'll post that again.
Belinda Carlisle owes me a set of cutlery, she may think I have forgotten but I haven't. She promised she would bring them back and didn't. Try saying "if you cannot trust the singer of the Go-Go's, who can you trust?" to a middle aged Bangladeshi and see if your wages don't get docked.
Apart from an unfortunately forgetful singer I have a long list of who is a complete wanker. I'll post that again.
Wednesday, September 09, 2009
Prediction Market In Adwords?
Can we predict how much an adword word will cost in the future? I find prediction markets fascinating but have not talked about them for a while. Here is an interesting game for predicting the popularity of words.
If this prediction market can accurately predict what words people will in the future find interesting and will discuss then you could buy up these adwords in advance and watch their market value (well cost in google) rise. So anyone want to buy a futures contract in the word "Cromulent"?
If this prediction market can accurately predict what words people will in the future find interesting and will discuss then you could buy up these adwords in advance and watch their market value (well cost in google) rise. So anyone want to buy a futures contract in the word "Cromulent"?
Wednesday, September 02, 2009
Fair division in googledocs using Ruby
I figured out how to access google docs spreadsheets using Ruby's roo library.
So for the spreadsheet
https://spreadsheets.google.co/ccc?key=0AifEYKk1FmScdDUwcTE1c2c4aFF6Wl93cENkWVF1Smc&hl=en
#you can create a object for this document by
where user and password are the username and its password for the account that has the document. 0AoBJp9mMcWUrdDZUY1diRm5KOTd4ZWtKWUpib2V3ZHc is the key
no http, no google.com, no key= and no &hl=en at the end. Good thing I am not an idiot who would take hours to figure this last one out...
Then this data is sent off to the GLPK program described ad nauseum previously.
Then using ruby's standard regular expression methods the solution file fair.sol can be easily parsed. This can be easily written to the googles doc using roo.
Next thing is to get a web interface for people to add their own fair division problems. There are some guides for doing that here and here. So automated processing is the next task.
By the way if you do have a fair division problem you can mail it to stuffsplitter[at]gmail.com and I will run the processing for you.
So for the spreadsheet
https://spreadsheets.google.co/ccc?key=0AifEYKk1FmScdDUwcTE1c2c4aFF6Wl93cENkWVF1Smc&hl=en
#you can create a object for this document by
oo=Google.new("0AoBJp9mMcWUrdDZUY1diRm5KOTd4ZWtKWUpib2V3ZHc"
,user="stuffsplitter",password="thepassword")
where user and password are the username and its password for the account that has the document. 0AoBJp9mMcWUrdDZUY1diRm5KOTd4ZWtKWUpib2V3ZHc is the key
no http, no google.com, no key= and no &hl=en at the end. Good thing I am not an idiot who would take hours to figure this last one out...
Then this data is sent off to the GLPK program described ad nauseum previously.
Then using ruby's standard regular expression methods the solution file fair.sol can be easily parsed. This can be easily written to the googles doc using roo.
o2.default_sheet ='Sheet3'
#match fair.sol output file of glpk.
if line=~/^\s+\d+ y\[(\d+).(\d+)\]\s+\*\s+(\d+)/
# 2 x[1,1] * 0 0 1
if $3=='1'
o2.set_value(row, col, $1)
o2.set_value(row, col+1, $2)
o2.set_value(row, col+2, $3)
Next thing is to get a web interface for people to add their own fair division problems. There are some guides for doing that here and here. So automated processing is the next task.
By the way if you do have a fair division problem you can mail it to stuffsplitter[at]gmail.com and I will run the processing for you.
Sunday, August 30, 2009
Fair division using a spreadsheet and Ruby
It has taken me a month to get over the idea that someone expected this blog not to be the ranting of an inane balding drunk but actually good. Still it is time to get back to the drunken inane rambling.
There is no point having all these cool algorithms unless people can actually use them. So what is a good way to actually get the data into the program? We'll spreadsheets are used for this sort of thing all the time. Unfortunately I cannot figure out how to get openoffice, excel or gnumeric's solver to carry out this minimax fair division program.
Ruby has a cool library called roo for interacting with spreadsheets. So heres a program to get the data out of a spreadsheet and send it off to GLPK
The input spreadsheets are openoffice and excelin the first row is the list of items.
Every other row is each persons valuation for each item. The first sheet is the indivisible items and the second sheet are the divisible ones. Unfortunately roo does not allow you write to these spreadsheets so I cannot print out the answer to a spreadsheet.
The roo interface to the google docs spreadsheet does allow cells to be written to. So getting that version up and running is the next task.
There is no point having all these cool algorithms unless people can actually use them. So what is a good way to actually get the data into the program? We'll spreadsheets are used for this sort of thing all the time. Unfortunately I cannot figure out how to get openoffice, excel or gnumeric's solver to carry out this minimax fair division program.
Ruby has a cool library called roo for interacting with spreadsheets. So heres a program to get the data out of a spreadsheet and send it off to GLPK
require 'rubygems'
require 'roo'
#open office version
# oo = Openoffice.new("spreadsheetOO.ods")
# o2 = Openoffice.new("spreadsheetOO.ods")
#excell version
oo = Excel.new("spreadsheetOO.xls")
o2 = Excel.new("spreadsheetOO.xls")
oo.default_sheet = oo.sheets.first
o2.default_sheet ="Sheet2"
st="" #data being written toa file
div= o2.last_column
#start writing data to model file
st<< "data;\n"
st<< "param m := #{oo.last_row-1};\n"
st<< "param n := #{div};\n"
#the non divisible is whatever is left
st<< "param o := #{oo.last_column};\n"
st<< "param c :"
i=1
(oo.last_column).times{st<< "#{i} "
i=i+1}
st<< ":=\n"
# number of people
i=1
2.upto(oo.last_row) do |line|
st<< "#{i} "
1.upto(oo.last_column) do |col|
st<< "#{Integer oo.cell(line,col)} "#Integer
end
st<< "\n";
i=i+1
end
st<< ";\n"
st<< "param d :"
i=1
(o2.last_column).times{st<< "#{i} "
i=i+1}
i=1
st<< ":=\n"
2.upto(o2.last_row) do |line|
st<< "#{i} "
1.upto(o2.last_column) do |col|
st<<"#{Integer o2.cell(line,col)} "
end
st<< "\n";
i=i+1
end
st<< ";\nend;"
#write data to a file
File.open("data","w")do |file|
file.write(st)
end
#call glpk program on the data
system('./glpsol -m fair.mod -d data -o fair.sol');
The input spreadsheets are openoffice and excelin the first row is the list of items.
Every other row is each persons valuation for each item. The first sheet is the indivisible items and the second sheet are the divisible ones. Unfortunately roo does not allow you write to these spreadsheets so I cannot print out the answer to a spreadsheet.
The roo interface to the google docs spreadsheet does allow cells to be written to. So getting that version up and running is the next task.
Monday, July 06, 2009
Filling knapsacks with candies
This paper by Marco Dall’Aglio and Raffaele Mosca on using linear programming (and dynamic programming)
it gives two examples of dividing non divisible goods between two people. The paper uses hard candies as a metaphor for any indivisible item.
The valuations are not based out of 100% but just plain numerical values.
Which as data for glpk looks like this
the worst person got 102 of what they wanted
Person alice gets item number 1 3 and 4
Person bob gets item number 2 5 6 7 8
This is the same allocation as the paper come up with.
The next example given is
which is the data file
Alice gets item 1 and 2
Bob gets item 3,4
The worst performing person gets 50.
To use these data files with the fair divider for two people (the code of which is here)
./glpsol -m fair2.mod -d data -o fair.sol
As pointed out in the comments this isn't earth shaking or anything it just shows another use of fair division which can be used when items cannot be divided.
it gives two examples of dividing non divisible goods between two people. The paper uses hard candies as a metaphor for any indivisible item.
The valuations are not based out of 100% but just plain numerical values.
candy 1 2 3 4 5 6 7 8
Alice 12 18 50 40 20 20 10 5
Bob 5 10 35 30 15 22 30 28
Which as data for glpk looks like this
data;
param m := 2;
param n := 0;
param o := 8;
param d : :=
1
2
;
param c : 1 2 3 4 5 6 7 8 :=
1 12 18 50 40 20 20 10 5
2 5 10 35 30 15 22 30 28
;end;
the worst person got 102 of what they wanted
Person alice gets item number 1 3 and 4
Person bob gets item number 2 5 6 7 8
This is the same allocation as the paper come up with.
The next example given is
candy 1 2 3 4
Alice 32 28 22 18
Bob 25 25 25 25
which is the data file
data;
param m := 2;
param n := 0;
param o := 4;
param d : :=
1
2
;
param c : 1 2 3 4 :=
1 32 28 22 18
2 25 25 25 25
;end;
Alice gets item 1 and 2
Bob gets item 3,4
The worst performing person gets 50.
To use these data files with the fair divider for two people (the code of which is here)
./glpsol -m fair2.mod -d data -o fair.sol
As pointed out in the comments this isn't earth shaking or anything it just shows another use of fair division which can be used when items cannot be divided.
Monday, June 29, 2009
Fair Division of an estate
This page describes a fair division of an estate between 5 people. The process is described in the "method of Sealed Bids" section. It that requires each participant has money they can use to pay off the others. I think this is a fairly serious drawback as not everyone has loads of money. Also in the case of an estate division it seems slightly galling that the person with more money gets more things, possibly of only sentimental value, then others.
The division works by
"# Step 1. Bidding. Each player produces a sealed bid in which he or she attaches a dollar value to each item in S. A player's fair share is 1/N of his total assessment.
# Step 2. Allocation. Each item in S goes to the highest bidder for that item. If her/his assessed value of the items received exceeds her/his fair share, she/he must pay the difference. If the assessed value of the items received falls short of a fair share, then she/he is paid out of money that others have had to pay.
# Step 3. Dividing the Surplus There is almost always a surplus of cash that is divided equally among the players. "
given results in people getting
And the minimum receive is $62,500 + $52,100+$18,340=132 940 out of a possible $679,000 or 19% of their desire.
If instead of assuming each player has money to buy stuff off the others I assumed each layer had equal claim to happiness. So I give each persons 100% desire is worth $679000 and those who claimed less then that use the remainder of their allocation as cash.
So this gives a table of desire of this
Running this on the linear programming fair division calculator program(you need to add s.t. wor5{i in I}: ((sum{j in J} c[5,j] * x[5,j])+(sum{k in K} d[5,k] * y[5,k])) >= worst;). gives a the person who gets least 20.5388%
which is an slight improvement of over on the initial allocation. Everyone gets the same items as in the initial allocation but the money is divided amongst those who receive the least rather then everyone.
The division works by
"# Step 1. Bidding. Each player produces a sealed bid in which he or she attaches a dollar value to each item in S. A player's fair share is 1/N of his total assessment.
# Step 2. Allocation. Each item in S goes to the highest bidder for that item. If her/his assessed value of the items received exceeds her/his fair share, she/he must pay the difference. If the assessed value of the items received falls short of a fair share, then she/he is paid out of money that others have had to pay.
# Step 3. Dividing the Surplus There is almost always a surplus of cash that is divided equally among the players. "
given results in people getting
Al BMW, Saab, Miro
Ben House
Cal Cottage
Don Klee
Ed Yacht
And the minimum receive is $62,500 + $52,100+$18,340=132 940 out of a possible $679,000 or 19% of their desire.
If instead of assuming each player has money to buy stuff off the others I assumed each layer had equal claim to happiness. So I give each persons 100% desire is worth $679000 and those who claimed less then that use the remainder of their allocation as cash.
So this gives a table of desire of this
data;
param m := 5;
param n := 1;
param o := 7;
/* n divisible items, o non divisible items*/
/*Divorce between Donald and Ivana Trump described in Win-Win solution.
Items to be divided are
4 divisible items:cash
2 non divisible items: House cottage, bmw,saab,yacht,miro, klee
Item Al Ben Cal Don Ed
House 29.46 31.66 28.71 25.77 30.19
Cottage 8.84 7.22 9.2 8.76 8.1
BMW 4.27 3.6 3.68 4.06 4.06
Saab 3.68 2.8 3.33 3.6 2.87
Yacht 17.67 18.4 17.53 19 19.51
Miro 13.99 13.13 7.36 11.05 9.57
Klee 22.09 19.88 14.58 26.36 21.94
cash 0 3.31 15.61 1.4 3.76
*/
param d : 1 2 3 4 5 6 7 :=
1 29.46 8.84 4.27 3.68 17.67 13.99 22.09
2 31.66 7.22 3.6 2.8 18.4 13.13 19.88
3 28.71 9.2 3.68 3.33 17.53 7.36 14.58
4 25.77 8.76 4.06 3.6 19 11.05 26.36
5 30.19 8.1 4.06 2.87 19.51 9.57 21.94;
param c : 1 :=
1 0
2 3.31
3 15.61
4 1.4
5 3.76;
end;
Running this on the linear programming fair division calculator program(you need to add s.t. wor5{i in I}: ((sum{j in J} c[5,j] * x[5,j])+(sum{k in K} d[5,k] * y[5,k])) >= worst;). gives a the person who gets least 20.5388%
Al BMW Saab Miro
Ben House
Cal 0.726381 of the cash Cottage
Don Klee
Ed Yacht 0.273619 of the cash
which is an slight improvement of over on the initial allocation. Everyone gets the same items as in the initial allocation but the money is divided amongst those who receive the least rather then everyone.
Sunday, June 28, 2009
Fair Division in Treaty Negotiations
Raiffa in "the art and science of negotiation" describes the Panama Canal treaty negotiations in 1974. He got the value each country attached to each issue from the US negotiating team. In the fair division book chapter 5 describes this negotiation using their Adjusted winner algorithm. One weakness with this algorithm is that all items must be divisible.
There is no way to fix issues as non divisible as there is in my program (you will need to remove s.t. wor3 and s.t. wor4).
So if you take the data as
where expansion routes is not divisible.
US gets item number us defense rights, use rights, expansion rights,expansion routes
Panama gets duration, expansion routes, compensation, jurisdiction and us military rights. For Land and water the US gets .1333 of this and Panama get 0.86667 which is ok as land and water are the sorts of things that can be divided up. Each country got 66% of what they wanted, In this case my program gets the same results as the Adjusted winner program.
There is no way to fix issues as non divisible as there is in my program (you will need to remove s.t. wor3 and s.t. wor4).
So if you take the data as
data;
param m := 2;
param n := 9;
param o := 1;
/*m people, n divisible items, o non divisible items*/
/*
1 non divisible items expansion routes
US Panama
US defense rights 22 9
use rights 22 15
Land and water 15 15
expansion rights 14 3
duration 11 15
expansion routes 6 5
compensation 4 11
jurisdiction 2 7
US military rights 2 7
defense role of Panama 2 13
*/
param c : 1 2 3 4 5 6 7 8 9 :=
1 22 22 15 14 11 4 2 2 2
2 9 15 15 3 15 11 7 7 13;
param d : 1 :=
1 6
2 5;
end;
where expansion routes is not divisible.
US gets item number us defense rights, use rights, expansion rights,expansion routes
Panama gets duration, expansion routes, compensation, jurisdiction and us military rights. For Land and water the US gets .1333 of this and Panama get 0.86667 which is ok as land and water are the sorts of things that can be divided up. Each country got 66% of what they wanted, In this case my program gets the same results as the Adjusted winner program.
Thursday, June 25, 2009
A better fair division program
One problem with the wildly unpopular fair division programs discussed previously is that they assume either everything can be cut into pieces or nothing can.
In the real world as Solomon noticed some items cannot be divided up. But some items are easily splittable . So I have improved the fair division program to deal with combined divisible and indivisible items.
Another problem is that the code only dealt with the two person case. I have fixed this by adding a new constraint for each extra person.
The code for this Mathprog program fair.mod is here. I am providing the source code in case anyone can suggest improvements. Also the world is full of decisions that get made for us that we have no way to challenge or understand. So I would like people to be able to see why the reasoning in and results of an arbitration,
The program (glpk) is run by
Put this data in a data file. Call glpk on it.
./glpsol -m fair.mod -d data -o fair.sol
So the data file could be
data;
param m := 4;
param n := 4;
param o := 2;
/*m people, n divisible items, o non divisible items*/
/*
Items to be divided are
4 divisible items: cash, land, cake, gold
2 non divisible items: dog, table
*/
param c : 1 2 3 4 :=
1 20 30 0 20
2 30 20 0 20
3 20 30 0 20
4 0 10 40 40;
param d : 1 2 :=
1 10 20
2 20 10
3 20 10
4 10 0;
end;
Which means person 1 thinks 20% of the value to them in the estate is in the cash, 10% is in the dog etc.
So now you can divide up goods fairly between m people. I have never seen a program that does this before. Using this program the that parties in a will, divorce, international dispute, merger and all sorts of other areas can achieve optimal solutions. The solutions will be proportional, envy-free (in the two person case) and Pareto optimal.
Now to make the dispute resolution program more usable.
In the real world as Solomon noticed some items cannot be divided up. But some items are easily splittable . So I have improved the fair division program to deal with combined divisible and indivisible items.
Another problem is that the code only dealt with the two person case. I have fixed this by adding a new constraint for each extra person.
The code for this Mathprog program fair.mod is here. I am providing the source code in case anyone can suggest improvements. Also the world is full of decisions that get made for us that we have no way to challenge or understand. So I would like people to be able to see why the reasoning in and results of an arbitration,
The program (glpk) is run by
Put this data in a data file. Call glpk on it.
./glpsol -m fair.mod -d data -o fair.sol
So the data file could be
data;
param m := 4;
param n := 4;
param o := 2;
/*m people, n divisible items, o non divisible items*/
/*
Items to be divided are
4 divisible items: cash, land, cake, gold
2 non divisible items: dog, table
*/
param c : 1 2 3 4 :=
1 20 30 0 20
2 30 20 0 20
3 20 30 0 20
4 0 10 40 40;
param d : 1 2 :=
1 10 20
2 20 10
3 20 10
4 10 0;
end;
Which means person 1 thinks 20% of the value to them in the estate is in the cash, 10% is in the dog etc.
So now you can divide up goods fairly between m people. I have never seen a program that does this before. Using this program the that parties in a will, divorce, international dispute, merger and all sorts of other areas can achieve optimal solutions. The solutions will be proportional, envy-free (in the two person case) and Pareto optimal.
Now to make the dispute resolution program more usable.
Tuesday, May 26, 2009
Fair Division of Advertising
Wired today had a really interesting article on how Google uses auctions to sell advertisements here.
But what other mechanisms are there to distribute out advertisements? One way is to use voting which I will describe again. Another method is the algorithmic fair division explained in my last post.
The glpk program given can be used to divide desired ad words between two bidders. You can add more bidders by adding constraints and people. There is an advantage to using this linear programming system of adword selling. It is not designed to maximise earnings but fairness. The procedure guarantees certain criteria described here. One advantage of these criteria is that the least unhappy buyer will be as happy as possible. As Amarillo Slim said "You can shear a sheep many times, but you can skin him only once." If you can keep each party as happy as possible you might maximise revenue over time rather then just for each particular auction. In the given program each party is assumed to have the same resources, 100, a fair division linear program for most applications would give each party a different level of resources.
Dinosaurs are interested in fair division

The book on fair division is this one
So using the previous code but with different data.
it has spawned—dozens of millionaire geeks, billions of auctions, and new ground rules for businesses in a data-driven society.There is a great paper here(pdf) on the game theory of these online auctions.
But what other mechanisms are there to distribute out advertisements? One way is to use voting which I will describe again. Another method is the algorithmic fair division explained in my last post.
The glpk program given can be used to divide desired ad words between two bidders. You can add more bidders by adding constraints and people. There is an advantage to using this linear programming system of adword selling. It is not designed to maximise earnings but fairness. The procedure guarantees certain criteria described here. One advantage of these criteria is that the least unhappy buyer will be as happy as possible. As Amarillo Slim said "You can shear a sheep many times, but you can skin him only once." If you can keep each party as happy as possible you might maximise revenue over time rather then just for each particular auction. In the given program each party is assumed to have the same resources, 100, a fair division linear program for most applications would give each party a different level of resources.
Dinosaurs are interested in fair division
The book on fair division is this one
So using the previous code but with different data.
/*
Coke and Pepsi want to buy advertisements. They each have 100 dollars to spend.
The adwords they desire are
1. Refreshing drink 2. Black Fizzy water
3. cola 4. pop
param c gives how much each company desires an ad on
each of these words. Minimax guarantees that
the company that does worst gets
the most ads on the topics they want possible.
*/
param c : 1 2 3 4 :=
1 10 40 10 40
2 40 20 30 10 ;
end;
Tuesday, May 19, 2009
Fair Division
"The only way to rectify our reasonings is to make them as tangible as those of the Mathematicians, so that we can find our error at a glance, and when there are disputes among persons, we can simply say: Let us calculate [calculemus], without further ado, to see who is right" Leibniz
If you want to divide items between two people you want to make sure that the person who gets least gets as much as possible.
This Maximin algorithm where you maximise what the person who gets least gets. To do this each person should put a valuation on each item. You can then use linear programming to divide items fairly between people. This program is written for the GLPK(there is a tutorial on it here)
This program is a modified version of this one
This last data part param c is important. The first line the columns are the items to be divided. The rows are the valuations placed on them. So c[i,j] is the value person i places on item j.
With splitting items allowed this results in
With splitting items not allowed the answer comes out as
This algorithm can be used to divide up items in a divorce, resources between countries and loads of other areas.
I will try make this easier for people to use. Any suggestions/comments are welcome.
If you want to divide items between two people you want to make sure that the person who gets least gets as much as possible.
This Maximin algorithm where you maximise what the person who gets least gets. To do this each person should put a valuation on each item. You can then use linear programming to divide items fairly between people. This program is written for the GLPK(there is a tutorial on it here)
This program is a modified version of this one
param m, integer,:= 2;
/* number of people dividing stuff */
param n, integer, > 0;
/* number of items to be divided */
set I := 1..m;
/* set of people */
set J := 1..n;
/* set of items */
param b{i in I},:= 100;
/* resource capacity of person i.
How much each person can want */
param c{i in I, j in J}, >= 0;
/* amount received if item j
is given to agent i */
var worst;
/*how is the worst person doing?*/
var x{i in I, j in J},>=0;
/*
here ,>=0;
means that the items can be subdivided.
here , binary;
means that items cannot be subdivided
x[i,j] = 1 means job j is assigned to agent i */
s.t. one{j in J}: sum{i in I} x[i,j] = 1;
/* item j must be assigned.
An item can be split due to >=0
being used instead of binary;*/
s.t. lim{i in I}: sum{j in J} c[i,j] * x[i,j] <= b[i];
/* total amount received by all items
to person i must not exceed the person's capacity */
s.t. wor{i in I}: sum{j in J} c[1,j] * x[1,j] >= worst;
s.t. wor2{i in I}: sum{j in J} c[2,j] * x[2,j] >= worst;
/*constraint on who gets worst deal*/
maximize obj: worst;
data;
param n := 4;
/*Divorce between Donald and Ivana Trump
described in Win-Win solution.
Items to be divided are Conneticut estate, Palm beach mansion,
Trump plaza apartment, Trump Tower Triplex
param n := 4;
*/
param c : 1 2 3 4 :=
1 10 40 10 40
2 40 20 30 10 ;
end;
This last data part param c is important. The first line the columns are the items to be divided. The rows are the valuations placed on them. So c[i,j] is the value person i places on item j.
With splitting items allowed this results in
No. Column name St Activity
------ ------------ -- -------------
1 worst B 73.3333
2 x[1,1] NL 0
3 x[2,1] B 1
4 x[1,2] B 0.833333
5 x[2,2] B 0.166667
6 x[1,3] NL 0
7 x[2,3] B 1
8 x[1,4] B 1
9 x[2,4] NL 0
With splitting items not allowed the answer comes out as
No. Column name Activity
------ ------------ -------------
1 worst 70
2 x[1,1] * 0
3 x[2,1] * 1
4 x[1,2] * 1
5 x[2,2] * 0
6 x[1,3] * 0
7 x[2,3] * 1
8 x[1,4] * 1
This algorithm can be used to divide up items in a divorce, resources between countries and loads of other areas.
I will try make this easier for people to use. Any suggestions/comments are welcome.
Tuesday, April 28, 2009
Blind Rubik's Cube 2
I decided after getting slagged for my incredibly girly last cube to do something a bit less pink. So I went to the craft shop. Where I did not look in anyway out of place amongst all the girls buying glitter and sparkles.
The materials I had to choose from were clockwise from top left
Tire Rubber, paper, foam, felt,velcro hooks, velcro, canvas, ribbon and mesh. I also got black sandpaper later.
I removed the stickers. I then washed off the residual stickiness with glue. I sandpapered 5 of the faces. After some thought I went for foam, velcro hooks, canvas, sandpaper, mesh and clear.
Subscribe to:
Posts (Atom)