zhang_zhe_progress4_updated
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This section could give a general understanding of what the model is trying to show or explain.
HOW IT WORKS
This section could explain what rules the agents use to create the overall behavior of the model.
HOW TO USE IT
This section could explain how to use the model, including a description of each of the items in the interface tab.
THINGS TO NOTICE
This section could give some ideas of things for the user to notice while running the model.
THINGS TO TRY
This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
EXTENDING THE MODEL
This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
NETLOGO FEATURES
This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.
RELATED MODELS
This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
CREDITS AND REFERENCES
This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
Comments and Questions
globals [population birth-rate die-rate average-education new-baby] turtles-own [ gender age education in-school kids ] undirected-link-breed [mates mate] undirected-link-breed [schools school] schools-own [studytime studylevel] to setup clear-all appear-schools crt number-of-persons [ set shape "person" set color red setxy random-xcor random-ycor set-education ;; 0 means single , 1 means marriaged ;set mate-status 0 set age 18 ;;at the beginning , no body has the kind set kids 0 ;;in-school shows the persons student status , 0 means this person is not in ;;school currently , 1 means this person have been spent 1 year in the school, ;;2 means this person has been in school for 2 years , and so forth . set in-school 0 ;; 0 means female ,1 means male ifelse random 2 = 0 [set gender 0] [set gender 1] ] end to appear-schools ;;creat some turtle and set them as the school , shape as house , color as green crt number-of-schools [ set shape "house" set color green setxy random-xcor random-ycor set age -5000000000000000 ] end to set-education let n random-float 1.00 ;; 1 means high-school , 20% high school person if n <= 0.20 [ set education 1] ;; 2 means undergraduate , 50% undergraduate person if n <= 0.70 and n > 0.20 [ set education 2 ] ;; 3 means Master , 20% MS person if n > 0.70 and n <= 0.90 [ set education 3 ] ;; 4 means PhD , 10% PhD person if n > 0.90 and n <= 1 [ set education 4 ] end to go ; ask turtles [set mylinkcount count my-links] move ask turtles [get-mate] reproduce go-to-school graduate old-to-die if not any? turtles [ stop ] tick ;;only interest the population of adute people with education degree, in other words , no including the children (less than 17 years-old) set population count turtles with [education >= 1 and color = red] update-average-education update-plot-population update-birth-rate end to move ;; randomly walk ask turtles with [color = red] [ rt random 50 lt random 50 fd 0.3 ] ask schools [ set studytime studytime + 1 ] end to get-mate ;;turtle procedure if count my-mates = 0 [ ;; set my education as a temporary variable let my-education education ;; set my gender as a temporary variable let my-gender gender ;; set my age as a temporary variable let my-age age ;; find is there any persons in my neighbors who is single and have similar education level and opposite gender , ;; and also in a similar age . let match one-of ( turtles-on neighbors ) with [count my-mates = 0 and gender != my-gender and education >= my-education - 1 and education <= my-education + 1 and age >= my-age - 6 and age <= my-age + 6 ] ;;there is a probability to control the chance to get mate if random-float 1.0 <= probability-to-mate [ ;;if there is a turtle satisfing all of the constriants , then they will get mate if match != nobody [ create-mate-with match [set color pink ] ] ] ] end to reproduce ;;find the person who is female and marriaged ask turtles with [ count mate-neighbors > 0 and gender = 0 ] [ ;; also assume only the female in some age range[18,45] can have the possibility to reproduce a baby if age >= 18 and age <= 45 [ ;; also only when the female is not studying in the school , will consider to have a baby if random-float 1.0 <= probability-to-reproduce ^ ((age / 10) + (kids * weight) + in-school * weight + (count turtles with [color = red])/ 1000 ) [ ;;if this turtles satisfy all of these constraints , then she will reproduce a baby and then set ;; the kids parameter + 1 , which means she have one more baby hatch 1 [ set age 0 set education 0 ifelse random 2 = 0 [set gender 0] [set gender 1] set kids 0 set color red set in-school 0 lt random 90 fd 0.3 ] set kids kids + 1 let my-kids kids ask mate-neighbors [set kids my-kids ] ] ] ] end to go-to-school ;; find the turtles that between the age range and also not studying in school now ask turtles with [ color = red and age >= 17 and age <= 36 and in-school = 0][ ;; find any one school(green color turtles) and if the school capacity is not full go-to-undergraduate go-to-MS go-to-PhD ] end to go-to-undergraduate if education = 1 [ let match one-of turtles with [ color = green and count (my-schools with [studylevel = 2]) < school-capacity * 0.5 ] if match != nobody and random-float 1.0 <= probability-to-school ^ (education * weight + kids * weight + (abs(18 - age) / 10 ) * weight ) [ create-school-with match [ set color yellow set studytime 0 set studylevel 2 ] set in-school 1 ] ] end to go-to-MS if education = 2 [ let match one-of turtles with [ color = green and count (my-schools with [studylevel = 3]) < school-capacity * 0.35 ] if match != nobody and random-float 1.0 <= probability-to-school ^ (education * weight + kids * weight + (abs(22 - age) )) [ create-school-with match [set color gray set studytime 0 set studylevel 3] set in-school 1 ] ] end to go-to-PhD if education = 3 [ let match one-of turtles with [ color = green and count (my-schools with [studylevel = 4]) < school-capacity * 0.15 ] if match != nobody and random-float 1.0 <= probability-to-school ^ (education * weight + kids * weight + (abs(25 - age) )) [ create-school-with match [set color green set studytime 0 set studylevel 4] set in-school 1 ] ] end to graduate ask schools [ if studylevel = 2 and studytime >= 4 + random-normal 0 0.5 [ die ] if studylevel = 3 and studytime >= 2 + random-normal 0 0.5 [ die ] if studylevel = 4 and studytime >= 4 + random-normal 0 0.5 [ die ] ] ask turtles with [ color = red and in-school = 1] [ ifelse education = 1 and count my-schools = 0 [ set in-school 0 set education 2 ] [ ifelse education = 2 and count my-schools = 0 [ set in-school 0 set education 3 ] [if education = 3 and count my-schools = 0 [ set in-school 0 set education 4 ] ] ] ; if education = 2 and count my-schools = 0 [ ; set in-school 0 ; set education 3 ; ] ; if education = 3 and count my-schools = 0 [ ; set in-school 0 ; set education 4 ; ] ] end to old-to-die ask turtles with[ color = red ] [ ;; get older each tick set age age + 1 ;; if the child is 16 years-old , then assume he/she has a high-school education level if age = 17 [set education 1] ;; if the age is larger than a normal variable (Mean=80 & SD=3) , then die if age >= random-normal 75 3 [die] ] end to update-plot-population if not any? turtles with[ color = red ] [ stop ] set-current-plot "population" set-current-plot-pen "high-school" plot count turtles with [education = 1] / population set-current-plot-pen "undergraduate" plot count turtles with [education = 2] / population set-current-plot-pen "Master" plot count turtles with [education = 3] / population set-current-plot-pen "PhD" plot count turtles with [education = 4] / population end to update-average-education if not any? turtles with [color = red] [ stop ] set-current-plot "average-education" set average-education sum [ education ] of turtles with [ education >= 1 ] / population plot average-education end to update-birth-rate if not any? turtles with [color = red] [ stop ] end
There is only one version of this model, created about 14 years ago by zhe zhang.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.