wage based immigration

No preview image

1 collaborator

Default-person Subu Kandaswamy (Author)

Tags

(This model has yet to be categorized with any tags)
Model group EECS 372-Spring 2011 | Visible to everyone | Changeable by the author
Model was written in NetLogo 4.1.2 • Viewed 261 times • Downloaded 17 times • Run 1 time
Download the 'wage based immigration' modelDownload this modelEmbed this model

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

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

patches-own [ country ]
turtles-own [ origin citizen prof employed]
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
end 

to calc-wage
  ;;Wage for country 1
  set wage-1A calc-wage-for 1 "A"
  ;;type "wage 1A: " print wage-1A
  set wage-1B calc-wage-for 1 "B"
  ;;type "wage 1B: " print wage-1B
  set wage-1C calc-wage-for 1 "C"
  ;;type "wage 1C: " print wage-1C
  set wage-1D calc-wage-for 1 "D"
  ;;type "wage 1D: " print wage-1D
  ;;Wage for country 2
  set wage-2A calc-wage-for 2 "A"
  ;;type "wage 2A: " print wage-2A
  set wage-2B calc-wage-for 2 "B"
  ;;type "wage 2B: " print wage-2B
  set wage-2C calc-wage-for 2 "C"
  ;;type "wage 2C: " print wage-2C
  set wage-2D calc-wage-for 2 "D"
  ;;type "wage 2D: " print wage-2D
  ;;Wage for country 3
  set wage-3A calc-wage-for 3 "A"
  ;;type "wage 3A: " print wage-3A
  set wage-3B calc-wage-for 3 "B"
  ;;type "wage 3B: " print wage-3B
  set wage-3C calc-wage-for 3 "C"
  ;;type "wage 3C: " print wage-3C
  set wage-3D calc-wage-for 3 "D"
  ;;type "wage 3D: " print wage-3D
  ;;Wage for country 4
  set wage-4A calc-wage-for 4 "A"
  ;;type "wage 4A: " print wage-4A
  set wage-4B calc-wage-for 4 "B"
  ;;type "wage 4B: " print wage-4B
  set wage-4C calc-wage-for 4 "C"
  ;;type "wage 4C: " print wage-4C
  set wage-4D calc-wage-for 4 "D"
  ;;type "wage 4D: " print wage-4D
end 

to go-wage
  immigrate-by-wage
  calc-wage
  tick
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
      ]
    ]
end 

to-report calc-wage-desc [ profs state nstate ]
let 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-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
  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 setup-turtles
  crt population-1 [
    set citizen 1
    set origin 1
    set prof one-of [ "A" "B" "C" "D" ]
    set employed false
    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
    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
    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
    move-to-empty-one-of patches-4
  ]
end 

There is only one version of this model, created almost 13 years ago by Subu Kandaswamy.

Attached files

No files