Arational Belief Convergence

Arational Belief Convergence preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.4 • Viewed 58 times • Downloaded 0 times • Run 0 times
Download the 'Arational Belief Convergence' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [ believer-list]
turtles-own [friends belief discriminating-value pop-my-friends ]

to setup
  ca
  reset-ticks
  ;; ugly coding but more functional for switching between fixed and non-fixed populations
  ask patches [set pcolor blue + random-float 3 if random 100 < density  [sprout 1] ] ask turtles [set-up-routine]
 ;  crt 100 [set-up-routine] ;; for fixed population
  assign-dogmatists
  set believer-list [] ;; believer-list is needed for looking at how beliefs are more or less popular over time. Esp useful for fixed pop with dogmatists.
  let n 0
  repeat count turtles
    [set believer-list lput n believer-list
      set n n + 1]
if max-discrim-value >= 1 [user-message "can't have a max-discriminating-value equal to or greater than 1.0"]
if max-pop-my-friends >= 1 [user-message "can't have a max-pop-my-friends equal to or greater than 1.0"]
end 

to go ;; turtles: 1. decide their character 2. find their friend bias  3. influence others  4. be influenced
  find-friends ;; turtles find their friends
  influence
  update-color
  plot-belief
  plot-pop-by-belief
  if pop-with-shared-belief = count turtles [ end-routine stop] ;; this is for converging on a single belief or just letting the model run with num-dog > 1
  ;if beliefs-in-circulation  = num-dog [stop] ;; this is for converging on as many beliefs as there are dogmatists
  if new-generations? [
    die-and-replace]
  tick
end 

to set-up-routine
  move-to one-of patches
  if any? other turtles-here [set-up-routine]
    set size .75
    set color wrap-color who
    set belief who
    ;;; if you want turtles to be the same, adjust "random-float" from the following two lines as needed.
    set discriminating-value random-float max-discrim-value ;
    set pop-my-friends random-float max-pop-my-friends   ;
end 

to assign-dogmatists
  ask n-of num-dog turtles [set discriminating-value 0]
end 

to end-routine
  type "difference between winning turtle discriminating value and lowest discriminating value "
    print discrim-diff
    type "difference between highest and lowest discriminating value "
    print max-discrim-diff
    type "ratio of winner to max "
    print (discrim-diff / max-discrim-diff)
    type "winner is # " write winner-in-list-PBC print " in list of discriminating values"
    type "also winner is # " write winner-in-list-audience type " in list of audience size"
end 

to die-and-replace
  ask turtles [
    if (random-float 1.0 < replacement-rate)[
      hatch 1 [
       set-up-routine]
      die]
  ]
end 

;; a smattering of useful reporters
;; reporters are designed to work without replacing turtles, i.e. with "new-generations?" switched off.
;; in the case that a consensus is reached with "new-generations?" switched on and the winning turtle has died, the following reporters will throw errors.

to-report count-believers
  let n []
  foreach believer-list [ i -> set n lput (count turtles with [belief = i]) n]
  report (map [j -> j / length n] n)
end 

to-report winner-in-list-audience
  report ((position [pop-my-friends] of turtle final-belief (sort [pop-my-friends] of turtles)) + 1)
end 

to-report winner-in-list-PBC
  report ((position [discriminating-value] of turtle final-belief (sort [discriminating-value] of turtles)) + 1)
end 

to-report winner-PBC
  report [discriminating-value] of turtle final-belief
end 

to-report winner-audience
  report [pop-my-friends] of turtle final-belief
end 

to-report max-discrim-diff
  let l [discriminating-value] of turtles
  report (max l) - (min l)
end 

to-report discrim-diff
  report [discriminating-value] of turtle final-belief - min-discrim-value
end 

to-report min-discrim-value
  report min [discriminating-value] of turtles
end 

to-report low-discrim-agent
  report [who] of turtles with [discriminating-value = min-discrim-value]
end 

to-report list-of-beliefs
  report sort remove-duplicates [belief] of turtles
end 

to-report final-belief
  report item 0 list-of-beliefs
end 

to-report pop-with-shared-belief
  let b-list []
  set b-list [belief] of turtles
  let m []
  set m modes b-list
  if length m > 1 [set m (list min m)]
  let t 0
  foreach b-list [ ?1 -> if member? ?1 m [set t t + 1] ]
  report t
end 

to-report beliefs-in-circulation
  let m remove-duplicates [belief] of turtles
  report length m
end 

;;; main mechanisms for the model

to find-friends
  ask turtles [set friends n-of round (pop-my-friends * count turtles) other turtles]
end 

to influence ;; mechanism of belief change. turtle asks friends to adopt belief. friends roll dice to see if that happens
  ask turtles [
    if friends != 0[
    ask friends  [
      let rf random-float 1.0
      if rf < discriminating-value [ set belief [belief] of myself]
    ]
  ]
]
end 

to update-color ;; this makes convergence more visible with the turtles
  ask turtles[
    set color belief]
end 


;;; now to do some plotting

to plot-belief
set-current-plot "hist-plot"
histogram [belief] of turtles
end 

to plot-pop-by-belief
set-current-plot "pop-by-belief"
  set-plot-pen-mode 2
  plotxy  (1 - (beliefs-in-circulation / count turtles)) (pop-with-shared-belief / count turtles) ;beliefs-in-circulation
end 

There is only one version of this model, created over 1 year ago by Anonymous Peer Review.

Attached files

File Type Description Last updated
Arational Belief Convergence.png preview Preview for 'Arational Belief Convergence' over 1 year ago, by Anonymous Peer Review Download

This model does not have any ancestors.

This model does not have any descendants.