Economy of Forest Timber

Economy of Forest Timber preview image

1 collaborator

Dscn3764 Desi Suyamto (Author)

Tags

forest 

Tagged by Desi Suyamto almost 7 years ago

timber 

Tagged by Desi Suyamto almost 7 years ago

timber production policy 

Tagged by Desi Suyamto almost 7 years ago

timber trading policy 

Tagged by Desi Suyamto almost 7 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.3.1 • Viewed 395 times • Downloaded 27 times • Run 0 times
Download the 'Economy of Forest Timber' 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

;; Forest harvesting & planting model
;;
;; Author: Desi Suyamto
;;
;; Forest2020 Collaborative Programme, Facultyof Forestry, Bogor Agrciultural University, Indonesia
;;

breed[trees tree]
breed[houses house]
breed[agents agent]
breed[trucks truck]
breed[harvests harvest]

agents-own
[
  agent-farmer-capital-harvest-timber
  agent-farmer-capital-timber
  agent-farmer-consumption
  agent-farmer-to-pool?
  agent-farmer-to-go-home?
  agent-farmer-to-harvest?
  agent-farmer-household-id
  agent-trader-consumption
  agent-trader-capital-financial
  agent-type
]

globals
[
  farmer-tree-recruitment-rate
  x-center
  y-center
]

houses-own
[
  house-id
  house-capital-land
  house-capital-financial
  house-timber-density
]

patches-own
[
  patch-any-trees?
  patch-any-houses?
  patch-distance-to-upperstream
  patch-harvest-pool?
  patch-harvest-wait?
  patch-farmer-household-land-id
  patch-protected-forest?
  patch-road?
]

trees-own
[
  tree-center?
  tree-distance-to-upperstream
  tree-protected-forest?
  tree-natural?
  tree-domesticated?
  tree-farmer-household-id
]

trucks-own
[
  truck-speed
  truck-to-load?
  truck-to-transport?
]

to initialise-patch
  ask patches
  [
    set pcolor 34 + random-float 3
    set patch-any-trees? false
    set patch-any-houses? false
    set patch-road? false
    set patch-harvest-pool? false
    set patch-harvest-wait? false
    set patch-distance-to-upperstream distancexy min-pxcor max-pycor
    set patch-protected-forest? false
    set patch-farmer-household-land-id -9999
  ]

  let m max[patch-distance-to-upperstream]of patches

  ask patches
  [
    set patch-protected-forest? (patch-distance-to-upperstream / m) < .36
  ]

  repeat 9 [diffuse pcolor .1]

  set x-center round (.5 * (max-pxcor - min-pxcor))
  set y-center round (.5 * (max-pycor - min-pycor))

  ask one-of patches with[pxcor = x-center and pycor = y-center]
  [
    set patch-harvest-pool? true
    sprout-agents 1
    [
      set shape "person"
      set color cyan
      set size 7.2
      set agent-farmer-capital-harvest-timber 0
      set agent-farmer-capital-timber 0
      set agent-farmer-consumption 0
      set agent-farmer-to-pool? false
      set agent-farmer-to-go-home? false
      set agent-farmer-to-harvest? false
      set agent-farmer-household-id -9999
      set agent-type "trader"
      set agent-trader-consumption .63
      set agent-trader-capital-financial 0
    ]
  ]

  ask one-of patches with[pxcor = max-pxcor and pycor = y-center]
  [
    set patch-harvest-wait? true
  ]

  ask patches with[pxcor >= x-center and pxcor <= max-pxcor and pycor = y-center]
  [
    set pcolor 1.8
    set patch-road? true
    ask neighbors
    [
      set pcolor 1.8
      set patch-road? true
    ]
  ]

  repeat 18 [diffuse pcolor .01]
end 

to initialise-natural-tree
  let n 540
  let dm max [patch-distance-to-upperstream]of patches
  let p n-of n patches with[patch-distance-to-upperstream / dm < .63]

  ask p
  [
    sprout-trees 1
    [
      ht
      set shape one-of["tree1" "tree2" "tree3" "tree4"]
      set tree-center? false
      set tree-natural? true
      set tree-protected-forest? false
      set tree-domesticated? false
      set tree-farmer-household-id -9999
    ]
  ]

  let c min-one-of trees[distancexy min-pxcor max-pycor]
  ask c
  [
    set tree-center? true
    set tree-distance-to-upperstream 0
    set size 12.6
    set color 51
    setxy min-pxcor max-pycor
  ]

  ask trees with[not tree-center?]
  [
    face one-of trees with[tree-center?]
    fd random-float x-center
    set tree-distance-to-upperstream distance c
  ]

  ask trees-on patches with[patch-road?]
  [
    move-to one-of patches with[not patch-road?]
  ]

  ask trees with[not tree-center?]
  [
    set tree-distance-to-upperstream distance c
  ]

  let m max[tree-distance-to-upperstream]of trees

  ask trees with[not tree-center?]
  [
    set color 51 + 3.6 * (tree-distance-to-upperstream / m)
    set size 12.6 - 3.6 * (tree-distance-to-upperstream / m)
  ]

  ask trees
  [
    st
    ask patch-here
    [
      set patch-any-trees? true
    ]
  ]

  ask patches with[patch-protected-forest?]
  [
    ask trees-here
    [
      set tree-protected-forest? true
      set color max list 50 (color - random-float 3.6)
    ]
  ]
end 

to initialise-house
  set-default-shape houses "house1"

  let p patches with[(pxcor > 9 + min-pxcor and pxcor < max-pxcor - 9) and (pycor > 9 + min-pycor and pycor < max-pycor - 9)]

  let m max[patch-distance-to-upperstream]of patches

  let i 0

  ask n-of 2 p with[(patch-distance-to-upperstream / m >= .54 and patch-distance-to-upperstream / m  < .63) and not patch-any-trees? and not patch-road? and not patch-any-houses?]
  [
    sprout-houses 1
    [
      ht
      set house-capital-financial 0
      set house-id i
      set size 9
      set color 23
      ask patch-here
      [
        set patch-any-houses? true
      ]
      set house-capital-land max list 9 round ((54 + random 180) * timber-production-policy)
    ]
    set i i + 1
  ]

  ask n-of 3 p with[patch-distance-to-upperstream / m  > .63 and not patch-any-trees? and not patch-road? and not patch-any-houses?]
  [
    sprout-houses 1
    [
      ht
      set house-capital-financial 0
      set house-id i
      set size 9
      set color 23
      ask patch-here
      [
        set patch-any-houses? true
      ]
      set house-capital-land round ((54 + random 180) * timber-production-policy)
    ]
    set i i + 1
  ]

  ask houses-on patches with[patch-road?]
  [
    move-to one-of patches with[not patch-road? and not patch-any-trees? and not patch-any-houses?]
  ]


  ask houses[st]
end 

to initialise-truck
  create-trucks 1
  [
    setxy max-pxcor y-center
    set size 18
    set color 25
    set heading 270
    set shape "truck2"
    set truck-to-load? false
    set truck-to-transport? false
  ]
end 

to initialise-agent
  set-default-shape agents "person"
  ask patches with[patch-any-houses?]
  [
    let i [house-id]of one-of houses-here
    let n 4 + random 2
    let s count patches with[patch-farmer-household-land-id = i]
    let t (9 + random 9) * n
    sprout-agents n
    [
      ht
      set agent-farmer-household-id i
      set agent-type "farmer"
      set agent-farmer-to-harvest? true
      set agent-farmer-to-go-home? false
      set agent-farmer-to-pool? false
      set size 6.3
      set color 47
      set agent-farmer-capital-harvest-timber 0
      set agent-farmer-capital-timber t
      set agent-farmer-consumption .45
      set agent-trader-consumption 0
      set agent-trader-capital-financial 0
    ]
  ]

  ;; define farmer land
  ask houses
  [
    let index house-id
    let s house-capital-land
    let l patches with[not patch-any-trees? and not patch-road? and not patch-any-houses? and not patch-protected-forest? and patch-farmer-household-land-id = -9999]
    let n1 l in-radius 9
    let n2 l in-cone 18 36
    let n remove sort n1 sort n2

    set s min list s length n

    let f n-of s n
    foreach f
    [
      ask ?
      [
        set pcolor pcolor - .9
        set patch-farmer-household-land-id index
      ]
    ]
  ]
end 

to initialise-farmer-tree
  ask houses
  [
    let id house-id
    let n1 round(timber-production-policy * mean[agent-farmer-capital-timber]of agents with[agent-type = "farmer" and agent-farmer-household-id = id])
    let n2 count patches with[patch-farmer-household-land-id = id]
    let n min list n1 n2

    if(any? patches with[patch-farmer-household-land-id = id])
    [
      ask n-of n patches with[patch-farmer-household-land-id = id]
      [
        sprout-trees 1
        [
          ht
          set shape one-of["tree1" "tree2" "tree3" "tree4"]
          set tree-center? false
          set tree-distance-to-upperstream distancexy 0 0
          set tree-protected-forest? false
          set tree-natural? false
          set tree-domesticated? true
          set tree-farmer-household-id id
          set color 61 + random-float 6.3
          set size 5.4 - 1.8 * random-float 1
        ]
      ]
    ]
  ]

  ask trees with[tree-domesticated?]
  [
    st
  ]
end 

to setup
  ca
  set farmer-tree-recruitment-rate 2 ;;trees per household

  initialise-patch
  initialise-truck
  initialise-natural-tree
  initialise-house
  initialise-agent
  initialise-farmer-tree
  reset-ticks
end 

to move-agent
  ask agents with[agent-type = "farmer"]
  [
    let id agent-farmer-household-id
    let h agent-farmer-capital-harvest-timber
    ifelse(not any? houses-here)
    [
      st
    ]
    [
      ht
      set shape "person"
      set color 47
    ]

    if(agent-farmer-to-harvest? and not agent-farmer-to-pool? and not agent-farmer-to-go-home?)
    [
      set shape "person"
      set color 47
      let hh one-of houses with[house-id = id]
      let tt trees with[(tree-domesticated? and tree-farmer-household-id = id) or tree-natural?]
      face min-one-of tt[distance hh]

      fd 1

      if(any? trees-here)
      [
        let t trees-here
        set agent-farmer-capital-harvest-timber count t
        set agent-farmer-to-harvest? false
        set agent-farmer-to-pool? true
        ask patch-here
        [
          set patch-any-trees? false
        ]
        ask t [die]
      ]

    ]

    if(agent-farmer-to-pool? and not agent-farmer-to-harvest? and not agent-farmer-to-go-home?)
    [
      set shape "person2"
      set color 47 - .9
      let p one-of patches with[patch-harvest-pool?]
      face p

      fd 1

      if([patch-harvest-pool?]of patch-here = true)
      [
        ask patch-here
        [
          sprout-harvests h
          [
            set shape "harvest1"
            set size 9
            set color red
            set heading random-float 18
          ]
        ]

        set agent-farmer-to-pool? false
        set agent-farmer-to-go-home? true
        let hh one-of houses with[house-id = id]
        let capital-trader agent-farmer-capital-harvest-timber * 2.7
        let capital-farmer (min list .9 max list .09 timber-trading-policy) * capital-trader

        let consumption-farmer agent-farmer-consumption
        let consumption-trader first[agent-trader-consumption]of agents with[agent-type = "trader"]
        ask hh
        [
          set house-capital-financial house-capital-financial + capital-farmer - consumption-farmer
        ]
        ask agents with [agent-type = "trader"]
        [
          set agent-trader-capital-financial agent-trader-capital-financial + capital-trader - consumption-trader
        ]
        set agent-farmer-capital-harvest-timber 0
      ]
    ]

    if(agent-farmer-to-go-home? and not agent-farmer-to-pool? and not agent-farmer-to-harvest?)
    [
      set shape "person3"
      set color 47 - 1.8
      face one-of houses with[house-id = id]
      fd 1
      if(any? houses-here with[house-id = id])
      [
        set agent-farmer-to-go-home? false
        set agent-farmer-to-harvest? true
      ]
    ]
  ]
end 

to move-truck
  let h count harvests-on patches with[patch-harvest-pool?]
  let n 1

  if(h > 0)
  [
    ask trucks
    [
      set truck-to-load? true
    ]
  ]

  ask trucks
  [
    if(truck-to-load?)
    [
      set shape ifelse-value(heading = 90) ["truck1"] ["truck2"]

      let d ifelse-value(heading = 270)
      [
        distancexy x-center y-center
      ]
      [
        distancexy max-pxcor y-center
      ]

      ifelse(d > 1.8)
      [
        set truck-speed 1

        repeat n
        [
          fd truck-speed / n
        ]
      ]
      [
        ask harvests-on patches with[patch-harvest-pool?] [die]
        set truck-to-load? false
        set truck-to-transport? true
        let x 1 + (read-from-string last shape mod 2)
        set shape word "truck" x
        set heading heading + 180
      ]
    ]

    if(truck-to-transport?)
    [
      set shape ifelse-value(heading = 90) ["truck1"] ["truck2"]

      let d ifelse-value(heading = 270)
      [
        distancexy x-center y-center
      ]
      [
        distancexy max-pxcor y-center
      ]

      ifelse(d > 1.8)
      [
        set truck-speed 1

        repeat n
        [
          fd truck-speed / n
        ]
      ]
      [
        set truck-to-load? false
        set truck-to-transport? false
        let x 1 + (read-from-string last shape mod 2)
        set shape word "truck" x
        set heading heading + 180
      ]
    ]
  ]
end 

to recruit-farmer-tree
  ask houses
  [
    let id house-id
    let n1 round(timber-production-policy * farmer-tree-recruitment-rate)
    let n2 count patches with[patch-farmer-household-land-id = id]
    let nt count trees with[tree-domesticated? and tree-farmer-household-id = id]
    let d ifelse-value(n2 > 0) [nt / n2] [0]
    let n ifelse-value(d < .72)[min list n1 n2] [0]


    if(any? patches with[patch-farmer-household-land-id = id])
    [
      ask n-of n patches with[patch-farmer-household-land-id = id]
      [
        sprout-trees 1
        [
          ht
          set shape one-of["tree1" "tree2" "tree3" "tree4"]
          set tree-center? false
          set tree-distance-to-upperstream distancexy 0 0
          set tree-protected-forest? false
          set tree-natural? false
          set tree-domesticated? true
          set tree-farmer-household-id id
          set color 61 + random-float 6.3
          set size 5.4 - 1.8 * random-float 1
        ]
      ]
    ]
  ]

  ask trees with[tree-domesticated?]
  [
    st
  ]
end 

;to export-landscape
;  let t ticks
;  let f word "output/" word "land-" word t ".png"
;  export-view f
;end

to go
 ifelse(ticks < 1800)
 [
   ;;export-landscape
   move-agent
   move-truck
   recruit-farmer-tree
   tick
 ]
 [
   stop
 ]
end 

There is only one version of this model, created almost 7 years ago by Desi Suyamto.

Attached files

File Type Description Last updated
Economy of Forest Timber.png preview Preview for 'Economy of Forest Timber' almost 7 years ago, by Desi Suyamto Download

This model does not have any ancestors.

This model does not have any descendants.