Evolution and competition for resources GERMAN

Evolution and competition for resources GERMAN preview image

This model is seeking new collaborators — would you please help?

1 collaborator

Default-person Susan Hanisch (Author)

Tags

evolution 

Tagged by Susan Hanisch almost 3 years ago

sustainability 

Tagged by Susan Hanisch almost 3 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.1 • Viewed 227 times • Downloaded 14 times • Run 0 times
Download the 'Evolution and competition for resources GERMAN' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

turtles-own [
  harvest-type
  harvest-amount
  harvest
  energy
  myCommons
]

globals [
  commonsResources
  Tragfähigkeit
  Wachstumsrate
 ]

patches-own [resource]

;;;;;;;;;;;;;;;;;;;;;;
;;;Setup Procedures;;;
;;;;;;;;;;;;;;;;;;;;;;

to setup
  clear-all

  set Tragfähigkeit 100
  set Wachstumsrate 0.3

  setup-patches
  setup-turtles


  ask turtles [
    if Agenten = "Menschen" [ set shape "person" set size 1]
    if Agenten = "Bakterien" [ set shape "bacteria" set size 1.2]
    if Agenten = "Kreise" [ set shape "circle" set size 0.8]

    ifelse harvest-type = "sustainable"
      [set color green ]
      [set harvest-type "greedy"
       set color red]
  ]

  reset-ticks
end 

to setup-patches

 ask patches [
    set resource ( 75 + random (Tragfähigkeit / 4))
    set pcolor scale-color brown resource  0 (Tragfähigkeit + 30)
  ]
end 

to setup-turtles
  ask n-of 50 patches
    [sprout 1
      [set energy Lebenshaltungskosten + 1]]

  ask n-of Nachhaltige turtles [ set harvest-type "sustainable"]
end 


;;;;;;;;;;;;;;;;;;;;;;;;
;;;Runtime Procedures;;;
;;;;;;;;;;;;;;;;;;;;;;;;

to go
  if count turtles = 0 [stop]
  ask turtles [
    ifelse harvest-type = "sustainable"
      [set harvest-amount Erntemenge-nachhaltig ]
      [set harvest-amount Erntemenge-gierig ]]

  ask turtles [
    if Agenten = "Menschen" [ set shape "person" set size 1]
    if Agenten = "Bakterien" [ set shape "bacteria" set size 1.2]
    if Agenten = "Kreise" [ set shape "circle" set size 0.8]]

  move
  harvest-patch

  livingcosts

  if Fortpflanzung [reproduce]
  death

  ask patches [
    regrow
    recolor]

  tick
end 

to move ;;turtle procedure

 ask turtles [
    let nextpatch max-one-of (patches in-radius 2 with [not any? turtles-here] ) [resource]
    if nextpatch != nobody
      [ face nextpatch
        move-to nextpatch]

    ]
end 

to harvest-patch
  ask turtles [
   ifelse [resource] of patch-here > harvest-amount
   [set harvest harvest-amount
    ask patch-here [ set resource resource - [harvest-amount] of myself]]
   [set harvest [resource] of patch-here
    ask patch-here [set resource 0]
    ]
    set energy energy + harvest
  ]
end 

to harvest-area ;; from Waring et al., 2017
   ask turtles

  [set commonsResources sum ([resource] of myCommons)  ;; sums all of the resources in my commons
      let commonsList sort-on [resource] myCommons  ;; sort the list by the amount of resource on the patch
      set commonsList reverse commonsList  ;; reverse the sort list so it is largest to smallest

      ifelse commonsResources < harvest-amount  ;; if the total commons are less than what the agent wants to harvest
      [ set harvest (commonsResources); - ( count myCommons * 0.1 ))
        ask myCommons [ set resource 0 ]  ;; take everything from the commons
      ]

      [
        while [harvest < harvest-amount][  ;; while you are still in need
        ;; harvest some resource from the neighborhood
          foreach commonsList [ ?1 ->
            ifelse [resource] of ?1 <= (harvest-amount - harvest)
              [set harvest (harvest + [resource] of ?1 )
               ask ?1 [set resource 0]
              ]

              [ask ?1 [
                set resource (resource - ([harvest-amount] of myself - [harvest] of myself))
              ]
                set harvest harvest-amount
              ]
          ]  ;; end foreach
        ]  ;; end while
        ;;set agentResource floor (agentResource + harvestAmt)
      ] ;; end second part of ifelse commonsResources
  set energy energy + harvest
  ]
end 

to livingcosts
  ask turtles [set energy energy - Lebenshaltungskosten]
end 

to reproduce
 ask turtles
  [ let neighborhood  (patch-set neighbors with [not any? turtles-on self ])
      if (any? neighborhood)  and random-float 1 < ( 0.001 * energy );;/ 100)
        [hatch 1 [
        mutate
         set energy ([energy] of myself / 2)
         move-to one-of neighborhood

          ]
        set energy (energy / 2)
        ]
     ]
end 

to mutate  ;; turtle procedure
    if random-float 100 < Mutationsrate
    [ifelse harvest-type = "sustainable"
      [set harvest-type "greedy"]
      [set harvest-type "sustainable"]
    ]
   update-color
end 

to update-color
   ifelse harvest-type = "sustainable"
      [ set color green ]
      [ set color red ]
end 

to death
  ask turtles
  [if energy <= 0 [die]
     if random-float 100 < Sterberate [ die ]]
end 

to regrow ;; patch
  ifelse resource > 0
  [set resource precision (resource + ((Wachstumsrate * resource) * (1 - (resource / Tragfähigkeit )))) 3]
  [ set resource 0.1]
end 

to recolor ;; patch
  set pcolor scale-color brown resource 0 (Tragfähigkeit + 30)
end 

;;; turtles1 variables

to-report average-energy-greedys
  report sum [energy] of turtles with [harvest-type = "greedy"] / count turtles with [harvest-type = "greedy"]
end 

to-report average-energy-sustainables
  report sum [energy] of turtles with [harvest-type = "sustainable"] / count turtles with [harvest-type = "sustainable"]
end 

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

Attached files

File Type Description Last updated
Evolution and competition for resources GERMAN.png preview Preview for 'Evolution and competition for resources GERMAN' almost 3 years ago, by Susan Hanisch Download

This model does not have any ancestors.

This model does not have any descendants.