Balassa-Samuelson

No preview image

1 collaborator

Default-person michael hardaker (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.2.0 • Viewed 56 times • Downloaded 10 times • Run 0 times
Download the 'Balassa-Samuelson' modelDownload this modelEmbed this model

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 [
  UK-TG-Patches
  UK-TG-Price
  UK-TG-Wage
  UK-TG-MPL
  UK-NTG-Patches
  UK-NTG-Price
  UK-NTG-Wage
  UK-NTG-MPL
  PL-TG-Patches
  PL-TG-Price
  PL-TG-Wage
  PL-NTG-Patches
  PL-NTG-Price
  PL-NTG-Wage
  PL-NTG-MPL
]

breed [ workers worker ]
breed [ goods good ]

workers-own [
  age            ; how old the workers are. if older, they will be less likely to migrate [ to be added ]
  initiative     ; what their natural initiative is. this is moderated by age.
  migrating?     ; true when worker is currently migrating
  job-changer?   ; true when worker is currently in process of switching sectors
]

to setup
  clear-all
  setup-patches
  setup-turtles
  setup-parameters
  reset-ticks
end 

to setup-patches   ; creates sectors for each country
  ask patches [set pcolor gray + 2 ]                                      ; sets background color
  ask patches with [ pxcor = 0 and pycor >= -2] [ set pcolor gray - 2 ]   ; visualizes immobility of labor between countries
  ask patches with [ pycor = 0 ] [ set pcolor gray - 2 ]                  ; visualizes immobility of labor between sectors
  open-close-border                                                       ; matches "barrier" visual with open and closed borders
  open-close-sectors                                                      ; matches "barrier" visual with open sector movement within countires
  set UK-TG-Patches patches with [pxcor < -4 and pycor > 2]               ; the following color the sector and country patches
  ask UK-TG-Patches [ set pcolor blue + 2 ]

  set UK-NTG-Patches patches with [pxcor < -4 and pycor < -2]
  ask UK-NTG-Patches [ set pcolor blue + 3 ]

  set PL-TG-Patches patches with [pxcor > 4 and pycor > 2]
  ask PL-TG-Patches [ set pcolor red + 2 ]

  set PL-NTG-Patches patches with [pxcor > 4 and pycor < -2]
  ask PL-NTG-Patches [ set pcolor red + 3 ]
end 

to open-close-border
  ifelse not open-borders?                                                       ; if borders are closed
  [ ask patches with [ pxcor = 0 and pycor <= -2] [ set pcolor gray - 2 ] ]      ; draw borders
  [ ask patches with [ pxcor = 0 and pycor <= -2] [ set pcolor gray + 2 ] ]      ; else remove borders
end 

to open-close-sectors
  ifelse not allow-sector-mvmt?                                                  ; if sectors are open within countries
  [ ask patches with [ pxcor > 4 and pycor = 0]   [ set pcolor gray - 2 ]        ; draw borders
  ;  ask patches with [ pxcor < -4 and pycor = 0 ] [ set pcolor gray - 2 ] ]     ; INACTIVE WHILE TROUBLESHOOTING: UK and PL sector changes not working together
  ]
  [ ask patches with [ pxcor > 4 and pycor = 0]   [ set pcolor gray + 2 ]        ; else remove borders
      ;  ask patches with [ pxcor < -4 and pycor = 0 ] [ set pcolor gray + 2 ] ] ; INACTIVE WHILE TROUBLESHOOTING: UK and PL sector changes not working together
    ]
end 

to setup-turtles                              ; create 200 total workers, split evenly between sectors and coutnries
  set-default-shape goods "box"
  set-default-shape workers "person"
  create-workers 50 [
    set color blue - 1
    move-to one-of UK-TG-Patches
  ]
    create-workers 50 [
    set color blue - 1
    move-to one-of UK-NTG-Patches
  ]
    create-workers 50 [
    set color red - 1
    move-to one-of PL-TG-Patches
  ]
    create-workers 50 [
    set color red - 1
    move-to one-of PL-NTG-Patches
  ]
  ask workers [
    set heading 0                 ; set headings of workers, to intiialize movement up and down
    set initiative random-float 1 ; gives workers a random propensity to migrate or change jobs from 0 - 0.5
    set migrating? false          ; set default value of not migrating
    set job-changer? false        ; set default value of not changing jobs
  ]
end 

to setup-parameters ;; sets initial values, relationships, and parameters
  set UK-TG-Wage 20
  set UK-TG-MPL 10
  set UK-TG-Price UK-TG-Wage / UK-TG-MPL
  set UK-NTG-Wage 20
  set UK-NTG-MPL 10
  set UK-NTG-Price UK-NTG-Wage / UK-NTG-MPL
  set PL-TG-Wage 10
  set PL-TG-Price PL-TG-Wage / PL-TG-MPL
  set PL-NTG-Wage 10
  set PL-NTG-MPL 10
  set PL-NTG-Price PL-NTG-Wage / PL-NTG-MPL
end 

to go
  arbitrage             ; arbitrage goods between countries, leveling price
  identify-job-changers ; check to see if anyone decides to change sectors
  change-jobs           ; move job changers from one sector to the other
  settle-job-changers   ; adds job changers to new sectors
  identify-migrants     ; check to see if anyone decides to migrate
  migrate               ; move one migrant one at a time to other sector
  settle-migrants       ; adds migrant to working sector
  move-about            ; moves workers within their sector and country
  open-close-border     ; update border status
  open-close-sectors    ; update sector status
  tick
end 

to arbitrage           ; step 1) make goods 2) ship goods 3) recceive goods, updating prices
  ; step 1. make goods
    if not any? goods                                                            ; if no goods are currently transferring (approx. even prices)
  [
    set PL-TG-Price PL-TG-Wage / PL-TG-MPL                                       ; set price relationship
    if UK-TG-Price > PL-TG-Price and abs ( UK-TG-Price - PL-TG-Price ) > 0.01    ; if UK-TG prices are more than 0.01 higher than PL-TG
    [
      ask one-of PL-TG-Patches
      [ sprout-goods 1 [set color yellow set heading 270] ]                      ; make goods at a PL patch
    ]

    if UK-TG-Price < PL-TG-Price and abs ( UK-TG-Price - PL-TG-Price ) > 0.01    ; and UK-TG prices are lower than 0.01 of PL-TG
     [
      ask one-of UK-TG-Patches
      [ sprout-goods 1 [set color yellow set heading 90] ]                       ; make goods at a UK patch
    ]
  ]

  ; step 2. ship goods
  ask goods
    [ fd 2]  ; move goods (quickly) towards their destination


  ; step 3. recieve goods, adjust prices
  ask goods
    [
      if [pcolor] of patch-here = gray + 2       ; if goods are in transport
      [
        if [pcolor] of patch-ahead 2 = blue + 2  ; and they reach the UK border
        [
          set UK-TG-Price UK-TG-Price - 0.001    ; lower UK TG price (by a little, simulating lower market share of PL)
          set PL-TG-Price PL-TG-Price + 0.01     ; and raise PL TG price (this simulates supply/demand of TG)
          set UK-TG-Wage UK-TG-Price * UK-TG-MPL ; change relationship to drive wage up, observing LOP
          set PL-TG-Wage PL-TG-Price * PL-TG-MPL
          die                                    ; remove goods

        ]
        if [pcolor] of patch-ahead 2 = red + 2   ; if goods reach PL border
        [
          set UK-TG-Price UK-TG-Price + 0.01     ; raise UK TG price (simulating supply/demand of TG)
          set PL-TG-Price PL-TG-Price - 0.001    ; and lower PL TG price (by a little, simulating lower market share of PL)
          set UK-TG-Wage UK-TG-Price * UK-TG-MPL ; change relationship to drive wage up, observing LOP
          set PL-TG-Wage PL-TG-Price * PL-TG-MPL
          die                                    ; remove goods
        ]
      ]
    ]
end 

to identify-job-changers ; TROUBLESHOOT: two scenarios currently incompatible with each other
  if allow-sector-mvmt?                          ; if sectors are open and no workers currently changing sectors
  and not any? workers with [job-changer?]       ; and there are no job-changers already
  and not any? workers with [migrating?]         ; and there is no one migrating
  and abs (UK-TG-Price - PL-TG-Price) < 0.02     ; and there is no price disparity of TG goods (within 0.02)
  [
    if abs (PL-TG-Wage - PL-NTG-Wage ) > 0.02    ; if PL wage disparity exists (greater than 0.02)
    [
      if PL-TG-Wage > PL-NTG-Wage                ; and TG wages are higher than NTG wages in PL
      [
        ask one-of workers-on PL-NTG-Patches     ; select one of NTG workers in PLland
        [
          if random-float 1 < initiative         ; change sectors if random no. < worker's initiative
          [
            set job-changer? true set PL-NTG-Wage PL-NTG-Wage + 0.2
          ]
        ]
      ]
      if PL-TG-Wage < PL-NTG-Wage                ; and TG wages are lower than NTG wages in PL
      [
        ask one-of workers-on PL-TG-Patches      ; select one of TG workers in PL
        [
          if random-float 1 < initiative         ; change sectors if random no. < worker's initiative
          [
            set job-changer? true set PL-TG-Wage PL-TG-Wage + 0.2
          ]
        ]
      ]
    ]

; TROUBLESHOOT THIS: If this is active, PL workers will not change job sectors for some reason
;    if abs (UK-TG-Wage - UK-NTG-Wage ) > 0.02
;    [
;      if UK-TG-Wage > UK-NTG-Wage     ; and TG wages are higher than NTG wages in PL
;      [
;        ask one-of workers-on UK-NTG-Patches     ; select one of NTG workers in PLland
;        [
;          if random-float 1 < initiative; change sectors if random no. < worker's initiative
;          [
;            set job-changer? true set UK-NTG-Wage UK-NTG-Wage + 0.2
;          ]
;        ]
;     ]
;     if UK-TG-Wage < UK-NTG-Wage     ; and TG wages are lower than NTG wages in PL
;      [
;        ask one-of workers-on UK-TG-Patches     ; select one of TG workers in PL
;        [
;          if random-float 1 < initiative; change sectors if random no. < worker's initiative
;         [
;          set job-changer? true set PL-TG-Wage PL-TG-Wage + 0.2
;         ]
;       ]
;      ]
;    ]
  ]
end 

to change-jobs
  ask workers with [ pxcor > 0 ]           ; ask workers on right side of map (in Poland)
  [
    if job-changer?                        ; if they are changing jobs
    [
      ifelse PL-TG-Wage > PL-NTG-Wage      ; if TG wages is higher
      [ set heading 0 ]                    ; workers looks look torwards TG sector
      [ set heading 180 ]                  ; otherwise, look towards NTG sector
      fd 1
    ]
  ]

  ask workers with [ pxcor < 0 ]           ; ask workers on left side of map (in UK)
  [
    if job-changer?                        ; if they are changing jobs
    [
      ifelse UK-TG-Wage > UK-NTG-Wage      ; if TG wages is higher
      [ set heading 0 ]                    ; workers looks look torwards TG sector
      [ set heading 180 ]                  ; otherwise, look towards NTG sector
      fd 1
    ]
  ]
end 

to settle-job-changers
    ask workers
  [
    if job-changer?
    [
      if PL-TG-Wage >= PL-NTG-Wage and [pcolor] of patch-here = red + 2  ; if job changers on higher wage patch (PL TG)
      [
        move-to one-of PL-TG-Patches                                     ; add to TG sector
        set job-changer? false
        set heading 0
        set PL-TG-Wage PL-TG-Wage - 0.2                                  ; lower wages due to supply/demand of labor in TG sector
        set PL-TG-Price PL-TG-Wage / PL-TG-MPL
      ]
      if PL-TG-Wage <= PL-NTG-Wage and [pcolor] of patch-here = red + 3  ; if job changers on higher wage patch (PL NTG)
      [
        move-to one-of PL-NTG-Patches                                    ; add to NTG sector
        set job-changer? false
        set heading 0
        set PL-NTG-Wage PL-NTG-Wage - 0.2                                ; lower wages due to supply/demand of labor in NTG sector
        set PL-NTG-Price PL-NTG-Wage / PL-NTG-MPL
      ]

      if UK-TG-Wage >= UK-NTG-Wage and [pcolor] of patch-here = blue + 2 ; if job changers on higher wage patch (UK TG)
      [
        move-to one-of UK-TG-Patches                                     ; add to TG sector
        set migrating? false
        set heading 0
        set UK-TG-Wage UK-TG-Wage - 0.2                                  ; lower wages due to supply/demand of labor in TG sector
        set UK-TG-Price UK-TG-Wage / UK-TG-MPL
      ]
      if UK-TG-Wage <= UK-NTG-Wage and [pcolor] of patch-here = blue + 3 ; if job changers on higher wage patch (UK NTG)
      [
        move-to one-of UK-NTG-Patches                                    ; add to NTG sector
        set migrating? false
        set heading 0
        set UK-NTG-Wage UK-NTG-Wage - 0.2                                ; lower wages due to supply/demand of labor in NTG sector
        set UK-NTG-Price UK-NTG-Wage / UK-TG-MPL
      ]
    ]
  ]
end 

to identify-migrants     ; selects migrants. Done one worker at a time for visual reasons
  if open-borders?
  and not any? workers with [migrating?]
  and not any? workers with [job-changer?]                       ; if borders are open and no workers currently migrating or changing jobs
  [
    if UK-NTG-Wage > PL-NTG-Wage                                 ; and UK-NTG wages are higher
    [
      ask one-of workers-on PL-NTG-Patches                       ; select one of NTG workers in PLland
      [
        if random-float 1 < initiative + mvmt-bias-towards-UK    ; migrate if random no. < worker's initiative + movement bias towards UK
        [
          set migrating? true set PL-NTG-Wage PL-NTG-Wage + 0.2
        ]
      ]
    ]
    if UK-NTG-Wage < PL-NTG-Wage                                 ; if PL-NTG wages are higher
    [
      ask one-of workers-on UK-NTG-Patches                       ; select one of NTG workers in UK
      [
        if random-float 1 < initiative + mvmt-bias-towards-PL    ; migrate if random no. < worker's initiative + movement bias towards PL
        [
          set migrating? true set UK-NTG-Wage UK-NTG-Wage + 0.2
        ]
      ]
    ]
  ]
end 

to migrate
  ask workers
  [
    if migrating?                       ; if they are migrating
    [
      ifelse UK-NTG-Wage > PL-NTG-Wage  ; if UK wage is higher
      [ set heading 270 ]               ; workers looks towards UK
      [ set heading 90 ]                ; otherwise, PL wage higher and workers look towards PL
      fd 1
    ]
  ]
end 

to settle-migrants
  ask workers
  [
    if migrating?
    [
      if UK-NTG-Wage >= PL-NTG-Wage and [pcolor] of patch-here = blue + 3 ; if migrants on higher wage patch
      [
        move-to one-of UK-NTG-Patches                                     ; add to UK workforce
        set migrating? false
        set heading 0
        set UK-NTG-Wage UK-NTG-Wage - 0.2                                 ; lower wages due to supply/demand of labor in UK
      ]
      if UK-NTG-Wage <= PL-NTG-Wage and [pcolor] of patch-here = red + 3  ; when migrant reaches PL
      [
        move-to one-of PL-NTG-Patches                                     ; add to PL workforce
        set migrating? false
        set heading 0
        set PL-NTG-Wage PL-NTG-Wage - 0.2                                 ; lower wages due to supply/demand of labor in PL
      ]
    ]
  ]
  set UK-NTG-Price UK-NTG-Wage / UK-NTG-MPL
  set PL-NTG-Price PL-NTG-Wage / PL-NTG-MPL
end 

to move-about
  ask workers [
    if not migrating? and not job-changer?                                ; if workers aren't migrating
    [
    if abs pycor = max-pycor or [pcolor] of patch-ahead 1 = gray + 2      ; avoid edges of sector and map
      [ set heading (180 - heading) ]
  fd 1                                                                    ; and move forward
  ]
  ]
end 

There is only one version of this model, created almost 3 years ago by michael hardaker.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.