Emperor's Dilemma

No preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0 • Viewed 454 times • Downloaded 26 times • Run 0 times
Download the 'Emperor's Dilemma' modelDownload this modelEmbed this model

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

globals [
  believers
fraction
compliers
non-compliers
true-enforcers
false-enforcers
non-enforcers
x-counter
y-counter
rounds
repetition
fraction-print
]

patches-own [
  done?
  total
  belief ; variable that determines whether an agent believes (belief = 1) or not (belief = -1)
  compliance ; variable that determines whether an agent believes (1) or not (-1)
  strength ; variable that determines the strength of an agent's compliance
  conviction ;
  enforcement ; variable that determines whether an agent enforces compliance (1), deviance (-1)
  need-for-enforcement ; variable that determines the need for enforcement for every agent
  believer
  disbelievers
  false-believers
  false-disbelievers
]

to setup
  clear-all


  set believers (Percent-Believers / 100) * count patches
  ifelse clustering
    [setup-with-clustering]
    [setup-without-clustering]
  determine-starting-values
  mark-patches
  ask patches [recolor-patches-after-setup]
end 

to setup-with-clustering
  ask patches
    [set belief 0]
  if believers > 0 [
    ask one-of patches with [belief = 0]
    [set belief 1]
  ]
  if believers > 0
    [cluster]
end 

to cluster
  ask patches
    [set total (sum [belief] of neighbors)]
  ask one-of patches with [belief = 0] [
    if total > 0
      [set belief 1]
  ]
  if sum [belief] of patches < believers
    [repeat 1
      [cluster]
    ]
end 

to setup-without-clustering
  ask patches [set belief 0]
  repeat believers [
    ask one-of patches with [belief = 0] [set belief 1]
  ]
end 

to determine-starting-values
  ask patches [
    ifelse belief = 0
      [set belief -1]
      [set belief 1]
  ]
  ask patches [
    if belief = 1
      [set strength 1]
  ]
  strength-determination-for-disbelievers
end 

to strength-determination-for-disbelievers
  loop [
    ask patches with [strength != 1] [set strength random-float max-strength-for-disbelievers]
    If precision (mean [strength] of patches with [strength != 1]) 5 = mean-strength-for-disbelievers
      [stop]
  ]
end 

; end of code for setup process

to go
  if rounds = rounds?
    [stop]
  ask patches [set done? false]
  ifelse embededdness
   [go-with-embededdness]
   [go-without-embededdness]
  set rounds rounds + 1
  mark-patches
  do-plots
end 

to go-with-embededdness

    ask patches [

       ifelse ((((-1 * belief) / 8) * (sum [enforcement] of neighbors)) > strength) ; procedure to determine whether to comply or not
         [set compliance (-1 * belief)]
         [set compliance belief]

       set need-for-enforcement ((1 - ((belief / 8) * (sum [compliance] of neighbors))) / 2) ; procedure to determine need for enforcement

       set enforcement 0 ; procedure to determine enforcement
       if ((strength * need-for-enforcement) > costs) and (belief = compliance)
         [set enforcement belief]
       if ((((-1 * belief) / 8) * (sum [enforcement] of neighbors)) > (strength + costs)) and (belief != compliance)
         [set enforcement -1 * belief]

       recolor-patches

       display
     ]
end 

to go-without-embededdness

    ask patches [
      ifelse (((-1 * belief) / 999) * (sum [enforcement] of patches)) > strength
        [set compliance (-1 * belief)]
        [set compliance belief]

      set need-for-enforcement ((1 - ((belief / 999) * (sum [compliance] of patches))) / 2)

      set enforcement 0
      if ((strength * need-for-enforcement) > costs) and (belief = compliance)
        [set enforcement belief]
      if ((((-1 * belief) / 999) * (sum [enforcement] of patches)) > (strength + costs)) and (belief != compliance)
        [set enforcement (-1 * belief)]


      recolor-patches

      display

    ]
end 

to mark-patches
  ask patches [
    ifelse (belief = 1)
      [set believer 1]
      [set believer 0]
    ifelse (belief = -1)
      [set disbelievers 1]
      [set disbelievers 0]
    ifelse (belief = -1) and (enforcement = 1)
      [set false-believers 1]
      [set false-believers 0]
  ]

  set fraction (sum [false-believers] of patches)/(sum [disbelievers] of patches)
  set compliers count patches with [compliance = 1]
  set non-compliers count patches with [compliance = -1]
  set true-enforcers count patches with [enforcement = belief]
  set false-enforcers count patches with [(enforcement != belief) and (enforcement != 0)]
  set non-enforcers count patches with [enforcement = 0]
  display
end 

to recolor-patches-after-setup
  if belief = 1
   [set pcolor yellow]
  if belief = -1
   [set pcolor green]
end 

to recolor-patches  ;


  if belief = -1 and compliance = -1    ; true disbeliever
  [ set pcolor green ]

  if belief = 1 and compliance = 1      ; true believer
  [set pcolor yellow ]

  if compliance = 1 and belief = -1     ; false believer
  [set pcolor blue]

  if compliance = -1 and belief = 1     ; false disbeliever
  [set pcolor black]

  if enforcement = 1 and belief = -1    ; false enforcer
  [set pcolor red]

  if enforcement = 1 and belief = 1     ; true enforcer
  [set pcolor white]
end 

to do-plots
  set-current-plot "Fraction of Disbelievers Encforcing the Norm"
  plot fraction
end 

There are 2 versions of this model.

Uploaded by When Description Download
Network Dynamics Group over 6 years ago Version update Download this version
Network Dynamics Group over 6 years ago Initial upload Download this version

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.