globals [ max-resource num-resource-grown resource-growth-interval maximum-resources percent-best-land ; maximum amount any patch can hold ] patches-own ;; [ resource-here ; the current amount of resource on this patch max-resource-here ; the maximum amount of resource this patch can hold land-impact magnifier cluster is-settlement? ; impact ] turtles-own [ age ; how old a turtle is wealth ; the amount of resource a turtle has life-expectancy ; maximum age that a turtle can reach metabolism ; how much resource a turtle eats each time. Think of this as 'transaction cost'. vision ; how many patches ahead a turtle can see. Think of this as 'knowledge of the world'. generation prestige am-dead? my-clients my-home am-competing prestigiousness global-class clients-worth games-won my-obligations ] ;;; ;;; SETUP AND HELPERS ;;; to setup ;; (for this model to work with NetLogo's new plotting features, ;; __clear-all-and-reset-ticks should be replaced with clear-all at ;; the beginning of your setup procedure and reset-ticks at the end ;; of the procedure.) __clear-all-and-reset-ticks if seed? [random-seed 1066] ;; if the 'seed?' switched is turned on, the same sequence of random numbers will be generated each run. This allows the user to test the effect of different settings, code changes etc. setup-resources ;; set global variables to appropriate values set max-resource maximum-resources ;; call other procedures to set up various parts of the world setup-patches setup-turtles ask turtles [set am-dead? false set am-competing false set my-clients [] set prestigiousness [] set global-class [] set my-obligations [] ] my-setup-plots ;; plot the initial state of the world my-update-plots end ;;;important to note that ticks does not map 1:1 to 'years'. Better to think of things in terms of generations; to setup-resources ;;; change these settings to better represent the resource under consideration. if Resource-Settings = "Wild Woodland" [set resource-growth-interval 4 ;; number of cycles between growth. the lower the number, the more 'permanent' this resource can be treated. set num-resource-grown 1 ;;how much resource is grown each time the resource-growth-interval allows that to happen set maximum-resources 100 ;;maximum amount a patch may hold set percent-best-land 4 ;; density of patches ;;so I'm saying that wild woodland regenerates slowly, and a limited productivity ] if Resource-Settings = "Coppiced Woodland" [set resource-growth-interval 2 ;; regenerates periodically set num-resource-grown 5 set maximum-resources 1000 ;;managed woodland higher productivity, more uses, than wild woodland. set percent-best-land 4 ;;in comparison to wild woodland, coppicing regenerates quicker, and more densely, with more uses, than wild woodland ] if Resource-Settings = "Mines" [set resource-growth-interval 1; instant growback means that the seam does not get exhausted. set num-resource-grown 1000 set maximum-resources 1000000000000000 set percent-best-land 1 ; very rare ;; mines exist, they do not regenerate. *but* they don't get mined out either, in this model. but they can go out of production for other reasons. ] if Resource-Settings = "Clay" [set resource-growth-interval 1; instant growback means that the seam does not get exhausted. set num-resource-grown 1000 set maximum-resources 1000 ;; set percent-best-land 3 ;; more common ] end ;; set up the initial amounts of resource each patch has to setup-patches ;; give some patches the highest amount of resource possible -- ;; these patches are the "best land" ask patches [ set is-settlement? false set max-resource-here 0 if (random-float 100.0) <= percent-best-land [ set max-resource-here max-resource set resource-here max-resource-here ] ] ;; spread that resource around the window a little and put a little back ;; into the patches that are the "best land" found above if Resource-Settings = "Wild Woodland" or Resource-Settings = "Coppiced Woodland" ;;smearing a bit different for these ones, in terms of how far. [repeat 5 [ ask patches with [max-resource-here != 0] [ set resource-here max-resource-here ] diffuse resource-here 0.25 ] repeat 10 [ diffuse resource-here 0.25 ] ;; spread the resource around some more ] ask patches [ set resource-here floor resource-here ;; round resource levels to whole numbers set max-resource-here resource-here ;; initial resource level is also maximum recolor-patch ] end to recolor-patch ;; patch procedure -- use color to indicate resource level if is-settlement? = false [set pcolor scale-color yellow resource-here 0 max-resource] end ;;to visualize-land-impact ;; snippet of code to get a visualization of where turtles have been wandering. currently turned off. ;; set pcolor scale-color red land-impact 1000 1 ;; ;; end ;; set up the initial values for the turtle variables ;;;nb each turtle can be considered to represent a single family;; to setup-turtles set-default-shape turtles "person" crt num-people [ move-to one-of patches ;; put turtles on patch centers set size 1.5 ;; easier to see set-initial-turtle-vars set age random life-expectancy ] recolor-turtles end to set-initial-turtle-vars set age 0 face one-of neighbors4 set life-expectancy life-expectancy-min + random (life-expectancy-max - life-expectancy-min + 1) set metabolism 5 + random metabolism-max ifelse wealth <= 0 [set wealth metabolism + random 50] [set wealth wealth + (random-float 1 * wealth)];; some wealth carries on over the generations ifelse (color = blue) [set vision vision + random max-vision] [ifelse (color = green) [set vision (vision - 2) + random vision] [set vision 1 + random max-vision] ] if (vision <= 0) [set vision 1 + random max-vision] ;; blues have a better knowledge of the world, greens slightly less, reds poor. vision - knowledge - is inheritable set generation generation + 1 if prestige < 0 [set prestige 1] if generation > 1 [set prestige (random-float 1 * prestige)] ;; not every generation carries the family name well. end ;; Set the class of the turtles -- if a turtle has less than a third ;; the wealth of the richest turtle, color it red. If between one ;; and two thirds, color it green. If over two thirds, color it blue. to recolor-turtles ask turtles [ let local-turtles turtles in-radius (vision); + (vision * random-float 1)) let max-wealth max [wealth] of local-turtles ;; local status per wealth set according to your local neighborhood. Of course, how far you can see also depends on your color. ifelse (wealth <= max-wealth / 3) [ set color red ] [ ifelse (wealth <= (max-wealth * 2 / 3)) [ set color green ] [ set color blue ] ] ] ask turtles[let max-prestige max [prestige] of turtles ;; measuring global prestige. locally, wealth gives you your status. you enhance your prestige locally ;; but you also go to a central place every so often to compete there. success/failure there has reprecussions ifelse (prestige <= max-prestige / 3) [ set prestigiousness "low" ] [ ifelse (prestige <= (max-prestige * 2 / 3)) [ set prestigiousness "mid" ] [ set prestigiousness "high" ] ] ] ask turtles [let max-wealth max [wealth] of turtles ;; measuring global class per wealth ifelse (wealth <= max-wealth / 3) [ set global-class "low" ] [ ifelse (wealth <= (max-wealth * 2 / 3)) [ set global-class "mid" ] [ set global-class "high" ] ] ] end ;;; ;;; GO AND HELPERS ;;; to-report generations report mean ([generation] of turtles) end to go ;if count patches with [pcolor = blue] > (count patches * 1 / 10) [print " game over" stop] if generations >= 50 [print " game over" stop] ask turtles [if am-dead? [stop]] ask turtles [ turn-towards-resource ] ;; choose direction holding most resource within the turtle's vision harvest ask turtles [ move-eat-age-die ] recolor-turtles ;; grow resource every resource-growth-interval clock ticks if ticks mod resource-growth-interval = 0 [ ask patches [ grow-resource ] ] ask turtles [euergetism if ticks mod resource-growth-interval = 0 [calculate-clients-worth patron-compete];; at the end of each growing cycle, that's when the games of patronage are played; once a season. ] if ticks mod 25 = 0 [ask patches [grow-settlement]] tick my-update-plots end ;; determine the direction which is most profitable for each turtle in ;; the surrounding patches within the turtles' vision to turn-towards-resource ;; turtle procedure set heading 0 let best-direction 0 let best-amount resource-ahead set heading 45 if (resource-ahead > best-amount) [ set best-direction 45 set best-amount resource-ahead ] set heading 90 if (resource-ahead > best-amount) [ set best-direction 90 set best-amount resource-ahead ] set heading 135 if (resource-ahead > best-amount) [ set best-direction 135 set best-amount resource-ahead ] set heading 180 if (resource-ahead > best-amount) [ set best-direction 180 set best-amount resource-ahead ] set heading 225 if (resource-ahead > best-amount) [ set best-direction 225 set best-amount resource-ahead ] set heading 270 if (resource-ahead > best-amount) [ set best-direction 270 set best-amount resource-ahead ] set heading 315 if (resource-ahead > best-amount) [ set best-direction 315 set best-amount resource-ahead ] set heading best-direction end to-report resource-ahead ;; turtle procedure let total 0 let how-far 1 repeat vision [ set total total + [resource-here] of patch-ahead how-far set how-far how-far + 1 ] report total end to grow-resource ;; patch procedure ;; if a patch does not have it's maximum amount of resource, add ;; num-resource-grown to its resource amount if pcolor = blue [set resource-here 0 stop] if (resource-here < max-resource-here) [ set resource-here resource-here + num-resource-grown ;; if the new amount of resource on a patch is over its maximum ;; capacity, set it to its maximum if (resource-here > max-resource-here) [ set resource-here max-resource-here ] if is-settlement? = false [recolor-patch] ] end ;; each turtle harvests the resource on its patch. if there are multiple ;; turtles on a patch, divide the resource evenly among the turtles to harvest ; have turtles harvest before any turtle sets the patch to 0 diffuse magnifier .5 ;; ask turtles [ifelse is-settlement? = true [move-eat-age-die] [ ifelse resource-here > mean ([resource-here] of patches) or length my-obligations <= 1 ;; want a decision to be made to harvest, even when resource is on the decline. ;; this decision should be based on how embedded in social networks one is. ;; so, if there's lots of resource, no problem ;; but if there isn't, and we're socially embedded, we won't overexploit the resource ;; but if we're not socially embedded (we have no obligations) ;; we'll just go ahead and grab the resource anyway. [ set wealth floor (wealth + ((resource-here / (count turtles-here))) * magnifier) set land-impact land-impact + 1 set resource-here 0 recolor-patch ;show "I harvested!!" ] [ move-eat-age-die] ] ;;a code snippet for an alternative imagining: ;; now that the resource has been harvested, have the turtles make the ;; patches which they are on have no resource ;set family-fortune .5 * wealth ;set wealth wealth - family-fortune ;; we're having families save some coin. ] ;;; ask turtles ;;; [ set land-impact land-impact + 1 ;;; set resource-here 0 ;;; recolor-patch ;;; ] diffuse land-impact 0.2 end to extract-wealth-from-clients foreach my-clients [ ask ? [;show "I am a client" if wealth = 0 [set wealth 1] ;; we will not beggar our clients let amount-extracted (.1 * (wealth)) set wealth ([wealth] of ? - amount-extracted) ;show amount-extracted show "wealth I've lost!" ask myself [set wealth ([wealth] of myself + amount-extracted) ] ] ] ;show wealth show "wealth I've gained!" end to move-eat-age-die ;; turtle procedure fd 1 ;; consume some resource according to metabolism set wealth (wealth - metabolism) ;; grow older set age (age + 1) if (wealth < metabolism) [;show " is asking for help" ask-for-help] ;; check for death conditions: if you have no resource or ;; you're older than the life expectancy or if some random factor ;; holds, then you "die" and are "reborn" (in fact, your variables ;; are just reset to new random values) if wealth < 0 or (age >= life-expectancy);; or (family-fortune < 0) [ set-initial-turtle-vars ] end to ask-for-help ifelse random-float 1 > 0.99 [ let local-turtle one-of (turtles in-radius vision with [prestige >= ([prestige] of self) and self != myself]);; trying to find one of its betters ;show local-turtle ;show wealth if local-turtle != nobody [ask local-turtle [; show "is giving help to " (print myself) let gift (0.1 * wealth) ; gives one tenth to those who ask set prestige prestige + gift ;;; and he's getting some prestige set wealth wealth - gift; ;show gift ; show " gained some prestige by giving to " (print myself) ; show prestige ;; these three lines are useful for debugging ask myself [set wealth wealth + gift] ;;; the local turtle needs to set my wealth wealth + gift set my-clients fput myself my-clients] set my-obligations fput local-turtle my-obligations ] ;;; so I'm getting a gift ;show " got some help" ;show wealth ;; these two lines are useful for debugging ] [stop] end ;;;to-report top-prestige ;;; let max-prestige max [prestige] of turtles ;;; report count turtles with [prestige > max-prestige * 2 / 3] ;;;end ;;; ;;;to-report low-prestige ;;;let max-prestige max [prestige] of turtles ;;;report count turtles with [prestige <= max-prestige / 3] ;;;end ;;; ;;;to-report mid-prestige ;;; let top top-prestige ;;; let bottom low-prestige ;;; report bottom - top ;;;end ;; this routine is from the original model, and might be useful for visualizing outputs. to euergetism let max-prestige max [prestige] of turtles if (prestige > (max-prestige * 1 / 2)) [build-super-improvement] ;;; global elites. if (color = blue) [build-improvement] ;; local elite end to build-improvement let local-value prestige ask patch-here [set magnifier magnifier + (local-value * 0.1)] end to build-super-improvement let local-value prestige ask patch-here [set magnifier magnifier + (local-value * 0.5)] end to grow-settlement ;visualize-land-impact ;ask patches with [pcolor < 15] ;[set pcolor blue ; set is-settlement? true ; set resource-here 0] ;; these five lines are an alternative approach, but not used in the runs discussed in the paper. let max-impact max [land-impact] of patches if (land-impact > (max-impact * (99 / 100))) [set is-settlement? true set resource-here 0 set pcolor blue] end ;;; ;;; PLOTTING ;;; to my-setup-plots ;set-current-plot "Class Plot" ;set-plot-y-range 0 num-people set-current-plot "Local Class Histogram" set-plot-y-range 0 num-people set-current-plot "Games of Patronage" ;set-plot-y-range 0 num-people set-current-plot "Global Class Histogram" ;set-plot-y-range 0 num-people end to my-update-plots ;update-class-plot update-local-class-histogram update-lorenz-and-gini-plots update-games-plot update-global-class-histogram end ;; this does a line plot of the number of people of each class to update-games-plot set-current-plot "Games of Patronage" ;; set-plot-pen-color red ;; plot count turtles with [prestigiousness = "low"] set-current-plot-pen "mid" ; set-plot-pen-color green plot count turtles with [prestigiousness = "mid"] ; set-plot-pen-color blue set-current-plot-pen "high" plot count turtles with [prestigiousness = "high"] end to update-class-plot set-current-plot "Class Plot" set-current-plot-pen "low" plot count turtles with [color = red] set-current-plot-pen "mid" plot count turtles with [color = green] set-current-plot-pen "up" plot count turtles with [color = blue] end ;; this does a histogram of the number of people of each class to update-local-class-histogram set-current-plot "Local Class Histogram" plot-pen-reset set-plot-pen-color red plot count turtles with [color = red] set-plot-pen-color green plot count turtles with [color = green] set-plot-pen-color blue plot count turtles with [color = blue] end to update-global-class-histogram set-current-plot "Global Class Histogram" plot-pen-reset set-plot-pen-color red plot count turtles with [global-class = "low"] set-plot-pen-color green plot count turtles with [global-class = "mid"] set-plot-pen-color blue plot count turtles with [global-class = "high"] end to update-lorenz-and-gini-plots set-current-plot "Lorenz Curve" clear-plot ;; draw a straight line from lower left to upper right set-current-plot-pen "equal" plot 0 plot 100 set-current-plot-pen "lorenz" set-plot-pen-interval 100 / num-people plot 0 let sorted-wealths sort [wealth] of turtles let total-wealth sum sorted-wealths let wealth-sum-so-far 0 let index 0 let gini-index-reserve 0 ;; now actually plot the Lorenz curve -- along the way, we also ;; calculate the Gini index. ;; (see the Information tab for a description of the curve and measure) repeat num-people [ set wealth-sum-so-far (wealth-sum-so-far + item index sorted-wealths) plot (wealth-sum-so-far / total-wealth) * 100 set index (index + 1) set gini-index-reserve gini-index-reserve + (index / num-people) - (wealth-sum-so-far / total-wealth) ] ;; plot Gini Index set-current-plot "Gini-Index v. Time" plot (gini-index-reserve / num-people) / 0.5 end to open-file let file user-new-file if ( file != false ) [ if ( file-exists? file ) [ file-delete file ] file-open file ] end to write-to-file file-show my-clients file-show my-obligations end to patron-compete ;show length my-clients ifelse length my-clients > 1 ;; base line for the competition [ set my-home patch-here setxy 0 0 ;show "i am about to compete" ;show length my-clients print " and these are how many supporters I have" ;;these two lines are useful whilst running the model to keep track of what's going on compete ] [stop] end to calculate-clients-worth foreach my-clients [ ask ? [ let dosh wealth ask myself [set clients-worth clients-worth + dosh] ] ] end to compete let competitor one-of turtles-here with [color = [color] of myself and length my-clients > 0] ;; local elites come together, pair off against their peers ifelse competitor != nobody and competitor != self [ set am-competing true ;show "I'm competing against" ; ask competitor [show "...yes, against me" ] ifelse clients-worth >= ([clients-worth] of competitor) or (length my-clients) >= length [my-clients] of competitor ;; quality first, then number of clients! (quality can trump number) [set prestige prestige + 8 set games-won games-won + 1;;; extract-wealth-from-clients ;;; this is where obligations are repaid. ask competitor [ ;show "I am the competitor, and I lost" ;show ([prestige] of self) ;; these two lines are useful for debugging the model set prestige ([prestige] of self - 10) ;show ([prestige] of self) set games-won games-won - 1 ];; my prestige goes up, but yours goes down more because you lost. go-home ] [set prestige prestige - 10 set games-won games-won - 1 ask competitor [;show "I am the competitor, and I won" ;show ([prestige] of self) ;; these two lines are useful for debugging the model set prestige ([prestige] of self + 8) ;show ([prestige] of self) extract-wealth-from-clients ;;; nb wealth is a proxy for their support, repaying the gifts that the patron has already given them set games-won games-won + 1] go-home ] ] [go-home] end to go-home while [ patch-here != (my-home)] [set heading towards (my-home) ;set going-home? true jump 1 ] set am-competing false set clients-worth 0 ;;setxy my-home end ; Original Wealth Distribution Model is Copyright 1998 Uri Wilensky. All rights reserved. ; This extension of the model is Creative Commons Licensed Graham & Weingart @#$#@#$#@ GRAPHICS-WINDOW 209 22 627 461 25 25 8.0 1 10 1 1 1 0 1 1 1 -25 25 -25 25 1 1 1 ticks 30.0 BUTTON 8 256 79 289 setup setup NIL 1 T OBSERVER NIL NIL NIL NIL 1 BUTTON 108 256 175 289 go go T 1 T OBSERVER NIL NIL NIL NIL 1 SLIDER 8 72 176 105 max-vision max-vision 1 15 20 1 1 NIL HORIZONTAL SLIDER 8 106 176 139 metabolism-max metabolism-max 5 25 10 1 1 NIL HORIZONTAL SLIDER 8 38 176 71 num-people num-people 2 1000 235 1 1 NIL HORIZONTAL SLIDER 8 174 176 207 life-expectancy-max life-expectancy-max 1 80 50 1 1 NIL HORIZONTAL SLIDER 8 140 176 173 life-expectancy-min life-expectancy-min 20 100 20 1 1 NIL HORIZONTAL PLOT 684 291 896 471 Local Class Histogram Classes Turtles 0.0 3.0 0.0 250.0 false false "" "" PENS "default" 1.0 1 -2674135 true "" "" PLOT 1012 445 1247 625 Lorenz Curve Pop % Wealth% 0.0 100.0 0.0 100.0 false true "" "" PENS "lorenz" 1.0 0 -2674135 true "" "" "equal" 100.0 0 -16777216 true "" "" PLOT 1013 259 1247 439 Gini-Index v. Time Time Gini 0.0 50.0 0.0 1.0 true false "" "" PENS "default" 1.0 0 -13345367 true "" "" MONITOR 771 69 881 114 # of super prestige count turtles with [prestigiousness = \"high\"] 0 1 11 MONITOR 1016 33 1250 78 NIL count patches with [is-settlement?] 17 1 11 BUTTON 28 399 170 432 write socnet open-file\nask turtles ;with [am-dead? = false]\n[write-to-file]\nfile-close NIL 1 T OBSERVER NIL NIL NIL NIL 1 PLOT 1018 105 1246 255 Games of Patronage NIL NIL 0.0 3.0 0.0 10.0 true false "" "" PENS "mid" 1.0 0 -10899396 true "" "" "high" 1.0 0 -13345367 true "" "" PLOT 684 124 899 291 Global Class Histogram NIL NIL 0.0 3.0 0.0 10.0 true false "" "" PENS "default" 1.0 1 -16777216 true "" "" MONITOR 682 69 773 114 Avg # of clients mean [length my-clients] of turtles 0 1 11 MONITOR 682 24 773 69 max # of clients max [length my-clients] of turtles 17 1 11 MONITOR 773 24 856 69 # of patrons count turtles with [length my-clients >= 1] 17 1 11 MONITOR 880 69 960 114 mid prestige count turtles with [prestigiousness = \"mid\"] 17 1 11 CHOOSER 8 207 176 252 Resource-Settings Resource-Settings "Wild Woodland" "Coppiced Woodland" "Mines" "Clay" 0 MONITOR 855 24 920 69 Generation mean ([generation] of turtles) 0 1 11 SWITCH 353 501 456 534 seed? seed? 1 1 -1000 TEXTBOX 196 497 346 609 If switched on, the same sequence of random numbers is generated with each run, allowing the user to test the effects of different variables, changes to code, etc. 12 0.0 1 @#$#@#$#@ This model is based on the 'Wealth Distribution' model by Uri Wilensky (copyright 1998), which is itself a reimplementation of the well-known Sugarscape model. Creative Commons Licence
This extension to the wealth distribution model is licensed under a Creative Commons Attribution 3.0 Unported License Shawn Graham, Scott Weingart. Model code was updated on September 25th 2013. Graham commented out some of the residual code snippets, especially those elements that print output to the command window. ##The Model This model description follows the ODD protocol developed by Grimm et al. 2006 and Grimm and Railsback 2005. The model may be downloaded at http://dx.doi.org/10.6084/m9.figshare.92953 . Open with Netlogo 5. It is an elaboration of Wilensky’s Wealth Distribution model (1998), built using the Netlogo platform (Wilensky 1999). ##Purpose The purpose of this model is to explore network formation under the conditions described by Bang’s formulation of what he calls ‘the Roman Bazaar’. It focuses on the emergence of networks generated by Roman patronage (as understood in Bang’s model) under different economic conditions (concerning natural resources). ##State variables and scales In this simplified world, there is one kind of resource available for extraction and consumption at a time (forest, coppiced woodland, mines, and clay). Each individual agent represents the head of a single family who exploits this world. Each agent has a ‘metabolism’, the maximum value of which is set by the user. Every agent will have a random metabolism up to that maximum. This metabolism is a value indicating how much of the resource is consumed at each time-step. The other variable is ‘vision’, and it is set the same way. Thus the population as a whole has normally distributed values for these two variables, but the particular combination for a particular agent is distinct from every other agent. These two variables represent in a larger sense the agent’s ability to move in the world - its transport economics, if you will - and the agent’s ability to know about the world, to find other agents who can help it, or to find other resources. Similarly, a random life-span is set between a globally determined minimum and maximum. Each patch in the world has a chance of holding a certain amount of whatever resource is being simulated. Each resource regenerates after a set amount of time (forest; coppiced woodland). Mines and clay pits do not regenerate. Each patch in the world can hold a maximum amount of resource, and a certain amount is allowed to regenerate on each tick. The combination of these four variables (growth interval; amount grown; maximum allowed; percent best land) is pre-set to represent the four kinds of resource. Forest takes twice as long as coppiced wood to regenerate. Coppiced wood is more productive (and has more uses) than forest wood. Both wild and coppiced wood cover the same density of patches, with the highest concentrations occurring on 4% of patches (and surrounding patches containing diffused amounts). Mines hold an order of magnitude more resources than clay pits, but mines are set to be very rare (1% of the patches) while clay pits are somewhat more common (3%). These resources do not diffuse, but are constrained to a single patch. Finally, each patch keeps track of how often it has been ‘harvested’, allowing for exhaustion or depletion of the resource and thus taking it out of play. ##Process overview and scheduling ###Resource growth Each patch checks to see how much resource is allowed, and examines how much it currently contains. If it is less than the maximum, it regenerates the allowed amount to grow. ###Harvest Each agent examines its local neighbourhood, and heads towards the local maximum amount of the resource (if the patch is exhausted, it moves on). If the amount of resource is above the mean for the world, the agent notes the number of other agents on the patch, and they divide the resource between them. If the amount is less than the mean for the world, the agent examines whether or not it is embedded in social networks. If it is embedded, it will not harvest, but rather rely on help from its social network to obtain resource. If it is not embedded, it will go ahead and harvest anyway. ###Move-eat-age-die Each agent consumes some of its resource that it is holding, and ages +1. If an agent has less resources than its metabolism value, or if its age has now reached beyond its life span, the agent ‘dies’ and a new agent takes its place thus representing a generational change-over. The agent however is aware that it may be in peril. If the agent has now consumed all of its resources, it may ask for help (and thus stave off ‘death’). ###Patronage (ask-for-help) When an agent asks for help, it examines its local neighbourhood (within its range of vision, that is, knowledge-of-the-world) for a possible patron. A possible patron is one whose prestige is equal to or greater than its own (initially, all agents have the same prestige value). If a potential patron can be found, and the potential patron accepts the other agent as client (determined by a roll of the die), then the patron gives the client some of its resource. This gift increases the patron’s prestige, and puts the client in its debt. ###Set-initial-variables Should an agent be unable to find help, or its age exceeds its life-span, the agent ‘regenerates’. Its generation is set +1, and its metabolism is reset randomly. Some of the prestige of the previous generation carries onwards. Since ‘vision’ can be thought of as representing an agent’s knowledge of the world, there is an ‘educational’ function in that the richer agents are able to impart a greater degree of their knowledge to succeeding generations. The poorest have their vision set at random within the limits of the user-set maximum vision. ###Euergetism Patrons invest in their local area. Patrons who are in the top half of the population by prestige build ‘super-improvements’ which magnify the resource by 50%. All other patrons improve the productivity by 10%. ###Games of patronage (compete, patron-compete, calculate-clients-worth, extract-wealth-from-clients) At the end of each cycle, the agents compare their resource amount both locally and globally. They set their colour to reflect their local status into top, middle, and bottom thirds. They do the same comparison at the global level. Each ‘patron’ (an agent with at least two other agents in its debt) selects another patron to compete against; the decision is made based on colour, ie wealth (thus local elites compete against other local elites; the middling sort compete against the middling sort). Elites compare both the quality and number of their followers against each other. A patron with a few wealthy clients might beat a patron with several poor ones. Winning the game increases prestige, losing reduces prestige. The winner then calls on its clients to support it through gifts of resources. ###Exhaustion (‘grow-settlement’) Every 25 cycles the patches examine how many times they’ve been harvested, and if they are in the top 1%, they become ‘exhausted’ and can no longer be harvested. ##Design concepts ###Emergence. The simulation is allowed to run until the population as a whole has reached an average of 50 generations. How quickly that end-state is reached depends on not just the resource being modelled, but also on the interplay between the average movement costs (metabolism) in the world, and the average ability of the agents to know the world (vision). As we sweep through the various combinations of the two variables, there are three distinct peaks and troughs in terms of social stability (that is, long-lived generations and thus the amount of resource they have in any given moment (whether obtained through direct harvest or through gift-giving) is sufficient to keep them going. The rate with which social networks emerge also depends on the resource being extracted, with forest growing linearly, while coppiced woodland and clay grow almost exponentially very quickly and then plateau for the duration, and mines show an initial linear growth and then slowly plateau. The tripartite breakdown of ‘wealth’ in the model is different when measured locally versus globally. While locally there can be a great deal of equality (measured as each agent reports its own wealth in comparison to those in its range of vision), when every agent is compared against every other, different structures emerge. These are dependent not just on the resource and its distribution in the world but also on the interplay of metabolism and vision. ###Adaptation Individuals will move to a new site with greater resources than the one where they are currently location. Individual patrons can improve a location and distort the ‘natural’ patterns of resource growth. ###Sensing. Agents know how much resource is available anywhere within their range of vision. They know the relative wealth of others within their vision. They know also the relative prestige of others within their vision. Patches know how many times they’ve been harvested, and whether or not they are still productive. ###Interaction. Agents interact when they are in danger of using up all of their resources; patrons require support from their clients when the patron is competing for prestige against other patrons. Agents also act indirectly through the competition for resources at a particular location and the carrying capacity of that location. ###Stochasticity. All processes are modelled as probabilities. ###Collectives. Each agent, at the end of the model run, reports its patrons and its clients. These can then be knit together into a social network, whose characteristics can be explored statistically. Patrons call on their clients for support at certain times, drawing on the entire wealth of the group (and thus slowing down the patron’s generational turnover.) Individuals who are not part of a group exhibit selfish behaviour when harvesting, as they will not leave resource for others if the resource is in danger of being depleted. ###Initialization The world is torus-shaped. The environment is set to represent one of the four resources. Agents are distributed randomly across the world. Each agent is given a random life-span within the minimum and maximum amounts. Each agent is given a random metabolism within the maximum amount. Vision is similarly set. Each agent is initially given a random amount of resources around the maximum metabolism (so that they survive longer than the initial model cycle). Prestige and Generation are set to 1. ###Output At the end of the model run, each agent writes its patrons and clients into a single file for network analysis. The network analysis is performed using the Gephi network analysis program. Data on the state of the model at each time step is written to a spreadsheet, counting the number of agents who are patrons, clients, their degree of prestige, and their classification into high-middle-low status both locally and globally. During the run itself, a Gini index of inequality and Lorenz Curve are calculated and displayed. ##Extending the model The NW extension allows for more elegant exporting of the networks which may emerge, as graphml files. One could also generate various network measures within the model using the NW extension. It could be interesting to use the NW extension to generate different kind of network shapes to begin with. @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 airplane true 0 Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 arrow true 0 Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 box false 0 Polygon -7500403 true true 150 285 285 225 285 75 150 135 Polygon -7500403 true true 150 135 15 75 150 15 285 75 Polygon -7500403 true true 15 75 15 225 150 285 150 135 Line -16777216 false 150 285 150 135 Line -16777216 false 150 135 15 75 Line -16777216 false 150 135 285 75 bug true 0 Circle -7500403 true true 96 182 108 Circle -7500403 true true 110 127 80 Circle -7500403 true true 110 75 80 Line -7500403 true 150 100 80 30 Line -7500403 true 150 100 220 30 butterfly true 0 Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 Circle -16777216 true false 135 90 30 Line -16777216 false 150 105 195 60 Line -16777216 false 150 105 105 60 car false 0 Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 Circle -16777216 true false 180 180 90 Circle -16777216 true false 30 180 90 Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 Circle -7500403 true true 47 195 58 Circle -7500403 true true 195 195 58 circle false 0 Circle -7500403 true true 0 0 300 circle 2 false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 cow false 0 Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 Polygon -7500403 true true 73 210 86 251 62 249 48 208 Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 cylinder false 0 Circle -7500403 true true 0 0 300 dot false 0 Circle -7500403 true true 90 90 120 face happy false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 face neutral false 0 Circle -7500403 true true 8 7 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Rectangle -16777216 true false 60 195 240 225 face sad false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 fish false 0 Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 Circle -16777216 true false 215 106 30 flag false 0 Rectangle -7500403 true true 60 15 75 300 Polygon -7500403 true true 90 150 270 90 90 30 Line -7500403 true 75 135 90 135 Line -7500403 true 75 45 90 45 flower false 0 Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 Circle -7500403 true true 85 132 38 Circle -7500403 true true 130 147 38 Circle -7500403 true true 192 85 38 Circle -7500403 true true 85 40 38 Circle -7500403 true true 177 40 38 Circle -7500403 true true 177 132 38 Circle -7500403 true true 70 85 38 Circle -7500403 true true 130 25 38 Circle -7500403 true true 96 51 108 Circle -16777216 true false 113 68 74 Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 house false 0 Rectangle -7500403 true true 45 120 255 285 Rectangle -16777216 true false 120 210 180 285 Polygon -7500403 true true 15 120 150 15 285 120 Line -16777216 false 30 120 270 120 leaf false 0 Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 line true 0 Line -7500403 true 150 0 150 300 line half true 0 Line -7500403 true 150 0 150 150 pentagon false 0 Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 person false 0 Circle -7500403 true true 110 5 80 Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 Rectangle -7500403 true true 127 79 172 94 Polygon -7500403 true true 195 90 240 150 225 180 165 105 Polygon -7500403 true true 105 90 60 150 75 180 135 105 plant false 0 Rectangle -7500403 true true 135 90 165 300 Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 square false 0 Rectangle -7500403 true true 30 30 270 270 square 2 false 0 Rectangle -7500403 true true 30 30 270 270 Rectangle -16777216 true false 60 60 240 240 star false 0 Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 target false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 Circle -7500403 true true 60 60 180 Circle -16777216 true false 90 90 120 Circle -7500403 true true 120 120 60 tree false 0 Circle -7500403 true true 118 3 94 Rectangle -6459832 true false 120 195 180 300 Circle -7500403 true true 65 21 108 Circle -7500403 true true 116 41 127 Circle -7500403 true true 45 90 120 Circle -7500403 true true 104 74 152 triangle false 0 Polygon -7500403 true true 150 30 15 255 285 255 triangle 2 false 0 Polygon -7500403 true true 150 30 15 255 285 255 Polygon -16777216 true false 151 99 225 223 75 224 truck false 0 Rectangle -7500403 true true 4 45 195 187 Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 Rectangle -1 true false 195 60 195 105 Polygon -16777216 true false 238 112 252 141 219 141 218 112 Circle -16777216 true false 234 174 42 Rectangle -7500403 true true 181 185 214 194 Circle -16777216 true false 144 174 42 Circle -16777216 true false 24 174 42 Circle -7500403 false true 24 174 42 Circle -7500403 false true 144 174 42 Circle -7500403 false true 234 174 42 turtle true 0 Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 wheel false 0 Circle -7500403 true true 3 3 294 Circle -16777216 true false 30 30 240 Line -7500403 true 150 285 150 15 Line -7500403 true 15 150 285 150 Circle -7500403 true true 120 120 60 Line -7500403 true 216 40 79 269 Line -7500403 true 40 84 269 221 Line -7500403 true 40 216 269 79 Line -7500403 true 84 40 221 269 x false 0 Polygon -7500403 true true 270 75 225 30 30 225 75 270 Polygon -7500403 true true 30 75 75 30 270 225 225 270 @#$#@#$#@ NetLogo 5.0.4 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ setup go file-open (word "socnet." (int timer) ".txt") ask turtles [write-to-file] file-close count turtles with [length my-clients >= 1] count turtles with [length my-obligations >= 1] count turtles with [prestigiousness = "high"] count turtles with [prestigiousness = "mid"] count turtles with [prestigiousness = "low"] count turtles with [global-class = "low"] count turtles with [global-class = "mid"] count turtles with [global-class = "high"] count turtles with [color = red] count turtles with [color = green] count turtles with [color = blue] setup go export-all-plots "plots.csv" file-open (word "socnet." (int timer) ".txt") ask turtles [write-to-file] file-close count turtles with [length my-clients >= 1] count turtles with [length my-obligations >= 1] count turtles with [prestigiousness = "high"] count turtles with [prestigiousness = "mid"] count turtles with [prestigiousness = "low"] count turtles with [global-class = "low"] count turtles with [global-class = "mid"] count turtles with [global-class = "high"] count turtles with [color = red] count turtles with [color = green] count turtles with [color = blue] setup go file-open (word "socnet." (int timer) ".txt") ask turtles [write-to-file] file-close count turtles with [length my-clients >= 1] count turtles with [length my-obligations >= 1] count turtles with [prestigiousness = "high"] count turtles with [prestigiousness = "mid"] count turtles with [prestigiousness = "low"] count turtles with [global-class = "low"] count turtles with [global-class = "mid"] count turtles with [global-class = "high"] count turtles with [color = red] count turtles with [color = green] count turtles with [color = blue] setup go file-open (word "socnet." (int timer) ".txt") ask turtles [write-to-file] file-close count turtles with [length my-clients >= 1] count turtles with [length my-obligations >= 1] count turtles with [prestigiousness = "high"] count turtles with [prestigiousness = "mid"] count turtles with [prestigiousness = "low"] count turtles with [global-class = "low"] count turtles with [global-class = "mid"] count turtles with [global-class = "high"] count turtles with [color = red] count turtles with [color = green] count turtles with [color = blue] @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 1.0 0.0 0.0 1 1.0 0.0 0.2 0 1.0 0.0 link direction true 0 Line -7500403 true 150 150 30 225 Line -7500403 true 150 150 270 225 @#$#@#$#@ 0 @#$#@#$#@