--
You received this message because you are subscribed to the Google Groups "netlogo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/0637a224-78e4-4ce4-8400-7c6e0a636f6an%40googlegroups.com.
Hi,
I am completely new to Netlogo and ABM and would like some help in writing out my first model.
I am
seeking to measure social contagion of risk perception using the model. Each
turtle will first have a random base-line perception. The perception is influenced
by:
(1) if disaster occurs (i.e. occur whenever user presses the button of ‘disaster’)
à risk
perception will increase exponentially according to ticks, so as tick + 1,
baseline perception + baseline perception*0.5, as tick + 2, baseline perception
+ baseline perception*0.5^2
(2) Communication with other turtles à they can communicate at random, the more the two turtles communicate, the more similar their risk perception value becomes
The model will stop once all individual turtles’ risk perception equals the average risk perceptions of turtles.
I have started writing some codes but there are so many mistakes and it cannot run… would anyone be able to help? Thank you!
Also, it would be grate if anyone could help guide me on writing the disaster occurrence (1) influence part of the codes.
When I try running it in Netlogo, there are also problems of ‘go’ being turtle-only and I do not understand what went wrong, so it would be great if someone could guide me on that.
Thanks so much!
Cheers,
Hayli
--
Codes:
turtles-own
[ baseline-perception ; original perception value --> later turtles will connect with those that have similar original perception first
influenced-perception ; perception value after being influenced
weight-of-link ; number of times communicated with specific turtle
]
globals
[ influenced?
clustering-degree
]
to setup
clear-all
setup-patches
reset-ticks
tick
end
to go
earthquake
communicate
check-influence
degree-of-clustering
if all? turtles [ influenced? ] [ stop ]
update-turtles
end
to setup-patches
ask patches
[ sprout 1 ]
ask turtles
[ set baseline-perception ( random-float 3 ) ]
recolor-turtles
end
to earthquake
if ticks true/false
[ ask turtles
[ set influenced-perception (baseline-perception + baseline-perception * 0.5 ^ ticks) ]
] ;; I am not sure how to write this
end
to communicate
ask turtles [
let x [who] of one-of other turtles ; assuming connections made in random manner
ifelse link-neighbor? turtle x
[ ask link [who] of self x [set weight-of-link weight-of-link + 1]] ; if a link between self and turtle x is set, then update link weight
[ create-link-with turtle x] ; if no link, create a link
]
set influenced-perception
baseline-perception + 0.5 ^ weight-of-link
end
to check-influence
ask turtles
[ set influenced? influenced-perception = (sum [influenced-perception] of turtles-on neighbors) / count turtles-on neighbors ; stop when individual = average
]
end
to degree-of-clustering
let degree-of-similar 0
ask turtles
[ ifelse ( influenced? )
[ set degree-of-similar count ( turtles-on neighbors ) with [ influenced? = true ] / count turtles-on neighbors ]
[ set degree-of-similar count ( turtles-on neighbors ) with [ influenced? = false ] / count turtles-on neighbors ]
set clustering-degree clustering-degree + degree-of-similar
]
set clustering-degree clustering-degree / count turtles
end