MARAS
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; GLOBALS & TURTLE VARIABLES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; globals [ percent-believers percent-similar percent-unhappy ] turtles-own [ believer? personal-faith type-id happy? similar-nearby other-nearby total-nearby ] to setup clear-all ask patches [ set pcolor white ] ask patches [ if random 100 < density [ sprout 1 [ set size 1.3 set type-id 1 + random num-types if type-id = 1 [ set personal-faith 2 ;; logistic(2) ~ 0.88 set believer? (random-float 1 < 0.9) ] if type-id = 2 [ set personal-faith 0.5 ;; logistic(0.5) ~ 0.62 set believer? (random-float 1 < 0.6) ] if type-id = 3 [ set personal-faith -0.5 ;; logistic(-0.5) ~ 0.38 set believer? (random-float 1 < 0.3) ] if type-id = 4 [ set personal-faith -2 ;; logistic(-2) ~ 0.12 set believer? (random-float 1 < 0.1) ] recolor-self ] ] ] update-turtles update-globals reset-ticks end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; MAIN LOOP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to go if not any? turtles [ stop ] if ticks > 5000 [ stop ] update-beliefs update-turtles move-unhappy-turtles update-turtles update-globals update-plot tick end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; BELIEF UPDATING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to update-beliefs ask turtles [ let nbr-patches (ifelse-value von-neumann? [ neighbors4 ] [ neighbors ]) let nbrs turtles-on nbr-patches let social-influence 0 if any? nbrs [ set social-influence (count nbrs with [ believer? ]) / count nbrs ] let conv-prob clamp01 (0.8 * social-influence + 0.6 * logistic personal-faith + missionary-rate) let deconv-prob clamp01 (dropout-rate + 0.3 * (1 - social-influence)) if random-float 1 < conv-prob [ set believer? true ] if random-float 1 < deconv-prob [ set believer? false ] recolor-self ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; SATISFACTION & MOVEMENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to update-turtles ask turtles [ let nbr-patches (ifelse-value von-neumann? [ neighbors4 ] [ neighbors ]) let nbrs turtles-on nbr-patches set similar-nearby count nbrs with [ believer? = [ believer? ] of myself ] set other-nearby count nbrs with [ believer? != [ believer? ] of myself ] set total-nearby similar-nearby + other-nearby if total-nearby = 0 [ set happy? true ] if total-nearby > 0 [ set happy? similar-nearby >= (%-similar-wanted * total-nearby / 100) ] if visualization = "old" [ set shape "default" set size 1.3 ] if visualization = "square-x" [ ifelse happy? [ set shape "square" ] [ set shape "X" ] set size 1.3 ] ] end to move-unhappy-turtles ask turtles with [ not happy? ] [ find-new-spot ] end to find-new-spot rt random-float 360 fd random-float 10 if any? other turtles-here [ find-new-spot ] move-to patch-here end to recolor-self if believer? [ if type-id = 1 [ set color 105 ] if type-id = 2 [ set color 105 - 1 ] if type-id = 3 [ set color sky ] if type-id = 4 [ set color cyan ] ] if not believer? [ if type-id = 1 [ set color 27 ] if type-id = 2 [ set color 27 + 1 ] if type-id = 3 [ set color 27 + 2 ] if type-id = 4 [ set color 27 + 3 ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; GLOBAL METRICS & PLOT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to update-globals let total count turtles if total = 0 [ set percent-believers 0 set percent-similar 0 set percent-unhappy 0 stop ] set percent-believers 100 * (count turtles with [ believer? ]) / total let similar-neighbors sum [ similar-nearby ] of turtles let total-neighbors sum [ total-nearby ] of turtles if total-neighbors > 0 [ set percent-similar 100 * similar-neighbors / total-neighbors ] set percent-unhappy 100 * (count turtles with [ not happy? ]) / total end to update-plot set-current-plot "Believer Share" set-plot-y-range 0 100 set-current-plot-pen "share" plotxy ticks percent-believers end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; UTILITY FUNCTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to-report clamp01 [x] if x < 0 [ report 0 ] if x > 1 [ report 1 ] report x end to-report logistic [x] report 1 / (1 + exp (- x)) end
There are 2 versions of this model.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.
Download this model