Leviathan
Model was written in NetLogo 6.0.2
•
Viewed 230 times
•
Downloaded 19 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Info tab cannot be displayed because of an encoding error
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
;this model is for the web, and doesn't use the nw network extension ;extensions [nw] directed-link-breed [opinions opinion] opinions-own [ evaluation intensity ;; propagation intensity ] globals [ turtles_list ] turtles-own [ N_Neighbors self-regard q_list degree ] to setup clear-all reset-ticks set turtles_list [] ;__clear-all-and-reset-ticks ; nw:set-context turtles links M_presets network_presets create-turtles population [ set size 1 set color blue ; BLUE COLOR BECAUSE NOT COMPLYING WITH ;setxy random-pxcor random-pycor while [any? other turtles-here] [ let empty_patch one-of patches with [any? turtles-here = false] move-to empty_patch ] set color random-float 140 set self-regard 0 ] if Display_Mode = "Matrix" [ ask turtles [set hidden? true] ] ask turtles [setup-neighbors set turtles_list fput self turtles_list ] end to M_presets if Model_Presets = "Equality" [ ; set network_type "None" set condition "Global" set population 40 set vanity 0.3 set rho 0.01 set noise_intensity 0.2 set sigma 0.35 set k_neighbors 5] if Model_Presets = "Elite" [ ; set network_type "None" set condition "Global" set population 60 set vanity 0.3 set rho 0.1 set noise_intensity 0.2 set sigma 0.3 set k_neighbors 5] if Model_Presets = "Hierarchy" [ ; set network_type "None" set condition "Global" set population 40 set vanity 0.2 set rho 0.5 set noise_intensity 0.2 set sigma 0.3 set k_neighbors 10] if Model_Presets = "Dominance" [ ;set network_type "None" set condition "Global" set population 40 set vanity 0.4 set rho 0.8 set noise_intensity 0.2 set sigma 0.3 set k_neighbors 2] if Model_Presets = "Crisis" [ ; set network_type "None" set condition "Global" set population 40 set vanity 0.4 set rho 0.35 set noise_intensity 0.2 set sigma 0.5 set k_neighbors 2] if Display_Mode = "Matrix" [ resize-world 0 population 0 population ; set-patch-size 8 ] end to network_presets ask turtles [ while [any? other turtles-here] [let empty_patch one-of patches with [any? turtles-here = false] move-to empty_patch ]] layout-spring turtles links 10 10 10 end to START! ask opinions [if evaluation < -1 [set evaluation -1] if evaluation > 1 [set evaluation 1]] ask turtles [ opinion_propagation ; partner_selection ; interaction ; forgetting ] graphics tick end to graphics ask opinions [ if evaluation < 0 [ set color blue] if evaluation > 0 [set color red]] if Display_Mode = "Matrix" [ foreach sort opinions [ ?1 -> ask ?1 [let i [who] of end1 let j [who] of end2 if evaluation < 0 [ask patch i j [set pcolor blue]] if evaluation > 0 [ask patch i j [set pcolor red]]] ] ] end to opinion_propagation let partner find-partner if partner = nobody [set partner one-of other turtles] let i [who] of self let j [who] of partner if opinion i j = nobody [ create-opinion-to partner [set evaluation 0]] if opinion j i = nobody [ask partner [ create-opinion-to turtle i [set evaluation 0]]] if Display_Mode = "Matrix" [ ask links [set hidden? true] ] ;[ask opinion i j [set evaluation 1]] ;ask partner [create-opinion-to myself [set evaluation 0]] let aii [self-regard] of self let aji [evaluation] of opinion j i let aij [evaluation] of opinion i j let ajj [self-regard] of partner ask opinion i j [ set intensity 1 / (1 + exp (-1 * ((aij - aii) / sigma))) ] let pij [intensity] of opinion i j set self-regard aii + (pij * rho * (aji - aii + noise)) ask opinion i j [set evaluation aij + (pij * rho * (ajj - aij + noise))] ;;STEP 2: REPUTATION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; let no_gossip_list (list self partner) ;; list of agents that cannot be called upon let t_list [] ask [out-opinion-neighbors] of self [set t_list fput self t_list] ;; creates a list of all neighbors foreach no_gossip_list [ ?1 -> set t_list remove ?1 t_list ] ;; removes self and partner from the list of neighbors of agent i ; not including 'partner', and also another -1 because we're dealing with repeats ;; thus if you have 2 neighbors, the repeat would be 0? No, to iterate once, it must say 'repeat 1'- repeating 0 causes ;; operation to be skipped. let lnk count out-link-neighbors - 1 let k k_neighbors let rpt min (list lnk k) if length t_list > 0 [ repeat rpt [ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; let q one-of t_list set t_list remove q t_list let q_i [who] of q let aiq [evaluation] of opinion i q_i if opinion j q_i = nobody [ask partner [create-opinion-to q]] let ajq [evaluation] of opinion j q_i ask partner [ask opinion j q_i [ set evaluation evaluation + (pij * rho * (ajq - aiq + noise)) ] ] ] ] ;;STEP 3: VANITY DYNAMICS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; let w vanity ask opinion i j [ set evaluation evaluation + (w * (aji - aii + noise))] ;; in words, agent i's new evaluation of j is the old evaluation plus the difference between j's evaluation of i and i's self-evaluation end to-report noise ; not used here let r random 2 ifelse r > 0 [set r 1][set r -1] let p random-float noise_intensity let fuzz p * r ; -1 to +1 report fuzz end to setup-neighbors if Condition = "Global" [set N_Neighbors Other Turtles] if Condition = "Local" [ ;let town sublist (sort [ distance myself ] of other turtles) 0 Influence_Range let town min-n-of Influence_Range other turtles [distance myself] set N_Neighbors town] ; if Condition = "Small Worlds" [ ; let town min-n-of Influence_Range other turtles [distance myself] ; set N_Neighbors town ; small-worlds] end to-report find-partner ifelse N_Neighbors = 0 [let partner one-of other turtles report partner] [ let partner one-of N_Neighbors report partner ] end
There is only one version of this model, created about 7 years ago by John Bradford.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Leviathan.png | preview | Preview for 'Leviathan' | about 7 years ago, by John Bradford | Download |
This model does not have any ancestors.
This model does not have any descendants.