Guilherme Pontes (Spatial Modeling)

Spatial Modeling Assignments

Guilherme Pontes (Spatial Modeling)

Assignment 2

Lab 2

Segregation model using 499 ticks, 76%-similar-wanted and 2000 cells as shown in the picture below.

https://www.youtube.com/watch?v=I1QJK4CXhcU&feature=youtu.be

Screen Shot 2015-04-14 at 11.33.22 PM

• What minimum level of self-preference leads to emergent patterns of segregation?

The minimum level of self-preference that leads to emergent patterns of segregation in my opinion is around 30%-similar-wanted using 2000 cells.

Screen Shot 2015-04-14 at 11.07.17 PM

• Does a specific threshold level exist that tips the system into an unstable state?

Yes. Using 2000 cells the level of the specific threshold is 75%.

Screen Shot 2015-04-14 at 11.20.57 PM

 

https://www.youtube.com/watch?v=LuFGf1Qnmpg&feature=youtu.be

• How does increasing levels of self-preference change the nature of segregation patterns that emerge?

Increasing levels of self-preference change depending on the number of cells that were chosen. For example, if the number is 2000 and this number is kept between 0% and 75% it goes to unstable state. 76% and after, the model works infinitely.

Screen Shot 2015-04-14 at 11.53.17 PMScreen Shot 2015-04-14 at 11.55.59 PM

75% and 76% with more ticks than I used in the first model with 75%.

• What does the change in the unhappy-ratio at each time step tell you about the relationship between self-preference and the number of similar neighbors in one’s neighborhood?

The relationship is the amount of unhappy cells as the model rotates. As the graph of unhappy-ratio is falling the number of unhappy cells decreases.

• What general conclusions can be drawn from your answers to questions (i) to (iii)?

Between 0% and 75% the model will be in unstable state and after 75% the model will not stop working, running happy and unhappy cells. (Using 2000 cells)

Screen Shot 2015-04-14 at 11.53.17 PMScreen Shot 2015-04-14 at 11.54.01 PM

First picture (75%)                                            Second picture (82%)

 

Code:

globals [
percent-similar ;; on the average, what percent of a turtle’s neighbors
;; are the same color as that turtle?
percent-unhappy ;; what percent of the turtles are unhappy?
happy?-count
unhappy?-count
unhappy-ratio
]

turtles-own [
happy? ;; for each turtle, indicates whether at least %-similar-wanted percent of
;; that turtles’ neighbors are the same color as the turtle
similar-nearby ;; how many neighboring patches have a turtle with my color?
other-nearby ;; how many have a turtle of another color?
total-nearby ;; sum of previous two variables
]

to setup
clear-all
if number > count patches
[ user-message (word “This pond only has room for ” count patches ” turtles.”)
stop ]

;; create turtles on random patches.
ask n-of number patches
[ sprout 1
[ set color red ] ]
;; turn half the turtles green
ask n-of (number / 2) turtles
[ set color green ]
update-variables
reset-ticks
end

to go
if all? turtles [happy?] [ stop ]
move-unhappy-turtles
update-variables
tick
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 ] ;; keep going until we find an unoccupied patch
move-to patch-here ;; move to center of patch
end

to update-variables
update-turtles
update-globals
end

to update-turtles
ask turtles [
;; in next two lines, we use “neighbors” to test the eight patches
;; surrounding the current patch
set similar-nearby count (turtles-on neighbors)
with [color = [color] of myself]
set other-nearby count (turtles-on neighbors)
with [color != [color] of myself]
set total-nearby similar-nearby + other-nearby
set happy? similar-nearby >= ( %-similar-wanted * total-nearby / 100 )
]
end

to update-globals
let similar-neighbors sum [similar-nearby] of turtles
let total-neighbors sum [total-nearby] of turtles
set percent-similar (similar-neighbors / total-neighbors) * 100
set percent-unhappy (count turtles with [not happy?]) / (count turtles) * 100
set happy?-count (count turtles with [ happy?] )
set unhappy?-count (count turtles with [ not happy? ])
set unhappy-ratio ( percent-unhappy ) / ( percent-similar )
end

to make-movie
user-message “First, save your new movie file (Segragation.mpg)”
let path user-new-file if not is-string? path [ stop ]
;; stop if user canceled

;; run the model
setup
movie-start path
movie-grab-view
while [ ticks < 123 ]
[ go
movie-grab-view ]

;; export the movie
movie-close
user-message (word “Exported movie to ” path)
end

; Copyright 1997 Uri Wilensky.
; See Info tab for full copyright and license.

No Comments

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

Skip to toolbar