Attitudes and Behaviours towards Pollution

Attitudes and Behaviours towards Pollution preview image

3 collaborators

Steve Krone (Team member)
Rebecca Tyson (Team member)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.4 • Viewed 733 times • Downloaded 29 times • Run 0 times
Download the 'Attitudes and Behaviours towards Pollution' 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 [carbon] ;; keeps track of how much pollution there is

breed [polluters polluter]
breed [nonpolluters nonpolluter]

turtles-own [
  old-attitude
  new-attitude
  ]

to setup
  clear-all
  set-default-shape turtles "circle" ;; the way "set" commands work: the first argument is the object that will be turned into (or given the property of) whatever the second argument is
  ask patches [;; every patch will either have a polluter or a nonpolluter placed on them. The probability of one over the other is set by the ratio
    ifelse random-float 100 < polluter-to-nonpolluter-ratio [
      sprout-polluters 1 [ ;; "sprout-" just means that an agent of type  is created 
        set color red - 2
        set new-attitude (random init-pol-attitude + 1)] ;; the initial attitude is set to be between (inclusive) 1 and the ini-pol-attitude
    ]
    [
      sprout-nonpolluters 1 [ ;; this works the same as above, except for nonpolluters now
       set color yellow - 2
       set new-attitude (random init-npol-attitude + 1)
      ]
    ]
  ]
  ask turtles [ set old-attitude new-attitude ] ;; in order to do synchronous updating, we need to delay when agents update their attitudes, so we separate attitudes into new and old
  set carbon initial-pollution-level
  reset-ticks
end 

to go
  if carbon > (delay-armageddon * armageddon) [ stop ] ;; sometimes we want to see whether carbon could have been pulled back after the armageddon value is reach. We can introduce this by delaying when the simulation stops.
  ask polluters [
    if random-float 100 < prob-local-com [;;every polluter has some probablity of communicating with their local (8) neighbors
      let npol-list nonpolluters-on neighbors
      let pol-list polluters-on neighbors
      ifelse random-float 100 < (100 * ((carbon-sensitivity * carbon) / armageddon)) [ ;; the higher carbon is, the more likely polluters listen to nonpolluters
        if count turtle-set npol-list with [old-attitude > npol-behave-thresh] > pol-neighbor-stubbornness [ ;;number of nonpolluters behaving greater than polluter's stubbornness?
          set new-attitude new-attitude - 1
        ]
      ][
        if count turtle-set pol-list with [old-attitude > pol-behave-thresh] > pol-echochamber-thresh [
          entrench-pol-attitude ;; the code for this command is towards the end. It basically entrenches an attitude as long as it hasn't reach the maximum allowed level
        ]
      ]
    ]
  ]
  ask nonpolluters [ ;; this code should be the same as above, but with relevant changes for nonpolluters.
    if random-float 100 < prob-local-com [
      let pol-list polluters-on neighbors
      let npol-list nonpolluters-on neighbors
      ifelse random-float 100 < (100 * ((carbon-sensitivity * carbon) / armageddon))[ ;; the higher carbon is, the less likely nonpolluters listen to polluters
        if count turtle-set npol-list with [old-attitude > npol-behave-thresh] > npol-echochamber-thresh [
          entrench-npol-attitude
        ] 
      ][
        if count turtle-set pol-list with [old-attitude > pol-behave-thresh] > npol-neighbor-stubbornness [;; number of polluters behaving greater than nonpolluter's stubbornnes?
          set new-attitude new-attitude - 1
        ]
      ]
    ]
  ]
  ask turtles [
    if random-float 100 < prob-non-local-com [;; every agent (or "turtle") has a probability of communicating non-locally
      let tlist []
      while [count turtle-set tlist < 8] [;;after a turtle has been selected, a random set of 8 other turtles are picked
        set tlist fput one-of turtles tlist ;; pick a random turtle until you have a list containing n turtles
      ] 
      let nlist turtle-set tlist ;; turns the list of turtles into an agent set (this tells netlogo to treat the objects in the list as agents)
      if is-polluter? self [;; if the "center" agent that's about to interact with the 8 non-local "neighbors" is a polluter, then ...
        ifelse random-float 100 < (100 * ((carbon-sensitivity * carbon) / armageddon))[
          if count turtle-set nlist with [old-attitude > npol-behave-thresh and breed = nonpolluters] > pol-neighbor-stubbornness [
            set new-attitude new-attitude - 1
          ]
        ];;if the "center" agent isn't a polluter, then they have to be a nonpolluter, that's why the "ifelse" command was used
        [ 
          if count turtle-set nlist with [old-attitude > pol-behave-thresh and breed = polluters] > pol-echochamber-thresh [
            entrench-pol-attitude
          ]
        ] 
      ]
      if is-nonpolluter? self [
        ifelse random-float 100 < (100 * ( (carbon-sensitivity * carbon) / armageddon))[
          if count turtle-set nlist with [old-attitude > npol-behave-thresh and breed = nonpolluters] > npol-echochamber-thresh [
            entrench-npol-attitude
          ]
        ]
        [ 
          if count turtle-set nlist with [old-attitude > pol-behave-thresh and breed = polluters] > npol-neighbor-stubbornness [
            set new-attitude new-attitude - 1
          ]
        ]
      ]
    ]
  ]
  ask polluters with [new-attitude <= 0] [ ;; this turns polluters with a new-attitude of 0 into a nonpolluter with an attitude of 1
    set breed nonpolluters
    set color yellow - 2
    set new-attitude 1
  ]
  ask nonpolluters with [new-attitude <= 0] [ ;; this turns nonpolluters with a new-attitude of 0 into a polluter with an attitude of 1
   set breed polluters
   set color red - 2
   set new-attitude 1
    
  ]
  ask turtles [ 
    set old-attitude new-attitude ;; all the agents now synchronically update
    if is-polluter? self [ ;; for those polluters with an attitude at or above the behaviour threshold, they become "bright", else they are "dimmed"
      ifelse old-attitude >= pol-behave-thresh [ set color red] [set color red - 2]
    ]
    if is-nonpolluter? self [
      ifelse old-attitude >= npol-behave-thresh [ set color yellow] [set color yellow - 2]
    ]
   ]
  calculate-carbon ;;the code for updating carbon is below
  tick ;; this keeps track of how much time has gone by. It adds a "tick" once we reach the code here. It effectively counts every synchronis update
end 

to entrench-pol-attitude
  if new-attitude < pol-max-entrench [ set new-attitude new-attitude + 1 ]
end 

to entrench-npol-attitude
  if new-attitude < npol-max-entrench [ set new-attitude new-attitude + 1 ]
end 

to calculate-carbon
  ask turtles [ ;;carbon is updated by adding to past carbon the amount that each agent contributes to carbon. Note that some nonpolluters can still contribute carbon if the max-carbon-offset parameter is lower than max-carbon-contribution
    let x [new-attitude] of self
    if is-nonpolluter? self [ set x (0 - x) ]
    let y ((((max-carbon-contribution - max-carbon-offset) / (pol-max-entrench + npol-max-entrench)) * (x + npol-max-entrench)) + max-carbon-offset )
    set carbon carbon + y
  ]
  if carbon <= 0 [ set carbon 0 ]
end 












There is only one version of this model, created over 5 years ago by Bert Baumgaertner.

Attached files

File Type Description Last updated
Attitudes and Behaviours towards Pollution.png preview Preview for 'Attitudes and Behaviours towards Pollution' over 5 years ago, by Bert Baumgaertner Download

This model does not have any ancestors.

This model does not have any descendants.