Run this guide in the Behaviour Composer tool. BehaviourComposer: ignore everything before this. Guide to reconstructing Sugarscape Sugarscape is an artificial world with life, death, wealth, sex, culture, trade, and disease described in Growing Artificial Societies by Joshua M. Epstein and Robert Axtell, Brookings Institute Press, The MIT Press, 1996. This guide focuses on modelling life, death and wealth as in chapter 2. This guide was written by Ken Kahn and Howard Noble. Last edited on 15 August, 2014. Building the environmentWe start with a pre-prepared model of the Sugarscape. You will see three prototypical agents have been created called Agent, Sugarscape Environment, and Observer. Each has a number ofNetLogo code fragments we call micro-behaviours (or behaviours for short). You will build on this model by adding more behaviours from the Sugarscape Library. So let's get started by following the steps below! - People generally find it easier to split this guide with the rest of the Behaviour Composer by clicking the check box labelled Split screen between this panel and everything else at the bottom of this page.
- Load the pre-prepared model by clicking the Initial Sugarscape Model button and choosing Replace current model from the menu.Â
- The environment needs to be initialised to give it the behaviour of producing sugar. To do this you need to add these three behaviours to the Sugarscape Environment agent in the following order:
- Sugar capacity - each patch of the Sugarscape has a maximum sugar capacity
- Grow sugar - set the rate in which sugar grows
- Update patch color - the patches are coloured to reflect the amount of sugar accumulated.
Click each link to go to each behaviour's web page, then click the button at the top of the page (e.g. the button titled 'Sugar capacity'), select Add to prototype from the menu, then within the 'Composer' area click within the prototype Sugarscape Environment area to drop the behaviour. Read what is written on each behaviour web page and try to follow how the behaviour works. Note: the order you place some micro-behaviours matters. For example, for the patch colour to reflect the current state you should place Update patch color after Grow sugar. - Either 'Send your model to NetLogo' (if you are running BC2NetLogo) or click on the 'Run' tab within the Composer Area.  Click the 'GO' button when themodel has loaded. The Sugarscape Environment should be initialised and quickly grow sugar up to the capacity of each patch; it should look like this after a few seconds:
Creating an AgentIf you run your model and look carefully you'll see the you already have one instance of Agent in your model - a small triangle in the bottom-left corner. Now you will make this agent behave as in chapter 2 of the Growing Artificial Societies book. - Go to the 'Sugarscape Agents' section within the Sugarscape Library, find the 'Initialise Agent' behaviour and add it to Agent within the Composer area (following a similar process as in the previous step).Â
- Go through the same steps to add a behaviour called 'Jump to unoccupied patch' of each agent.
- Give Agent a shape and colour (you will find these in the Appearance and Movement sections of the Library). You can change the shape and colour from their defaults by opening the behaviours and changing the parameters within the NetLogo code on the page (for instance you might want to change the parameter "fish" to "person business" or "circle" in the shape behaviour).
Make the Agent Move- Add a behaviour to make Agent move to the nearest patch with the most sugar that it can see.
- Run the model a few times (by clicking on the 'Setup' button followed by the 'Go' button) and watch the Agent instance carefully. Think why the agent moves a bit or sometimes doesn't move at all.
Creating a Population- Go to the Composer area and edit the field labelled How many copies for the Agent prototype, to replace the default value of 1 with the variable name:Â
- You can now change this value with a slider that was added when you loaded the pre-prepared model in step 1. You should see the agents stop with a pattern similar to this:
Collecting and Consuming Sugar- Give the agents the behaviours of collecting and consuming sugar. Note that it is important that the agents move, collect, and then consume sugar in that order so ensure that they are in that order in the Agent prototype.Â
- Why do some of them keep moving and others stay still? You should see something like this:
Starving Agents- Make agents die if they have no sugar. Think about the distribution of agents and the way they move. After a while the model will look like the following.
Graphing the Population- Add a graph of the total population versus elapsed time - this behaviour should be given to the Observer. Think why the population drops and then levels off. The graph should look like the following:
Note that there is a behaviour that pauses the simulation after 50 ticks. You can press the 'GO' button again to run it indefinitely. Add a Histogram of Accumulated Sugar- Add a histogram of the distribution of sugar/wealth across the population. Note that you need two micro-behaviours for this. Watch how the plot changes as the model runs.
Add a Lorenz Curve and a Monitor for the Gini CoefficientThe Lorenz Curve and Gini Coefficient are additional tools for observing the distribution of wealth in the Sugarscape. (See page 36 of Growing Artificial Societies.)Â - Add behaviours create the Lorenz Curve. You will need to add two behaviours, one to create the plotting area and one to draw the graphs.Â
- Add a monitor to display the Gini Coefficient as the model runs.
Add Monitors for Vision Level and Sugar Metabolism- Add monitors for Vision Level and Sugar Metabolism.
Run some ExperimentsYou can use the sliders in the model to explore the parameter space of the Sugarscape model. - Run experiments to discover how to make large and small Gini coefficients and see which factors influence the carrying capacity (the stable size of the population; you can read this from the graph at time 50).
- Go to the class question form to record your findings and answer questions about the Gini coefficient and carrying capacity.Â
- Explore the stochastic nature of the model by making repeated runs with the same parameters.
Replacing dying agents- Add a behaviour so new agents are created when an agent dies.
- Change the initial population to 250 and observe how death and rebirth affects the dynamics of the mean vision level, the mean sugar metabolism, and the wealth distribution.
Limited Lifetimes- Give the agents behaviours so they die when they reach their lifespan.
- See how this affects the dynamics of the mean vision level, the mean sugar metabolism, and the wealth distribution. (The way aging is modelled will begin to have an effect after 60 time steps).
- Be sure that the 'Replace dead agents' behaviour is after these so agents that die of old age are also replaced.
Production Causes Pollution- Add behaviours so that sugar production causes pollution and agents move to avoid polluted areas.Â
- Observe the modified dynamics. Note that the production of pollution doesn't begin before 50 time steps. Sugar production is done by the Sugarscape Environment.
Consumption Causes Pollution- Add behaviours so that sugar consumption causes pollution. This also begins after 50 time steps. Sugar consumption is done by each Agent.
Diffusing Pollution- Add a behaviour to the Sugarscape Environment so that after 100 time steps pollution starts to diffuse to neighbouring sites.
Agents react to pollution- Deactivate the behaviour that causes agents to move to patches with more sugar and instead add the behaviour causing them to move to patches with the best sugar to pollution ratio.
Reflections on this exerciseIf you have timeIf you have time you could also: - Replace the behaviour for growing sugar with one that has differential seasonal growth rates.
- Replace the initial distribution of the population with one where everyone starts in the Southwest corner.
- Further explore the parameter space.
- Also NetLogo has a tool for automating the exploration of the parameter space. If you are not running BC2NetLogo you will need to download NetLogo and download your model to NetLogo. Inside of NetLogo click on Tools and BehaviorSpace to try it out.
BehaviourComposer: ignore everything after this. |
|