Lab 4 with all the sliders in maximum value (1)
https://www.youtube.com/watch?v=9DRA09ITNXo&feature=youtu.be
1 – Why is it important to test each of your sub models independently? Explain how you tested the sub-components of the main model using images and text to illustrate your methods and explain how your diagnostics conformed (or not) to your expectations.
Because some sub models rely on others as most of the sub models in the code of the lab 4. Many mistakes appear and sometimes we have to be aware of some details. The error in a code leads to another errors. We have to test both the code, understand what is wrong and test in the interface, buttons, sliders, inputs and switchers.
2 – The methods for calculating the components of utility are deterministic in this model. How is stochasticity implemented in the model? What parameter influences the degree of stochasticity?
The stochasticity is implemented in this model in the n_test variable because it changes the amount of randomly cells that a resident can move to at each tick.
https://www.youtube.com/watch?v=pI9RHVB_rr4&feature=youtu.be
n_test with 16 is faster if I use 300 to get 300 Homes.
https://www.youtube.com/watch?v=DtouhThynpQ&feature=youtu.be
n_test with 300 takes more time than using 16.
3 – How is initial environmental heterogeneity implemented in this model and what parameter or parameters determine its importance? Do you think that greater environmental heterogeneity corresponds to greater variability among replicate model runs, and why? Support your argument with evidence from replicate simulations with and without initial environmental heterogeneity.
The initial environmental heterogeneity implemented in this model is the black background with 2 yellow points with the possibility to add new houses clicking in “go once”. The green background comes to show the distance to service and the blue background shows the utility. The greater environmental heterogeneity corresponds to greater variability among replicate model runs.
4 – Explain the roles of feedbacks and path dependence in this model. How are the two concepts related? How do the three parameters for preference relate to feedbacks and path dependence? What parameter settings would you use to eliminate any effect of feedbacks or path dependence?
The parameters in this model complement each other. The sliders neighborhood density preference, aesthetic quality preference, and distance services preference they have different results but all of them have preference for near proximity. As we can see in the pictures below that I took in my model, the results are different when I turn on just one parameter. The parameter that I used is in the title of the video/picture.
https://www.youtube.com/watch?v=bGsBvTJixG4&feature=youtu.be
https://www.youtube.com/watch?v=9Vh3c_Vxe3I&feature=youtu.be
https://www.youtube.com/watch?v=Xnb16WivLr0&feature=youtu.be
5 – Describe at least two of the model assumptions or simplifications and how they could influence your interpretation of model results. Despite these assumptions and limitations, what can we learn from this model?
For sure people wouldn’t have parameters like what we used in the model to help them to choose where to live but these parameters help us to understand how it works so close in the real life.
code:
patches-own
[
status
aesthetic_quality
distance_to_service
utility
neighborhood_density
]
globals[
max_dist
aes_min
aes_max
most_recent
n_centers
]
to setup
clear-all
reset-ticks
ask patches[
set status “empty”
]
ask patch 25 25 [
set status “attraction”
set pcolor yellow
]
ask patch 75 75 [
set status “attraction”
set pcolor yellow
]
set max_dist (sqrt (2 * ( world-height ^ 2)))
ask patches [set distance_to_service 1]
if initial_center? = true [
ask patch 50 50 [
set status “center”
set pcolor green
]
ask patches [calculate_service_distance]
set n_centers 1
]
ask patches [calculate_service_distance]
end
to calculate_service_distance
if n_centers > 0 [
set distance_to_service
1 – (distance (min-one-of patches with
[status = “center”] [distance myself]) /
max_dist)
]
end
to show_distance_to_service
let service_min min [distance_to_service] of patches
ifelse count patches with [status = “center”] > 0
[
ask patches [calculate_service_distance]
ask patches[
if status = “empty” [
set pcolor scale-color green distance_to_service
service_min 1
]
]
]
[
ask patches [
if status = “empty” [ set pcolor green]
]
]
end
to calculate_aesthetic_quality
ask patches[
set aesthetic_quality max list
0
(max_dist – distance min-one-of patches
with [status = “attraction”]
[distance myself]) / max_dist
]
set aes_min min [aesthetic_quality] of patches
set aes_max max [aesthetic_quality] of patches
end
to show_aesthetic_quality
ask patches[
if status = “empty” [
set pcolor scale-color green aesthetic_quality aes_min aes_max
]
]
end
to calculate_utility
calculate_neighborhood_density
calculate_service_distance
set utility (aesthetic_quality ^
aesthetic_quality_preference) * (distance_to_service ^
distance_services_preference) * (1 – (abs (ideal_density
– neighborhood_density))) ^
neighborhood_density_preference
end
to show_utility
ask patches [calculate_neighborhood_density]
ask patches [calculate_utility]
let utility_min min [utility] of patches
let utility_max max [utility] of patches
ask patches[
if status = “empty”[
ifelse utility_min = utility_max
[set pcolor blue]
[set pcolor scale-color blue utility utility_min
utility_max]
]
]
end
to new_resident
let potential_cells n-of n_test patches with [status =
“empty”]
ask potential_cells [
calculate_utility
]
ask max-one-of potential_cells [utility] [
set pcolor 125
set status “home”
]
set most_recent max-one-of potential_cells [utility]
end
to add_service
ask most_recent[
let radius_temp 1
let check_neighborhood patches in-radius radius_temp
while [count check_neighborhood with [status =
“empty”] = 0]
[
set radius_temp radius_temp + 1
set check_neighborhood patches in-radius
radius_temp
]
ask one-of check_neighborhood with [status = “empty”]
[
set status “center”
set pcolor green
]
]
set n_centers n_centers + 1
end
to go
new_resident
tick
if ticks mod 20 = 0[
add_service
]
if ticks >= max_homes [stop]
end
to calculate_neighborhood_density
set neighborhood_density 0.5 + 0.5 * (count neighbors
with [status = “home”] / count neighbors)
end
to make-movie
user-message “First, save your new movie file (lab4.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 < 100 ]
[ go
movie-grab-view ]
;; export the movie
movie-close
user-message (word “Exported movie to ” path)
end
There are no comments yet...Kick things off by filling out the form below.