The American Dream 2
No preview image
Model was written in NetLogo 5.0.3
•
Viewed 296 times
•
Downloaded 27 times
•
Run 0 times
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 [ percent-similar- quad1resources quad2resources quad3resources quad4resources quad5resources quad6resources quad7resources quad8resources quad0resources quad0turtles1 quad0turtles2 quad0turtles3 quad0turtles4 quad0turtles5 quad0turtles6 quad4classlow quad4classmid quad4classhigh quad7ethnicityorange quad7ethnicityblue quad1satis quad2satis quad3satis quad4satis quad5satis quad6satis quad7satis quad8satis quad9satis ] turtles-own [ satisfied ;; for each turtle, indicates whether or not it is satisfied with its current position racialsatisfaction classsatisfaction blue? ;; for each tu orange? upper-class? middle-class? lower-class? group class resources similar-ethnicity-nearby other-ethnicity-nearby acceptable-resource-nearby desired-class-nearby total-nearby percent-ethnicity-nearby percent-class-nearby tquadrant destinationperc destination choice1hap choice2hap choice3hap income cost-of-living sim-satisfied econ-satisfied income-increase economic-risk ] patches-own [ presources quadrant open? ] to update-turtles ask turtles [ if class = 1 [set desired-class-nearby count (turtles in-radius 5) with [class = 1]] if class = 2 [set desired-class-nearby (count (turtles in-radius 5) with [class = 1] * upward-class-bias + (count (turtles in-radius 5) with [class = 2]))] if class = 3 [set desired-class-nearby (count (turtles in-radius 5) with [class = 2] * upward-class-bias + (count (turtles in-radius 5) with [class = 1]))] if blue? [set similar-ethnicity-nearby count (turtles in-radius 5) with [blue? = true] set other-ethnicity-nearby count (turtles in-radius 5) with [orange? = true]] if orange? [set similar-ethnicity-nearby count (turtles in-radius 5) with [orange? = true] set other-ethnicity-nearby count (turtles in-radius 5) with [blue? = true]] set total-nearby (similar-ethnicity-nearby + other-ethnicity-nearby) set percent-ethnicity-nearby (similar-ethnicity-nearby / total-nearby) ifelse similar-ethnicity-wanted > percent-ethnicity-nearby [set racialsatisfaction 1 - (similar-ethnicity-wanted - percent-ethnicity-nearby)] [set racialsatisfaction 1] set percent-class-nearby (desired-class-nearby / total-nearby) ifelse class-level-desired > percent-class-nearby [set classsatisfaction 1 - (class-level-desired - percent-class-nearby)] [set classsatisfaction 1] set satisfied percent-racial * racialsatisfaction + (1 - percent-racial) * classsatisfaction ;set econ-satisfied .3 * (.2 * income - cost-of-living) / cost-of-living + .5 ;set satisfied sim-satisfied * (1 - percent-econ-motiv) + percent-econ-motiv * econ-satisfied set tquadrant quadrant ] end to update-globals ifelse not any? turtles with [tquadrant = 0] [set quad0resources 0] [set quad0resources mean [resources] of turtles with [tquadrant = 0]] ifelse not any? turtles with [tquadrant = 1] [set quad8resources 0] [set quad1resources mean [resources] of turtles with [tquadrant = 1]] ifelse not any? turtles with [tquadrant = 2] [set quad8resources 0] [set quad2resources mean [resources] of turtles with [tquadrant = 2]] ifelse not any? turtles with [tquadrant = 3] [set quad8resources 0] [set quad3resources mean [resources] of turtles with [tquadrant = 3]] ifelse not any? turtles with [tquadrant = 4] [set quad8resources 0] [set quad4resources mean [resources] of turtles with [tquadrant = 4]] ifelse not any? turtles with [tquadrant = 5] [set quad8resources 0] [set quad5resources mean [resources] of turtles with [tquadrant = 5]] ifelse not any? turtles with [tquadrant = 6] [set quad8resources 0] [set quad6resources mean [resources] of turtles with [tquadrant = 6]] ifelse not any? turtles with [tquadrant = 7] [set quad8resources 0] [set quad7resources mean [resources] of turtles with [tquadrant = 7]] ifelse not any? turtles with [tquadrant = 8] [set quad8resources 0] [set quad8resources mean [resources] of turtles with [tquadrant = 8]] set quad0turtles1 count turtles with [group = 1] with [tquadrant = 0] set quad0turtles2 count turtles with [group = 2] with [tquadrant = 0] set quad0turtles3 count turtles with [group = 3] with [tquadrant = 0] set quad0turtles4 count turtles with [group = 4] with [tquadrant = 0] set quad0turtles5 count turtles with [group = 5] with [tquadrant = 0] set quad0turtles6 count turtles with [group = 6] with [tquadrant = 0] set quad4classlow count turtles with [group = 1 or group = 4] with [tquadrant = 4] set quad4classmid count turtles with [group = 2 or group = 5] with [tquadrant = 4] set quad4classhigh count turtles with [group = 3 or group = 6] with [tquadrant = 4] set quad7ethnicityorange count turtles with [group = 1 or group = 2 or group = 3] with [tquadrant = 7] set quad7ethnicityblue count turtles with [group = 4 or group = 5 or group = 6] with [tquadrant = 7] end to update-resources let rangen2 random 10 if rangen2 = 4 [ ask turtles [ set income income + income-increase ] ; change income] assign-color ask turtles [ set cost-of-living .10 * (mean [resources] of turtles with [tquadrant = [tquadrant] of myself]) set resources resources + income - cost-of-living]] end to assign-quadrant ask patches [ if pxcor <= -8 and pxcor > -25 and pycor <= 25 and pycor > 8 [set quadrant 0 set pcolor 1] if pxcor <= 8 and pxcor > -8 and pycor <= 25 and pycor > 8 [set quadrant 1 set pcolor 3] if pxcor <= 25 and pxcor > 8 and pycor <= 25 and pycor > 8 [set quadrant 2 set pcolor 1] if pxcor <= -8 and pxcor > -25 and pycor <= 8 and pycor > -8 [set quadrant 3 set pcolor 3] if pxcor <= 8 and pxcor > -8 and pycor <= 8 and pycor > -8 [set quadrant 4 set pcolor 1] if pxcor <= 25 and pxcor > 8 and pycor <= 8 and pycor > -8 [set quadrant 5 set pcolor 3] if pxcor <= -8 and pxcor > -25 and pycor <= -8 and pycor > -25 [set quadrant 6 set pcolor 1] if pxcor <= 8 and pxcor > -8 and pycor <= -8 and pycor > -25 [set quadrant 7 set pcolor 3] if pxcor <= 25 and pxcor > 8 and pycor <= -8 and pycor > -25 [set quadrant 8 set pcolor 1]] end to calc-quad-satis [quad groupnum] end to setup clear-all if number > count patches [ user-message (word "This city only has room for" count patches " turtles .") stop ] ;; create turtles on random patches. ask n-of number patches [ sprout 1 [ set color 27] ] ;; turn ask turtles [ if xcor <= 25 and xcor > 16 [set income (random 15) / 10 + .5 set orange? true set blue? false]; assign resources instead of group and then use if statement to assign group if xcor <= 16 and xcor > 8 [set income (random 20) / 10 + 2 set orange? true set blue? false] if xcor <= 8 and xcor > 0 [set income (random 20) / 10 + 4 set orange? true set blue? false] if xcor <= 0 and xcor > -8 [set income (random 20) / 10 set blue? true set orange? false] if xcor <= -8 and xcor > -16 [set income (random 20) / 10 + 2 set blue? true set orange? false] if xcor <= -16 and xcor >= -25 [set income (random 20) / 10 + 4 set blue? true set orange? false]] assign-color ask turtles [ find-fresh-patch if class = 1 [set resources upper-resources] if class = 2 [set resources middle-resources] if class = 3 [set resources lower-resources] set income-increase random-normal 0 .004 set economic-risk random-normal (1 - gentrify) .2 ] assign-quadrant reset-ticks end to assign-color ask turtles[ if income < 2 and orange? = true [set group 1 set color 27 set class 3] if income >= 2 and income < 5 and orange? = true [set group 2 set color 25 set class 2] if income >= 4 and orange? = true [set group 3 set color 22 set class 1] if income < 2 and blue? = true [set group 4 set color 86 set class 3] if income >= 2 and income < 5 and blue? = true [set group 5 set color 93 set class 2] if income >= 4 and blue? = true [set group 6 set color 102 set class 1]] end to go update-turtles update-patches update-globals update-resources move-turtles update-plot tick end to update-patches ask patches [ set open? not any? turtles-here ] end to move-turtles ask turtles [ let choice1 random 9 let choice2 random 9 let choice3 tquadrant;; generate 3 random quadrants that a turtle has knowledge of. these are candidates for movement (need to set choice 3 to own quadrant) let rangen3 (random 100) / 100 ifelse rangen3 > percent-econ-motiv [set choice1hap .35 if any? turtles with [group = [group] of myself and tquadrant = choice1] [set choice1hap mean [satisfied] of turtles with [group = [group] of myself and class = [class] of myself and tquadrant = choice1]] ;? true] ;and turtles-on patch with [quadrant = choice1] set choice2hap .35 if any? turtles with [group = [group] of myself and tquadrant = choice2] [set choice2hap mean [satisfied] of turtles with [group = [group] of myself and class = [class] of myself and tquadrant = choice2]] ;and turtles-on patch with [quadrant = choice2] set choice3hap .35 if any? turtles with [group = [group] of myself and tquadrant = choice3] [set choice3hap mean [satisfied] of turtles with [group = [group] of myself and class = [class] of myself and tquadrant = choice3]] ;and turtles-on patch with [quadrant = choice3] ifelse choice1hap >= choice2hap [ifelse choice1hap >= choice3hap [set destination choice1 set destinationperc choice1hap] [set destination choice3 set destinationperc choice3hap]] [ifelse choice2hap >= choice3hap [set destination choice2 set destinationperc choice2hap] [set destination choice3 set destinationperc choice3hap]] let destinations destination if destinationperc > satisfied [if mean [cost-of-living] of turtles with [tquadrant = destination] < resources [let rangen random 6 if rangen = 2 [ set resources resources - move-cost if any? patches with [quadrant = destinations and open? = true] [move-to one-of patches with [quadrant = destinations and open? = true] if not open? [move-turtles]] if any? other turtles-here [find-fresh-patch2] move-to patch-here] ]]] ;else condition [set choice1hap .2 * resources if any? turtles with [tquadrant = choice1] [set choice1hap abs (.1 * economic-risk * resources - mean [cost-of-living] of turtles with [tquadrant = choice1])] ;? true] ;and turtles-on patch with [quadrant = choice1] set choice2hap .2 * resources if any? turtles with [tquadrant = choice2] [set choice2hap abs (.1 * economic-risk * resources - mean [cost-of-living] of turtles with [tquadrant = choice2])] ;and turtles-on patch with [quadrant = choice2] set choice3hap .2 * resources if any? turtles with [tquadrant = choice3] [set choice3hap abs (.1 * economic-risk * resources - mean [cost-of-living] of turtles with [tquadrant = choice3])] ifelse choice1hap <= choice2hap [ifelse choice1hap <= choice3hap [set destination choice1 set destinationperc choice1hap] [set destination choice3 set destinationperc choice3hap]] [ifelse choice2hap <= choice3hap [set destination choice2 set destinationperc choice2hap] [set destination choice3 set destinationperc choice3hap]] let destinations destination let rangen random 6 if rangen = 2 [ set resources resources - move-cost if any? patches with [quadrant = destinations and open? = true] [move-to one-of patches with [quadrant = destinations and open? = true] if not open? [move-turtles]] if any? other turtles-here [find-fresh-patch2] move-to patch-here] ]] ;and turtles-on patch with [quadrant = choice3] ;; move to the quandrant where turtles of the same kind are happiest end to find-fresh-patch rt random-float 360 fd random-float 100 if any? other turtles-here [find-fresh-patch] move-to patch-here end to find-fresh-patch2 rt random-float 360 fd random-float 5 if any? other turtles-here [find-fresh-patch2] move-to patch-here end to update-plot set-current-plot "Racial Satisfaction (by Quadrant)" set-current-plot-pen "orange" plot-pen-reset set-plot-pen-mode 1 ;; bar mode set-plot-pen-color orange ifelse not any? turtles with [orange? = true and tquadrant = 0] [plot 0] [plot mean [racialsatisfaction] of turtles with [orange? = true and tquadrant = 0]] ifelse not any? turtles with [orange? = true and tquadrant = 1] [plot 0] [plot mean [racialsatisfaction] of turtles with [orange? = true and tquadrant = 1]] ifelse not any? turtles with [orange? = true and tquadrant = 2] [plot 0] [plot mean [racialsatisfaction] of turtles with [orange? = true and tquadrant = 2]] ifelse not any? turtles with [orange? = true and tquadrant = 3] [plot 0] [plot mean [racialsatisfaction] of turtles with [orange? = true and tquadrant = 3]] ifelse not any? turtles with [orange? = true and tquadrant = 4] [plot 0] [plot mean [racialsatisfaction] of turtles with [orange? = true and tquadrant = 4]] ifelse not any? turtles with [orange? = true and tquadrant = 5] [plot 0] [plot mean [racialsatisfaction] of turtles with [orange? = true and tquadrant = 5]] ifelse not any? turtles with [orange? = true and tquadrant = 6] [plot 0] [plot mean [racialsatisfaction] of turtles with [orange? = true and tquadrant = 6]] ifelse not any? turtles with [orange? = true and tquadrant = 7] [plot 0] [plot mean [racialsatisfaction] of turtles with [orange? = true and tquadrant = 7]] ifelse not any? turtles with [orange? = true and tquadrant = 8] [plot 0] [plot mean [racialsatisfaction] of turtles with [orange? = true and tquadrant = 8]] ;plot blue set-current-plot-pen "blue" plot-pen-reset set-plot-pen-mode 1 ;; bar mode set-plot-pen-color blue ifelse not any? turtles with [blue? = true and tquadrant = 0] [plot 0] [plot mean [racialsatisfaction] of turtles with [blue? = true and tquadrant = 0]] ifelse not any? turtles with [blue? = true and tquadrant = 1] [plot 0] [plot mean [racialsatisfaction] of turtles with [blue? = true and tquadrant = 1]] ifelse not any? turtles with [blue? = true and tquadrant = 2] [plot 0] [plot mean [racialsatisfaction] of turtles with [blue? = true and tquadrant = 2]] ifelse not any? turtles with [blue? = true and tquadrant = 3] [plot 0] [plot mean [racialsatisfaction] of turtles with [blue? = true and tquadrant = 3]] ifelse not any? turtles with [blue? = true and tquadrant = 4] [plot 0] [plot mean [racialsatisfaction] of turtles with [blue? = true and tquadrant = 4]] ifelse not any? turtles with [blue? = true and tquadrant = 5] [plot 0] [plot mean [racialsatisfaction] of turtles with [blue? = true and tquadrant = 5]] ifelse not any? turtles with [blue? = true and tquadrant = 6] [plot 0] [plot mean [racialsatisfaction] of turtles with [blue? = true and tquadrant = 6]] ifelse not any? turtles with [blue? = true and tquadrant = 7] [plot 0] [plot mean [racialsatisfaction] of turtles with [blue? = true and tquadrant = 7]] ifelse not any? turtles with [blue? = true and tquadrant = 8] [plot 0] [plot mean [racialsatisfaction] of turtles with [blue? = true and tquadrant = 8]] ;set-plot-pen-color green ;plot count turtles with [color = green] ;set-plot-pen-color blue ;plot count turtles with [color = blue] end ;; if resources < 3 do not move ;; each tick, if class 1, resources + 4, if class 2, +2, if class 3, +1 ;; if move, resources - 3
There is only one version of this model, created about 12 years ago by Kalonji Nzinga.
Attached files
No files