Some time back (more than 4 years ago) I experimented with Craig Reynold’s boids concept. I suppose everyone does boids some time or another. I called mine Utopia and wrote a simple simulation game around it, where two groups of opposing boids clashed with each other, try to eat each other up. Macabre, I know but it was pretty cool.
I was reading The Origin of Wealth by Eric Beinhocker recently. One of the chapters described Epstein and Axtell’s research in Sugarscape and it reminded me of Utopia. I thought why not to try reproduce it with some of what I did in Utopia but in Ruby? After some initial hiccups trying to find the best GUI toolkit to create Utopia2, I decided to use JRuby and Swing.
A bit of background on the subject matter. Joshua Epstein and Robert Axtell are researchers in the Brookings Institution, a public policy think-tank in US. The Sugarscape project was basically an attempt to use ideas from complexity theory and artificial life on to the social sciences. The goal is to see if behaviours we see in real societies can be modelled using just simple local rules, very much like the three basic rules used in modelling boids.
Sugarscape simulates the behavior of artificial people (agents) located on a landscape (50 x 50 grid) of a generalized resource (sugar, hence Sugarscape). Agents are born onto the Sugarscape with a vision, a metabolism, a speed, and other genetic attributes. Their movement is governed by a simple local rule: “look around as far as you can; find the spot with the most sugar; go there and eat the sugar.” Every time an agent moves, it burns sugar at an amount equal to its metabolic rate. Agents die if and when they burn up all their sugar.
So, at each turn the agents follow these basic rules:
- Look around itself, within the constraint of its scope of vision (north, south, east and west)
- Determine which direction has the most sugar
- Move to that square and if it has sugar, eat it
- When it eats some units of sugar, it gains that amount while the sugar on the square is decreased by the amount that is eaten
- Every turn the agent will consume a certain amount of sugar according to its metabolism
- If the agent runs out of sugar it will die. The agent also has a preset lifespan which is reduced every turn until it expires
Sugar is distributed unevenly in Sugarscape, some cells have higher concentration of sugar while others have lower and two sugar ‘mountains’ are formed at the top right and bottom left of the simulation. Sugar that is consumed is also grown back at the rate of one per unit of time, so the food never really runs out.
The simulation starts with 250 agents started at random places. The diagram below shows the output of the basic model, from Epstein and Axtell’s research.
Utopia2 follows a very similiar logic as with Sugarscape but instead of agents and sugar, I used the terms alf (Artificial Life Form) and food. There are also a number of differences:
- While Sugarscape is a 50 x 50 grid, with each agent occupying a cell, Utopia2 is a 600 x 600 canvas and each alf occupies a single point
- Instead of looking at the 4 directions only, each alf scans a radius of its vision scope to see if there is any food within its scope. If there is, it will move towards the nearest visible food, otherwise it will randomly wander to a direction. This differs from Sugarscape because the Sugarscape agent always goes to the direction where it is most likely to have food, whereas the Utopian alf has no idea where the most likely food is, beyond its scope of vision
- The alf also has a lifespan which amount is randomly assigned and is reduced every round. But more importantly if it runs out of sugar, it will not die immediately but it will increase its starvation rate. The alf’s starvation rate quickens the reduction of its lifespan and once its lifespan is 0 it will die
- Lastly, while the Sugarscape agent moves one cell per turn, the Utopian alf has different speeds which is also a randomly distributed endowment. This is actually why the alf is more life-like. Of course my alfs also have a cool-looking ‘tail’ :)
Besides this, in Utopia2 while food grows back, it doesn’t do so immediately but grows back at a different rate. The result is as shown in this YouTube clip.
Here are some still shots of the simulation and two charts that trace the the progress of the simulation.
The first chart shows the food level of each alf over the progression of the simulation. In t=0, the alfs’ food levels are evenly distributed, that is, some have more food than the others but overall, the gap is not large. As the simulation progresses, you’ll notice that the chart becomes a sort of power law graph, where there are some alfs with a lot of food, while most will eventually have either very little or none (dead).
The second chart shows the number of alfs compared with the amount of food (in ranges) it has. I took the food levels of all the alfs, and divided the difference between the most food with the least food with a 13 different ranges or food ‘bins’. Then I sorted the alfs accordingly into each bin. In t=0, the distribution, as expected is quite even, and it forms a sort of uneven bell curve. This is expected as the initial food levels of the alfs is a random distribution.
However, as the simulation progresses you’ll notice the chart starts to skew towards the left, with few very ‘rich’ alfs with a lot of food to the right, a long tail of ‘middle class’ alfs and a lot of alfs with little or no food (dead). In fact, in certain simulations, while the alfs start of with a random food level of between 0 – 100, the super-rich alfs can reach levels of more than 7,000!
You’re right if you notice that these two charts basically potray the same thing, and in fact it is the same results that Epstein and Axtell came up with from their Sugarscape model.
So what does Epstein and Axtell’s research show?
In 1895, Italian economist Vilfredo Pareto collected income data from a number of countries and created a distribution chart called the Pareto distribution. Rather than a bell-shaped curve, which it will be if it is a normal distribution, it was one with a few very rich people, a wide range of middle class people and a large number of poor people, what is sometimes also known as power law distribution. In fact you’d probably have heard of this one before – this is the 80-20 rule, where 20% of the people owns 80% of the wealth.
And the Sugarscape (and Utopia2) simulation model shows this.
The question is, why does this happen? Why does the rich get richer and the poor gets poorer? Two obivious answers to this question are:
- Because of their genetic predisposition (nature) i.e. because they were ‘born’ with better endowments – with more scope of vision, with larger appetites, with faster speed etc
- Because of their location (born with a silver spoon) i.e. because they were born at the right place at the right time
However if we dig deeper, both answers are not right, because in each case the distribution is random and therefore bell-curve distribution, if these are the reasons then the final distribution of wealth should also be bell-curve.
The real answer, apparently is described in complexity theory. The skewed Pareto distribution we see is an emergent property of the system, and not because of a single cause. Without going in depth, what it means is that from a simple set of rules rises a new complexity that cannot be easily derived from the existing set of rules.
If we apply it to the real world, the parallels can be that there is no single easy cause of why the rich gets richer and the poor gets poorer, not only because of oppressive explotation by the rich, or globalization, or protectionist policies or the laziness of the people or the color of the skin or whichever the cause of the day is.
If you want to try out Utopia2, I’m making it available here, under Apache 2 license. You’re free to take it up and do whatever pleases you, but I’d appreciate it if you reference me if you do use it. You’ll need JRuby, of course, and JFreeChart.
By the way, this model of the Sugarscape simulation that I have just described is just the basic model. The full work done by Epstein and Axtell is described in their 1996 book Growing Artificial Societies: social science from the bottom up from MIT Press. Utopia2’s implementation to date follows this basic model only, however it is really quite simple to program the other more complex models. Let me know if you use Utopia2 to do this, I’ll be interested in knowing how you do it.