;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Diffusion in a landscape ;; (C) Christopher J Watts, 2010 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; extensions [array] globals [ grassland woodland water sand labels-on techs-count tconstraints constraintlist ktuple vspair last-seed-fitness last-seed-sim num-satisfied mean-num-techs max-num-techs min-num-techs mean-num-adopters max-num-adopters min-num-adopters mean-fitness max-fitness min-fitness init-num-satisfied init-mean-fitness init-max-fitness init-min-fitness chr chartcolours ] breed [agents agent] agents-own [ home-x home-y techs cur-num-techs cur-terrain fitness ] patches-own [ terrain ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to setup clear-all ;set chr array:from-list (list "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z") set chartcolours array:from-list (list 3 15 27 33 45 57 63 75 87 93 105 117 123 135 0 8) setup-pconstraints ;Sets up constraints belonging to patches, using seed-fitness for RNG set last-seed-sim (ifelse-value (seed-sim = 0) [new-seed] [seed-sim]) random-seed last-seed-sim setup-landscape setup-population set init-num-satisfied (count agents with [fitness = terrain-constraints]) set init-mean-fitness (mean [fitness] of agents) set init-max-fitness (max [fitness] of agents) set init-min-fitness (min [fitness] of agents) ; flash-invention setup-plots end to setup-landscape set grassland (patch-set patches with [pxcor < 16 and pycor > 16] patches with [pxcor = 16 and pycor > 16 and pycor mod 2 = 0] patches with [pxcor < 16 and pycor = 16 and pxcor mod 2 = 0] ) set woodland (patch-set patches with [pxcor > 16 and pycor > 16] patches with [pxcor = 16 and pycor > 16 and pycor mod 2 = 1] ) set water (patch-set patches with [pxcor > 16 and pycor < 16] patches with [pxcor = 16 and pycor < 16 and pycor mod 2 = 0] ) set sand (patch-set patches with [pxcor < 16 and pycor < 16] patches with [pxcor < 16 and pycor = 16 and pxcor mod 2 = 1] patches with [pxcor = 16 and pycor < 16] patches with [pxcor >= 16 and pycor = 16] ) ask grassland [ set pcolor (green + (random 3) - 1) set terrain 0 ] ask woodland [ set pcolor (63 + (random 3) - 1) set terrain 1 ] ask sand [ set pcolor (yellow + (random 3) - 1) set terrain 2 ] ask water [ set pcolor blue set terrain 3 ] end to setup-population create-agents initial-population [ setxy random-xcor random-ycor set home-x xcor set home-y ycor setup-agent-shape ; set techs array:from-list (n-values number-of-techs [random 2]) set techs array:from-list (n-values number-of-techs [0]) ;set label (word array:to-list techs) set cur-terrain [terrain] of patch-here set fitness agent-fitness self ] set labels-on false toggle-labels set techs-count array:from-list (n-values number-of-techs [0]) end to setup-agent-shape ifelse ([terrain] of patch-here = 3) [ set shape "boat" ] [set shape "person"] end to toggle-labels set labels-on (not labels-on) ask agents [ ifelse labels-on [ set label (word array:to-list techs) ] [ set label "" ] ] end to setup-plots set-current-plot "number-of-adopters" let pen-num 0 set-plot-pen-color item pen-num base-colors ; set-plot-pen-color (1 + (2 * (1 + int (pen-num / 14))) + (10 * (pen-num mod 14))) set-plot-pen-interval output-every-n-ticks repeat (number-of-techs - 1) [ set pen-num (pen-num + 1) create-temporary-plot-pen (word "tech-" pen-num) set-plot-pen-color array:item chartcolours pen-num ; set-plot-pen-color item pen-num base-colors ; set-plot-pen-color (1 + (2 * (1 + int (pen-num / 14))) + (10 * (pen-num mod 14))) set-plot-pen-interval output-every-n-ticks ] set-current-plot "technologies-popularity" ;set-plot-pen-interval 2 ;set-histogram-num-bars number-of-techs set-plot-x-range 0 number-of-techs set-current-plot "number-of-techs-per-agent" set-plot-y-range 0 (number-of-techs + 1) set-current-plot-pen "mean" set-plot-pen-interval output-every-n-ticks set-current-plot-pen "max" set-plot-pen-interval output-every-n-ticks set-current-plot-pen "min" set-plot-pen-interval output-every-n-ticks set-current-plot "fitness-plot" set-plot-y-range 0 (terrain-constraints + 1) set-current-plot-pen "mean" set-plot-pen-interval output-every-n-ticks set-current-plot-pen "max" set-plot-pen-interval output-every-n-ticks set-current-plot-pen "min" set-plot-pen-interval output-every-n-ticks set-current-plot "fitness-histo" set-plot-x-range 0 (terrain-constraints + 1) set-current-plot "number-of-fully-satisfied-agents" set-plot-y-range 0 (initial-population + 1) set-plot-pen-interval output-every-n-ticks update-plots end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to setup-pconstraints ; Defines the constraint sets for each terrain type set last-seed-fitness (ifelse-value (seed-fitness = 0) [new-seed] [seed-fitness]) random-seed last-seed-fitness set tconstraints n-values 4 [ ; 4 terrain types n-values terrain-constraints [ ; multiple constraints in each set n-values terrain-c-width [ ; multiple component variables in each constraint (((2 * random 2) - 1) * (1 + random number-of-techs)) ; Each component is an index number to be used with the techs array ; To denote a negated variable, an index number is multiplied by -1 ] ] ] end to-report agent-fitness [given-agent] report ksat-fitness given-agent ; report simple-fitness given-agent end to-report ksat-fitness [given-agent] ; k-sat fitness function: ; Uses the binary values in given agent's techs array ; and the constraints set for given agent's current terrain ; to return the number of constraints satisfied by those values. let ksat 0 let cval 1 foreach (item ([cur-terrain] of given-agent) tconstraints) [ ; i.e. for each constraint in the set that goes with current terrain set cval 1 foreach ? [ ; i.e. for each variable in the constraint ifelse ? > 0 [ ; if variable ID positive, use value in agent's techs array ; * means constraint is being calculated using conjunction operations (AND) ; set cval cval * (array:item techs (? - 1)) ; A AND B set cval cval * (1 - array:item techs (? - 1)) ; A OR B equates to ¬(¬A & ¬B) ] [ ; if variable ID negative, use 1 - value in agent's techs array ; set cval cval * (1 - (array:item techs ((abs ?) - 1))) ;A AND B set cval cval * ((array:item techs ((abs ?) - 1))) ; A OR B equates to ¬(¬A & ¬B) ] ] ; set ksat ksat + cval ; A AND B set ksat ksat + 1 - cval ; A OR B equates to ¬(¬A & ¬B) ] report ksat end to output-constraints ; Prints to the window the current constraint sets. print "Outputting constraint sets:" let constraint "" let tnum 0 let vnum 0 foreach tconstraints [ ; i.e. for each constraint set print (word "Terrain " tnum ":") let cnum 0 foreach ? [ ; i.e. for each constraint in the set set vnum 0 set constraint (word cnum ")") foreach ? [ ; i.e. for each variable in the constraint ; if vnum > 0 [set constraint (word constraint " &")] if vnum > 0 [set constraint (word constraint " OR")] ifelse ? > 0 [ ; if variable ID positive, use value in agent's techs array ; * means constraint is a conjunction operation (AND) set constraint (word constraint " T" (? - 1)) ] [ set constraint (word constraint " ¬T" ((abs ?) - 1)) ] set vnum (vnum + 1) ] print constraint set cnum (cnum + 1) ] set tnum (tnum + 1) print "" ] end to output-best-fitness ; Creates a temporary agent, then uses it to ; print best fitness and solution for each terrain let tnum 0 print "" print "Outputting best fitness values and first optimal solution:" create-agents 1 [ set techs array:from-list (n-values number-of-techs [0]) repeat 4 [ set cur-terrain tnum print (word "Terrain: " tnum) print best-fitness-agent self print array:to-list techs print "" set tnum (tnum + 1) ] die ] end to-report best-fitness-agent [given-agent] ; Returns best fitness value ; Given agent then has one of the solutions with that fitness value. ; Might not work as number of technologies get bigger. let tech-sol 0 let max-sol (2 ^ number-of-techs) let pos 0 let cur-sol 0 let cur-fitness 0 let best-sol -1 let best-fitness -1 ask given-agent [ repeat max-sol [ set pos 0 repeat number-of-techs [ array:set techs pos ((int (cur-sol / (2 ^ pos))) mod 2) set pos (pos + 1) ] set cur-fitness agent-fitness self if cur-fitness > best-fitness [ set best-fitness cur-fitness set best-sol cur-sol ] set cur-sol (cur-sol + 1) ] ] set pos 0 repeat number-of-techs [ array:set techs pos ((int (best-sol / (2 ^ pos))) mod 2) set pos (pos + 1) ] report best-fitness end to-report simple-fitness [given-agent] ; Simple fitness function: a bit count of techs array ; Used during development but now replaced with K-Sat. let bit-count 0 let cur-tech 0 ask given-agent [ repeat number-of-techs [ set bit-count (bit-count + (array:item techs cur-tech)) set cur-tech (cur-tech + 1) ] ] report bit-count end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to output-seeds print "Random number generator seeds: " print (word "seed-fitness " last-seed-fitness) print (word "seed-sim " last-seed-sim) print "" end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to go ; Agents move around their home patch ; and may invent, discard / forget, or imitate from nearby agents technologies. let temp-terrain 0 ask agents [ ifelse (patch-ahead 1 = nobody) [ ;Try another direction rt random 360 ] [ ifelse (distancexy home-x home-y >= roam-radius) [ facexy home-x home-y fd 1 rt ((random 90) - 45) ; setup-agent-shape ] [ fd 1 ; setup-agent-shape ] ] set temp-terrain [terrain] of patch-here if cur-terrain != temp-terrain [ set cur-terrain temp-terrain set fitness agent-fitness self setup-agent-shape ] if random-float 1 < chance-invention [invention] if random-float 1 < chance-discard [discard] if random-float 1 < chance-imitation [adopt-and-adapt] ] tick if ticks mod output-every-n-ticks = 0 [ set num-satisfied (count agents with [fitness = terrain-constraints]) ask agents [set cur-num-techs (sum array:to-list techs)] set mean-num-techs (mean [cur-num-techs] of agents) set max-num-techs (max [cur-num-techs] of agents) set min-num-techs (min [cur-num-techs] of agents) set mean-num-adopters (mean array:to-list techs-count) set max-num-adopters (max array:to-list techs-count) set min-num-adopters (min array:to-list techs-count) set mean-fitness (mean [fitness] of agents) set max-fitness (max [fitness] of agents) set min-fitness (min [fitness] of agents) update-plots ] end to invention ; Given agent (re-)invents / discovers an arbitrary technology let selected-tech ((random (number-of-techs / compound-size)) * compound-size) if techs-present selected-tech compound-size < compound-size [ let old-values array:to-list techs invent-techs selected-tech compound-size let alt-fitness agent-fitness self ifelse alt-fitness >= fitness [ ; ">=" means that more techs is better than fewer if labels-on [set label (word array:to-list techs)] let pos selected-tech repeat compound-size [ array:set techs-count pos ((array:item techs-count pos) + (array:item techs pos) - (item pos old-values)) set pos (pos + 1) ] set fitness alt-fitness set cur-num-techs (sum array:to-list techs) ] [ set techs array:from-list old-values ] ] end to flash-invention ; Initiates an invention event ; Called by button ask one-of agents [invention] end to discard ; Given agent tries going without an arbitrary technology let selected-tech ((random (number-of-techs / compound-size)) * compound-size) if techs-present selected-tech compound-size > 0 [ let old-values array:to-list techs wipe-techs selected-tech compound-size let alt-fitness agent-fitness self ifelse alt-fitness > fitness [ ; ">" means that more techs is better than fewer if labels-on [set label (word array:to-list techs)] let pos selected-tech repeat compound-size [ array:set techs-count pos ((array:item techs-count pos) + (array:item techs pos) - (item pos old-values)) set pos (pos + 1) ] set fitness alt-fitness set cur-num-techs (sum array:to-list techs) ] [ set techs array:from-list old-values ] ] end to-report techs-present [start-bit num-bits] ; Returns number of techs present for a given range of techs array ; i.e. counts bits set to 1 let bit-count 0 let pos start-bit repeat num-bits [ set bit-count (bit-count + array:item techs pos) ] report bit-count end to invent-techs [start-bit num-bits] let pos start-bit repeat num-bits [ array:set techs pos 1 set pos (pos + 1) ] end to wipe-techs [start-bit num-bits] let pos start-bit repeat num-bits [ array:set techs pos 0 set pos (pos + 1) ] end to adopt-and-adapt ; Current agent imitates one of the agents within a given radius of it. ; A multi-bit word may be copied - with possibility of adaptation or error let imitated one-of agents in-radius imitation-radius if imitated != nobody [ let selected-tech ((random (number-of-techs / compound-size)) * compound-size) if (compare-bits self imitated selected-tech compound-size) < compound-size [ let old-values array:to-list techs ; array:set techs selected-tech [array:item techs selected-tech] of imitated copy-bits imitated selected-tech compound-size let alt-fitness agent-fitness self ifelse alt-fitness >= fitness [ ; ">=" means that change through imitation is better than remaining the same if labels-on [set label (word array:to-list techs)] let pos selected-tech repeat compound-size [ array:set techs-count pos ((array:item techs-count pos) + (array:item techs pos) - (item pos old-values)) set pos (pos + 1) ] set fitness alt-fitness set cur-num-techs (sum array:to-list techs) ] [ set techs array:from-list old-values ] ] ] end to-report compare-bits [ego alter start-bit num-bits] let compcount 0 let pos start-bit repeat num-bits [ set compcount (compcount + 1 - abs ([array:item techs pos] of ego - [array:item techs pos] of alter)) set pos (pos + 1) ] report compcount end to copy-bits [alter start-bit num-bits] let compcount 0 let pos start-bit repeat num-bits [ if random-float 1 >= chance-adapt [ array:set techs pos ([array:item techs pos] of alter) ] set pos (pos + 1) ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to update-plots set-current-plot "number-of-adopters" let pen-num 0 repeat number-of-techs [ set-current-plot-pen (word "tech-" pen-num) plot array:item techs-count pen-num set pen-num (pen-num + 1) ] set-current-plot "technologies-popularity" clear-plot set pen-num 0 repeat number-of-techs [ plot array:item techs-count pen-num set pen-num (pen-num + 1) ] set-current-plot "number-of-techs-per-agent" set-current-plot-pen "mean" plot mean-num-techs set-current-plot-pen "max" plot max-num-techs set-current-plot-pen "min" plot min-num-techs set-current-plot "fitness-plot" set-current-plot-pen "mean" plot mean-fitness set-current-plot-pen "max" plot max-fitness set-current-plot-pen "min" plot min-fitness set-current-plot "fitness-histo" histogram [fitness] of agents set-current-plot "number-of-fully-satisfied-agents" plot num-satisfied end @#$#@#$#@ GRAPHICS-WINDOW 210 10 649 470 -1 -1 13.0 1 10 1 1 1 0 0 0 1 0 32 0 32 0 0 1 ticks BUTTON 6 30 70 63 Setup setup NIL 1 T OBSERVER NIL NIL NIL NIL INPUTBOX 102 67 195 127 roam-radius 4 1 0 Number BUTTON 72 30 135 63 Go go T 1 T OBSERVER NIL NIL NIL NIL INPUTBOX 6 67 101 127 initial-population 30 1 0 Number TEXTBOX 7 5 199 28 Diffusion in a landscape 18 0.0 1 INPUTBOX 6 128 101 188 number-of-techs 4 1 0 Number INPUTBOX 7 260 101 320 chance-invention 1.0E-5 1 0 Number INPUTBOX 7 324 101 384 chance-discard 0.1 1 0 Number INPUTBOX 7 388 101 448 chance-imitation 0.5 1 0 Number BUTTON 210 473 314 506 Labels on/off toggle-labels NIL 1 T OBSERVER NIL NIL NIL NIL BUTTON 107 261 162 319 Invent! flash-invention NIL 1 T OBSERVER NIL NIL NIL NIL PLOT 654 10 1121 302 number-of-adopters Time (ticks) # Adopters 0.0 10.0 0.0 10.0 true true PENS "tech-0" 1.0 0 -16777216 true PLOT 1125 10 1325 199 technologies-popularity Tech # Adopters 0.0 1.0 0.0 10.0 true false PENS "default" 1.0 1 -16777216 true INPUTBOX 105 388 193 448 imitation-radius 2 1 0 Number PLOT 653 470 869 620 fitness-plot Time (ticks) Mean Fitness 0.0 10.0 0.0 10.0 true true PENS "mean" 1.0 0 -16777216 true "max" 1.0 0 -13345367 true "min" 1.0 0 -11033397 true INPUTBOX 6 190 101 250 terrain-constraints 16 1 0 Number INPUTBOX 102 190 195 250 terrain-c-width 2 1 0 Number PLOT 870 470 1081 620 fitness-histo Fitness (# constraints) # Agents 0.0 10.0 0.0 10.0 true false PENS "default" 1.0 1 -16777216 true INPUTBOX 653 625 808 685 output-every-n-ticks 400 1 0 Number INPUTBOX 8 537 163 597 seed-fitness -7312887595840986 1 0 Number INPUTBOX 8 599 163 659 seed-sim 6064141801214071 1 0 Number MONITOR 1084 470 1170 515 Mean Fitness mean-fitness 2 1 11 MONITOR 1084 518 1170 563 Max Fitness max-fitness 17 1 11 MONITOR 1084 566 1171 611 Min Fitness min-fitness 17 1 11 BUTTON 319 474 479 507 Print Constraint Sets output-constraints NIL 1 T OBSERVER NIL NIL NIL NIL BUTTON 9 663 153 696 Print last RNG Seeds output-seeds NIL 1 T OBSERVER NIL NIL NIL NIL TEXTBOX 172 537 322 733 Random number generator seeds:\nIf set to 0, a fresh seed is created each time. Click the button to print the last ones used. If not 0, then the given number is used as a seed, and the corresponding stream of random numbers is repeated.\nseed-fitness controls the K-Sat problem.\nseed-sim controls agent location and events during the simulation. 11 0.0 1 BUTTON 319 510 479 543 Print best fitness and solution output-best-fitness NIL 1 T OBSERVER NIL NIL NIL NIL INPUTBOX 102 128 195 188 compound-size 1 1 0 Number INPUTBOX 7 450 101 510 chance-adapt 0 1 0 Number MONITOR 1172 470 1249 515 Initial Mean init-mean-fitness 2 1 11 MONITOR 1172 518 1249 563 Initial Max init-max-fitness 17 1 11 MONITOR 1172 566 1249 611 Initial Min init-min-fitness 17 1 11 MONITOR 1085 624 1185 669 # Agents Satisfied num-satisfied 17 1 11 MONITOR 1085 671 1185 716 Initial Satisfied init-num-satisfied 17 1 11 PLOT 814 624 1081 774 number-of-fully-satisfied-agents Time (ticks) # Agents 0.0 10.0 0.0 10.0 true false PENS "default" 1.0 0 -16777216 true PLOT 654 312 1019 462 number-of-techs-per-agent Time (ticks) # Technologies 0.0 10.0 0.0 10.0 true true PENS "mean" 1.0 0 -16777216 true "max" 1.0 0 -10873583 true "min" 1.0 0 -1604481 true MONITOR 1023 312 1108 357 Mean # Techs mean-num-techs 2 1 11 MONITOR 1023 359 1108 404 Max # Techs max-num-techs 17 1 11 MONITOR 1023 406 1108 451 Min # Techs min-num-techs 17 1 11 MONITOR 1124 312 1218 357 Mean # Adopters mean-num-adopters 2 1 11 MONITOR 1124 359 1218 404 Max # Adopters max-num-adopters 17 1 11 MONITOR 1124 406 1218 451 Min # Adopters min-num-adopters 17 1 11 @#$#@#$#@ WHAT IS IT? ----------- Technology diffusion in a landscape that places constraints on what technologies will work together. Agents living in a landscape of grassland, forest, water and sand can adopt technologies/practices from each other. Different terrain places different constraints on an agent, and an agent may need to adapt a technology in order to profit by adopting it - that is, the agent may need a different combination of technologies to other agents in order to profit from imitating a particular technology. HOW IT WORKS ------------ A combination of a constraint satisfaction problem (K-Sat), and diffusion of innovations through imitation of other agents. The world is divided into 4 quarters, each representing a different type of terrain: grassland (terrain 0, top left); forest (1, top right); sand (2, bottom left), and; water (3, bottom right). A given number of agents is generated. Each agent has knowledge / possession of a given number of technologies / technological practices. This knowledge is represented as an array of 0/1 binary variables - an agent's current values can be seen in its label, when labels are being shown. All agents start with knowledge of no technologies (label set to "0"s). Agents may discover technologies through invention, with some given chance, or learn through imitation of one of the nearby agents within a given radius. There is a given chance, however, that an agent will try discarding a technology. Any changes in technological knowledge - whether due to invention, discarding or imitation - will only be accepted by an agent if they result in that agent's fitness not becoming worse. At the start, for each terrain type a set of constraints is generated. Each constraint set has a given number of constraints (though some duplication is possible). Each constraint consists of a given number of technology variables, some of which may be negated. An agent's current fitness is calculated as the number of constraints satisfied by that agent's current technologies. The set of constraints used is that for the agent's current patch's terrain. Agents move, and may thereby change current patch and terrain type. Each agent begins at its home base, then roams within a given radius of that home. Thus some agents will spend most, if not all, of their time within the same terrain, while others may cross between two or more different terrain types. When an agent's terrain changes, its fitness is recalculated for the changed constraint set. Agents are depicted using the "person" shape, except when on water, for which they take to boats instead. HOW TO USE IT ------------- The possibility of diffusion through imitation depends on the population density - i.e. the number of agents, the roaming radius size, the imitation radius size and the chance of imitation. Invention occurs by chance with a given probability, but may also be caused by clicking a button. It is possible, however, that an invention event results only in a selected agent "discovering" a technology that agent already knows. It is also possible, that the agent discovers a previously unknown technology, but fails to keep it due to it breaking more constraints than the agent's previous technological knowledge. So clicking the invent button might fail to result in any noticeable change! The difficulty of constraint satisfaction problems varies with the ratio between the number of constraints and the number of (technology) variables. As the ratio increases, the expected number of broken constraints undergoes a phase transition from very low to very high. The exact shape of this transition varies with the width of the constraints - i.e. the number of variables included in each constraint (the "K" in "K-Sat"). THINGS TO NOTICE ---------------- Agents located in different terrains have satisfaction levels defined by different constraint sets - so expect to see technologies diffusing rapidly among agents who share terrain, but diffusion may fail between agents who tend to occupy different terrain. How many technologies are limited to particular terrains? Are there particular combinations of technologies that are limited to particular terrains? Some agents roam between two or more types of terrain, and therefore have to satisfy more than one set of constraints. Is their technology list less constant? Is their mean satisfaction level lower? The success of a particular technology depends on what other technologies its would-be adopters are already using. A technology may fail to take off at one time point, but then sweep through the population at a later point if in the meantime other technologies have spread that alter its value. A ubiquitous technology can also suffer a drop in popularity if a new technology emerges that conflicts with it. Look for such interdependencies between technologies in the time series plots. THINGS TO TRY ------------- Try different size populations. How does this affect diffusion? Diffusion depends on whether agents roam sufficiently close to each other to be able to imitate, so try varying roam-radius and imitation-radius as well. Try changing the definition of the K-Sat problem (varying the number of technologies, the number of constraints, and the width of a constraint). How does this affect diffusion? How does it affect fitness (satisfaction) over a particular length of time? Try changing the rates of the events that affect technology diffusion (invention, discarding and imitation). The agent population are solving constraint satisfaction (k-sat) problems. Can you optimise their problem-solving performance? (Of course, some rates may be far from realistic!) EXTENDING THE MODEL ------------------- Agents' movements could be based on fitness at particular patches. Agents could be of different types, each with its own constraint set, indicating different abilities, training, backgrounds or races. There could be a set of constraints common to all patches - representing material constraints on technologies that apply whatever the terrain and whoever the user. Obviously, more complicated landscapes could be defined. The four-quarters landscape was chosen for its ability to make visual particular clusters of adopters. Real-world landscapes could be modelled instead for a particular set of technologies and practices, given information about the terrain-specific interdependencies between them. NETLOGO FEATURES ---------------- Note how to encode a K-Sat problem in NetLogo. (The relevant code is in setup-pconstraints, ksat-fitness and output-constraints.) tconstraints is a 4-item list. (For many more items a list might be considered inefficient.) Each item is a list of constraints. Each constraint is a list of index numbers - some of them negative to denote a negated variable. The index numbers are used with the techs array that each agent has to return binary values. Each constraint involves conjunction operations (AND) between its components. RELATED MODELS -------------- There are lots of diffusion models, of course, including those of disease epidemics, and those in which the inter-agent interactions occur in a social network of a given structure. Our agents move around a fixed home base - how does this affect diffusion? Why do we not see the famous s-curve for adoption? Epidemic models are not the only approach to modelling the diffusion of innovations, however. Are there any probit models in NetLogo? Ecological models include interdependent populations of different-species creatures - e.g. wolves and sheep, or foxes, rabbits and grass - and show complex dynamics over time in their population sizes. How similar is a ecological model to a technology-diffusion model? Papers exist on k-sat problems and the heuristic search algorithms used to solve them, though NetLogo models may be hard to find. Lazer & Friedman (2007, Administrative Science Quarterly) model an organisation of agents who solve an NK fitness landscape problem using similar processes of imitation of neighbours and trial-and-error experimenting. There may be analogues to Lazer & Friedman's finding that model features that slow down the rate of diffusion (e.g. the organisation's network structure) can lead to better problem-solving performance (because of the balance between exploitation of existing solutions and further exploration of new solutions). CREDITS AND REFERENCES ---------------------- For more on K-Sat problems, including their use in models of technological evolution see in chapters 8 and 9 in: Kauffman, Stuart (2000) "Investigations". Oxford: Oxford University Press. @#$#@#$#@ 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 boat false 0 Polygon -1 true false 63 162 90 207 223 207 290 162 Rectangle -6459832 true false 150 32 157 162 Polygon -13345367 true false 150 34 131 49 145 47 147 48 149 49 Polygon -7500403 true true 158 33 230 157 182 150 169 151 157 156 Polygon -7500403 true true 149 55 88 143 103 139 111 136 117 139 126 145 130 147 139 147 146 146 149 55 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 sheep false 0 Rectangle -7500403 true true 151 225 180 285 Rectangle -7500403 true true 47 225 75 285 Rectangle -7500403 true true 15 75 210 225 Circle -7500403 true true 135 75 150 Circle -16777216 true false 165 76 116 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 4.1 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ setup flash-invention go ticks >= 10000 timer array:item techs-count 0 setup go ticks >= 40000 timer mean-num-techs max-num-techs min-num-techs mean-fitness max-fitness min-fitness init-mean-fitness init-max-fitness init-min-fitness num-satisfied init-num-satisfied mean-num-adopters max-num-adopters min-num-adopters setup go ticks >= 200000 timer mean-num-techs max-num-techs min-num-techs mean-fitness max-fitness min-fitness init-mean-fitness init-max-fitness init-min-fitness num-satisfied init-num-satisfied mean-num-adopters max-num-adopters min-num-adopters setup go ticks >= 200000 timer mean-num-techs max-num-techs min-num-techs mean-fitness max-fitness min-fitness init-mean-fitness init-max-fitness init-min-fitness num-satisfied init-num-satisfied mean-num-adopters max-num-adopters min-num-adopters @#$#@#$#@ @#$#@#$#@ 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 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@ 0 @#$#@#$#@