Immigration_almost_final
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
patches-own [ country ] turtles-own [ origin citizen prof employed life] globals [ ;;countries countries ;;professions profes ;;patches for countries patches-1 patches-2 patches-3 patches-4 ;;wages wage-1A wage-1B wage-1C wage-1D wage-2A wage-2B wage-2C wage-2D wage-3A wage-3B wage-3C wage-3D wage-4A wage-4B wage-4C wage-4D ] to setup set countries [ 1 2 3 4 ] set profes [ "A" "B" "C" "D" ] setup-patches setup-labels setup-turtles calc-wage set-color-by-prof do-plot end to calc-wage ifelse wage-by-population? [ foreach [ 1 2 3 4 ] [ set-wage ? "A" (calc-wage-for ? "A") set-wage ? "B" (calc-wage-for ? "B") set-wage ? "C" (calc-wage-for ? "C") set-wage ? "D" (calc-wage-for ? "D") ] ] [ foreach [ 1 2 3 4 ] [ set-wage ? "A" (calc-wage-for-common ? "A") set-wage ? "B" (calc-wage-for-common ? "B") set-wage ? "C" (calc-wage-for-common ? "C") set-wage ? "D" (calc-wage-for-common ? "D") ] ] end to go-wage immigrate-by-wage calc-wage set-color-by-prof tick if birth-rate-on? [ do-birth do-death ] do-plot end to go-employment immigrate-by-employment calc-wage set-color-by-prof tick if birth-rate-on? [ do-birth do-death ] do-plot end to do-death ask turtles [ set life life - 1 if life <= 0 [ die ] ] end to immigrate-by-wage ask turtles [ let max-wage-desc 0 let max-wage-country 0 foreach [ 1 2 3 4 ] [ if not (citizen = ?) [ let twage-desc calc-wage-desc prof citizen ? if max-wage-desc < twage-desc [ set max-wage-desc twage-desc set max-wage-country ? ] ] ] if max-wage-desc >= wage-discrepancy and max-wage-country != 0 [ move-to-empty-one-of patches with [ country = max-wage-country ] set citizen max-wage-country set employed false if wage-awareness? = true [ set-wage citizen prof (calc-wage-for citizen prof) ] ] ] end to immigrate-by-employment ask turtles with [employed = false ] [ let max-job-avail 0 let max-job-country 0 foreach [ 1 2 3 4 ] [ if not (citizen = ?) [ let tjob-avail calc-job-avail prof ? if max-job-avail < tjob-avail [ set max-job-avail tjob-avail set max-job-country ? ] ] ] if max-job-country != 0 [ move-to-empty-one-of patches with [ country = max-job-country ] set citizen max-job-country set employed false if wage-awareness? = true [ set-wage citizen prof (calc-wage-for citizen prof) ] ] ] end to-report calc-job-avail [profs state] let tot-profs count turtles with [ citizen = state and prof = profs ] let ideal-profs (get-ideal profs) ifelse ideal-profs > tot-profs [report ideal-profs - tot-profs] [report 0] end to-report calc-happiness-index end to-report calc-wage-desc [ profs state nstate ] let result 0 if (get-wage state profs) != 0 [ set result (((get-wage nstate profs) - (get-wage state profs)) / (get-wage state profs)) * 100 ] report result end to-report get-wage [ state profs ] if state = 1 [ if profs = "A" [ report wage-1A ] if profs = "B" [ report wage-1B ] if profs = "C" [ report wage-1C ] if profs = "D" [ report wage-1D ] ] if state = 2 [ if profs = "A" [ report wage-2A ] if profs = "B" [ report wage-2B ] if profs = "C" [ report wage-2C ] if profs = "D" [ report wage-2D ] ] if state = 3 [ if profs = "A" [ report wage-3A ] if profs = "B" [ report wage-3B ] if profs = "C" [ report wage-3C ] if profs = "D" [ report wage-3D ] ] if state = 4 [ if profs = "A" [ report wage-4A ] if profs = "B" [ report wage-4B ] if profs = "C" [ report wage-4C ] if profs = "D" [ report wage-4D ] ] end to set-wage [ state profs new-wage] if state = 1 [ if profs = "A" [ set wage-1A new-wage] if profs = "B" [ set wage-1B new-wage] if profs = "C" [ set wage-1C new-wage] if profs = "D" [ set wage-1D new-wage] ] if state = 2 [ if profs = "A" [ set wage-2A new-wage] if profs = "B" [ set wage-2B new-wage] if profs = "C" [ set wage-2C new-wage] if profs = "D" [ set wage-2D new-wage] ] if state = 3 [ if profs = "A" [ set wage-3A new-wage] if profs = "B" [ set wage-3B new-wage] if profs = "C" [ set wage-3C new-wage] if profs = "D" [ set wage-3D new-wage] ] if state = 4 [ if profs = "A" [ set wage-4A new-wage] if profs = "B" [ set wage-4B new-wage] if profs = "C" [ set wage-4C new-wage] if profs = "D" [ set wage-4D new-wage] ] end to-report calc-wage-for [ state profs ] let pop count turtles with [ citizen = state ] let prof-pop count turtles with [ citizen = state and prof = profs ] let ideal-prof floor (pop * (get-ideal profs)) / 100 let totinv ideal-prof * 50 ask turtles with [ citizen = state and prof = profs ] [ set employed false ] ifelse ideal-prof < prof-pop [ ask n-of ideal-prof turtles with [ citizen = state and prof = profs ] [ set employed true ] ] [ ask turtles with [ citizen = state and prof = profs ] [ set employed true ] ] ifelse prof-pop = 0 [report totinv] [report totinv / prof-pop] end to-report calc-wage-for-common [ state profs ] let pop count turtles with [ citizen = state ] let prof-pop count turtles with [ citizen = state and prof = profs ] let ideal-prof floor (pop * (get-ideal profs)) / 100 let totinv (get-ideal profs) * 50 ask turtles with [ citizen = state and prof = profs ] [ set employed false ] ifelse ideal-prof < prof-pop [ ask n-of ideal-prof turtles with [ citizen = state and prof = profs ] [ set employed true ] ] [ ask turtles with [ citizen = state and prof = profs ] [ set employed true ] ] ifelse prof-pop = 0 [report totinv] [report totinv / prof-pop] end to-report get-ideal [ profs ] if profs = "A" [ report ideal-A-perc ] if profs = "B" [ report ideal-B-perc ] if profs = "C" [ report ideal-C-perc ] if profs = "D" [ report ideal-D-perc ] end to setup-patches clear-all set-default-shape turtles "person" set patches-1 patches with [pycor > 0 and pxcor < 0] ask patches-1 [ set pcolor green set country 1 ] set patches-2 patches with [pycor > 0 and pxcor > 0] ask patches-2 [ set pcolor blue set country 2] set patches-3 patches with [pycor < 0 and pxcor < 0] ask patches-3 [ set pcolor orange set country 3] set patches-4 patches with [pycor < 0 and pxcor > 0] ask patches-4 [ set pcolor grey set country 4] end to setup-labels ask patch (min-pxcor / 2) (max-pycor / 2 ) [ set plabel "1" ] ask patch (max-pxcor / 2) (max-pycor / 2 ) [ set plabel "2" ] ask patch (min-pxcor / 2) (min-pycor / 2 ) [ set plabel "3" ] ask patch (max-pxcor / 2) (min-pycor / 2 ) [ set plabel "4" ] end to move-to-empty-one-of [locations] ;; turtle procedure move-to one-of locations while [any? other turtles-here] [ move-to one-of locations ] end to do-birth if ticks mod 5 = 0 [ crt birth-rate-1[ set citizen 1 set origin 1 set prof one-of [ "A" "B" "C" "D" ] set employed false set life life-expectancy-1 move-to-empty-one-of patches-1 ] crt birth-rate-2 [ set citizen 2 set origin 2 set prof one-of [ "A" "B" "C" "D" ] set employed false set life life-expectancy-2 move-to-empty-one-of patches-2 ] crt birth-rate-3 [ set citizen 3 set origin 3 set prof one-of [ "A" "B" "C" "D" ] set employed false set life life-expectancy-3 move-to-empty-one-of patches-3 ] crt birth-rate-4 [ set citizen 4 set origin 4 set prof one-of [ "A" "B" "C" "D" ] set employed false set life life-expectancy-4 move-to-empty-one-of patches-4 ]] end to setup-turtles crt population-1 [ set citizen 1 set origin 1 set prof one-of [ "A" "B" "C" "D" ] set employed false set life life-expectancy-1 move-to-empty-one-of patches-1 ] crt population-2 [ set citizen 2 set origin 2 set prof one-of [ "A" "B" "C" "D" ] set employed false set life life-expectancy-2 move-to-empty-one-of patches-2 ] crt population-3 [ set citizen 3 set origin 3 set prof one-of [ "A" "B" "C" "D" ] set employed false set life life-expectancy-3 move-to-empty-one-of patches-3 ] crt population-4 [ set citizen 4 set origin 4 set prof one-of [ "A" "B" "C" "D" ] set employed false set life life-expectancy-4 move-to-empty-one-of patches-4 ] end to set-color-by-prof ask turtles [ ifelse employed = false [ set color red ] [ if prof = "A" [ set color green ] if prof = "B" [ set color blue ] if prof = "C" [ set color yellow ] if prof = "D" [ set color grey] ] ] end to do-plot set-current-plot "Population" set-current-plot-pen "country-1" plot count turtles with [ citizen = 1 ] set-current-plot-pen "country-2" plot count turtles with [ citizen = 2 ] set-current-plot-pen "country-3" plot count turtles with [ citizen = 3 ] set-current-plot-pen "country-4" plot count turtles with [ citizen = 4 ] end
There is only one version of this model, created almost 13 years ago by Subu Kandaswamy.
Attached files
No files