ideology

No preview image

1 collaborator

Default-person ray morrison (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.4.0 • Viewed 37 times • Downloaded 1 time • Run 0 times
Download the 'ideology' 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

;; Ideological dominance in organisations

;; globals
globals [
  turnover-count
  senior-left-prop ;; proportion of left ideology senior staff
  senior-centre-prop
  senior-right-prop
  other-left-prop
  other-centre-prop
  other-right-prop
]

;; agents
turtles-own [
  ideology ;; "left", "centre", or "right"
  influence ;; 0-10
  happiness ;; 0-10
  to-be-replaced? ;; boolean for marking turnover
]

;; setup procedure

to setup
  clear-all
  set turnover-count 0
  ask-user-for-proportions
  setup-turtles

  ;; plot setup
  set-current-plot "ideology distribution over time"
  set-plot-y-range 0 (senior-staff + other-staff)

  create-temporary-plot-pen "left" ;; define the pen for 'left'
  set-plot-pen-color red

  create-temporary-plot-pen "centre" ;; define the pen for 'centre'
  set-plot-pen-color grey

  create-temporary-plot-pen "right" ;; define the pen for 'right'
  set-plot-pen-color blue

  reset-ticks
end 

to ask-user-for-proportions
  ;; get proportions from sliders and calculate centre proportion
  set senior-left-prop senior-left-ratio
  set senior-right-prop senior-right-ratio
  set senior-centre-prop 100 - senior-left-prop - senior-right-prop

  set other-left-prop other-left-ratio
  set other-right-prop other-right-ratio
  set other-centre-prop 100 - other-left-prop - other-right-prop

  ;; ensure the centre proportion is not negative
  if senior-centre-prop < 0 [ set senior-centre-prop 0 ]
  if other-centre-prop < 0 [ set other-centre-prop 0 ]

  show (word "senior staff proportions - left: " senior-left-prop ", centre: " senior-centre-prop ", right: " senior-right-prop)
  show (word "other staff proportions - left: " other-left-prop ", centre: " other-centre-prop ", right: " other-right-prop)
end 

to setup-turtles
  ;; create senior staff
  create-turtles senior-staff [
    set shape "circle" ;; set shape for senior
    set ideology choose-ideology senior-left-prop senior-centre-prop senior-right-prop
      set influence random-float 40 + 60 ;; random between 60 and 100
    set happiness random 11 ;; random between 0 and 10
    set to-be-replaced? false ;; initialize to false
    setxy random-xcor random-ycor
    colour-based-on-ideology ;; set colour based on ideology
  ]

  ;; create other staff
  create-turtles other-staff [
    set shape "square"
    set ideology choose-ideology other-left-prop other-centre-prop other-right-prop
      set influence random-float 40;; random between 0 and 40
    set happiness random 11 ;; random between 0 and 10
    set to-be-replaced? false ;; initialize to false
    setxy random-xcor random-ycor
    colour-based-on-ideology ;; set colour based on ideology
  ]
end 

to-report choose-ideology [left-prop centre-prop right-prop]
  let r random-float 100
  if r < left-prop [ report "left" ]
  if r < (left-prop + centre-prop) [ report "centre" ]
  report "right"
end 

to colour-based-on-ideology
  if ideology = "left" [ set color red ]
  if ideology = "centre" [ set color grey ]
  if ideology = "right" [ set color blue ]
end 

;; go procedure

to go
  ask turtles [ move ]
  ask turtles [ interact ]
  check-turnover
  create-new-turtles

  ;; update the ideology distribution plot
  set-current-plot-pen "left"
  plot count turtles with [ideology = "left"]

  set-current-plot-pen "centre"
  plot count turtles with [ideology = "centre"]

  set-current-plot-pen "right"
  plot count turtles with [ideology = "right"]

  tick
end 

;; turtle procedures

to move
  rt random 360
  fd 1
  if any? other turtles-here [
    setxy random-xcor random-ycor ;; prevent moving into the same cell
  ]
end 

to interact
  let neighbour one-of turtles-on neighbors4
  if neighbour != nobody [
    if [ideology] of neighbour != ideology [
      if [influence] of neighbour > influence [
        ifelse shape = "circle" and [shape] of neighbour = "square" [
          ;; nenior interacts with other staff with different ideology
          set happiness happiness - 1
        ][
          set happiness happiness - 1 ;; non-senior interaction - these are the same right now but could be changed
        ]
      ]
    ]
    if [ideology] of neighbour = ideology [
      set happiness happiness + 1 ;; happiness increases for same ideology interaction
    ]
  ]
end 

to check-turnover
  ;; mark turtles for turnover
  ask turtles [
    if happiness < happiness-threshold [
      set to-be-replaced? true
    ]
  ]

  ;; remove marked turtles
  ask turtles with [to-be-replaced?] [
    set turnover-count turnover-count + 1
    die
  ]
end 

to create-new-turtles
  let num-new-turtles (senior-staff + other-staff) - count turtles
  create-turtles num-new-turtles [
    ifelse random-float 1 < (senior-staff / (senior-staff + other-staff)) [
      ;; creating senior staff
      set shape "circle" ;; shape for senior staff
      set ideology choose-ideology senior-left-prop senior-centre-prop senior-right-prop
      set influence random-float 40 + 60 ;; random between 60 and 100
    ] [
      ;; creating other staff
      set shape "square" ;; shape for other staff
      set ideology choose-ideology other-left-prop other-centre-prop other-right-prop
      set influence random-float 40;; random between 0 and 40
    ]
    set happiness random 11
    set to-be-replaced? false ;; reset marker to false
    setxy random-xcor random-ycor
    colour-based-on-ideology ;; set colour based on ideology
  ]
end 

There is only one version of this model, created 3 months ago by ray morrison.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.