Cascading Crises Replica

No preview image

1 collaborator

Default-person Jean van Haperen (Author)

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.5 • Viewed 107 times • Downloaded 11 times • Run 0 times
Download the 'Cascading Crises Replica' 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 [radius]

turtles-own
  [
  recession
  treshold
  ]

to setup
  __clear-all-and-reset-ticks
  set-default-shape turtles "house"
  create-ordered-turtles 17
 [
  set radius max-pxcor - 2
    fd radius
    set size 3
    set color blue
    set size 3
    set recession 0
    set treshold random-normal meanTreshold 1
   ]    setup-network
end 

to-report is-linkable?
  report (count link-neighbors < numberOfLinks) 
end 

to-report willing?
  report (count my-links < numberOfLinks)
end 

to setup-network
  ask-concurrent turtles [
  repeat numberOfLinks
  [let choices turtles with
  [self != myself and willing? and not link-neighbor? myself]
  if any? choices
  [let choice (min-one-of choices [distance myself])
  if willing? [create-link-with choice]]]]
  
  
  ask turtles
  [create-links-with turtles with [self != myself and
                                    random-float 1.0 < linkageProbability]]
end 
  


;"random
;Generates a new random network of nb-nodes turtles in which each one has a connection probability (between 0 and 1) of being connected to each other turtles (this is specified through the connection-prob slider). The algorithm uses the Erdős–Rényi model."

to go
  if ticks >= 136 [ stop ]
  ask-concurrent turtles
   [ifelse recession != 1
         [ifelse count turtles with [recession = 1] > treshold
                [without-interruption [endogeneousRecession]]
                [without-interruption [exogeneousRecession]]]
         [without-interruption [recover]]
   ]
   ask turtles [ifelse recession = 1 
     [set color red]
     [set color blue]]
   tick
   display
end 

to endogeneousRecession
  if count link-neighbors with [recession = 1] > treshold
  [set recession 1]
end 

to exogeneousRecession
  if random-float 1 > (1 - probRecession) [ set recession 1 ]
  set color (blue - (recession * 34))
end 

to recover
  if random-float 1 > (1 - probRecovery) [ set recession 0]
  set color blue
end 

There is only one version of this model, created about 5 years ago by Jean van Haperen.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.