The Info Tab contains an extensive description of the model.
When you play with the sliders you'll find that it's not so easy to understand what is happening. That the wealth distribution becomes more skewed when there are more agents is to be expected - more agents mean that there is relatively less sugar per agent in the environment, so competition becomes more fierce. But why does setting the initial endowment limits to almost the same (say, eg. 24 and 25; they can't be equal) not help? Shouldn't wealth be distributed evenly if all nodes start out on equal terms? Who are those nodes who get rich? To investigate the model in-depth we'll do some scatterplots.
If you want to change and save your version of this model to your own directory, you also need to copy some additional files from the models directory to your own directory. Go to the directory where Netlogo is installed - eg. the C:\Program Files\NetLogo 5.0.5 directory on Windows and then go to the subdirectory models\Sample Models\Social Science\Sugarscape. From there, copy sugar-map.txt and Sugarscape 3 Wealth Distribution.png to your own directory. Sugarscape 3 Wealth Distribution.nlogo is the actual program file - you can either copy it to your directory and edit from there or open the Model from the models library and then use File -> Save as to save your own version into your own directory.
To plot the sugar of each turtle over it's metabolism as a scatterplot, add a plot to the Interface tab, then add code to the pen-update command field in the plot as follows:
clear-plot
set-plot-x-range 0 ((max [metabolism] of turtles) + 1)
ask turtles [
let x metabolism
plotxy x sugar
]
First, this sets the length of the x-axis. In this model, metabolism is always >= 1, and we want a bit of space to either side of our values. If we know the upper bound of our x variable we can also hardcode the value to increase performance (asking all agents for the maximum in every plot step is not exactly high performance). Then we want to plot the value of every turtle. We use the plotxy command which takes an x,y value pair to plot a point. For this we have also to set the pen mode to point. Go to the plot, then in the Pen update commands dialog box set the drop-down menu "Mode" to "Point".
We do the same thing for initial-sugar, vision, and age: replace let x metabolism with let x initial-sugar, let x vision, and let x age respectively, add initial-sugar as a turtles-own variable at the beginning of the code and set it in the setup procedure after sugar is set for the first time: set initial-sugar sugar. We then get plots that look like this (put the command if ticks = 1000 [stop] as the last command into the go procedure to make stopping at the same point in time easy):
![]() |
| 250 agents, initial endowment [5;25], after 1000 ticks |
Normally, you would jitter a plot symmetrically around its x value but we just jitter to one side for performance reasons. Eg. for metabolism we change the line that sets up the x value to
let x metabolism - ((random 6) * 0.1)
which gives us a jitter of 0.5 (since random 6 gives values from 0...5). Since age starts at 0 and we don't want negative values in our plot we use a positive jitter in the age plot (for the other plots I find that the negative jitter looks more esthetically pleasing):
let x age + ((random 6) * 0.1)
To color the nodes with metabolism = 1 red we add the following line to all plots inside the ask turtles block:
ifelse (metabolism = 1) [set-plot-pen-color red][set-plot-pen-color black]
So the plot commands become the following:
Sugar over metabolism - we use a hard-coded x range for performance reasons
clear-plot
set-plot-x-range 0 5
ask turtles [
ifelse (metabolism = 1) [set-plot-pen-color red][set-plot-pen-color black]
let x metabolism - ((random 6) * 0.1)
plotxy x sugar
]
Sugar over vision
clear-plot
set-plot-x-range 0 7
ask turtles [
ifelse (metabolism = 1) [set-plot-pen-color red][set-plot-pen-color black]
let x vision - ((random 6) * 0.1)
plotxy x sugar
]
Sugar over age - here we have to calculate the xrange in each step to have a nicely filled plot. We could also set the maximum x range to 101 if we don't mind living with a half empty plot when there are no old turtles.
clear-plot
set-plot-x-range 0 ((max [age] of turtles) + 1)
ask turtles [
ifelse (metabolism = 1) [set-plot-pen-color red][set-plot-pen-color black]
let x age + ((random 6) * 0.1)
plotxy x sugar
]
Sugar over initial endowment - here we take the x range from the sliders that set the initial endowment. We could ask the turtles for the maximum and minimum value but that would be slow.
clear-plot
set-plot-x-range (minimum-sugar-endowment - 1) (maximum-sugar-endowment + 1)
ask turtles [
ifelse (metabolism = 1) [set-plot-pen-color red][set-plot-pen-color black]
let x initial-sugar - ((random 6) * 0.1)
plotxy x sugar
]
And this is the output with jittered x-axises and colored points for metabolism = 1:
![]() |
| 250 agents, initial endowment [5;25], after 1000 ticks |
![]() |
| 1000 agents, initial endowment [5;25], after 1000 ticks |




Keine Kommentare:
Kommentar veröffentlichen