Foraging estimates
Model was written in NetLogo 6.0.3
•
Viewed 137 times
•
Downloaded 12 times
•
Run 0 times
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
; Foraging V3.0 ; WORLD INCLUDES ;globals [max-lifepoints] breed [foragers forager] foragers-own [name lifepoints encounter-v search-v expected-search-cost potential-search-cost] patches-own [countdown food] globals [list-search-costs max-grass-food likelihood-pay-search-cost food-value-range-L cost-per-computation] ; SETUP WORLD to setup clear-all set list-search-costs [1 2 4] set likelihood-pay-search-cost 70 set max-grass-food (max-gain-from-food * max-lifepoints / 100) set food-value-range-L 15 ; food-value-range-H (high) is unnecesary, as it is 100% of max-grass-food set cost-per-computation (1 * computing-cost / 100 ) / 6 ;Initialize patches ask patches [set pcolor brown] ask n-of num-grassy-patches patches [ set pcolor green ] ; num-grassy-patches patches turn green ask patches [ ifelse pcolor = green [ set countdown grass-regrowth-time ;set food random max-grass-food] set food ( ( max-grass-food * food-value-range-L / 100 ) + random ( max-grass-food * (100 - food-value-range-L) / 100 ) )] ;set food median (list max-grass-food/2 max-grass-food] [ set countdown (random grass-regrowth-time / 2 + random grass-regrowth-time) ] ; initialize grass regrowth clocks randomly for brown patches ] ; Initialize foragers create-foragers initial-number-foragers [ ;pen-down set shape "person" set color white set size 1.5 setxy random-xcor random-ycor set lifepoints (max-lifepoints / 2 + random max-lifepoints / 2) ;set lifepoints random (2 * forager-gain-from-food) ] reset-ticks end ; FUNCTIONS to go if not any? foragers [ user-message "Humanity has gone extinct :(" stop ] ; A little bit of humour ; Foragers ask foragers [ set lifepoints lifepoints - 1 ; living ain't free set potential-search-cost one-of list-search-costs; ; is not "computed" by forager, ; this info is "hidden" to the forager, ; who will become aware of it only if we call compute-sc ; compute value (encountered, search) & cost (search) if lifepoints < (max-lifepoints * saciety-thresh / 100) [ ifelse this-model = "forage" [ compute-ev compute-sv compute-sc if encounter-v < (search-v - expected-search-cost) [ movelegs ] ] [ movelegs ; moves and pays search-cost. In "forage" mode, if encounter-v < (search-v - expected-search-cost), ] ] ] ; Patches ask patches [ decay-grass ] ; Foragers ask foragers [ eat-grass death ] ; Patches ask patches [ grow-grass ] tick end ; Forager procedures to compute-ev set encounter-v (food * (1 - (grass-decay-prob / 100) )) set lifepoints (lifepoints - cost-per-computation) end to compute-sv ; from command line, in observer mode, got what I wanted with: ; ask forager 0 [set search-v sum [food] of neighbors] set search-v (sum [food] of neighbors) / 8 ; 'cause there are 8 neighbors set lifepoints (lifepoints - cost-per-computation) end to compute-sc ; From Kolling et al 2012, Science: ; Decisions to search entailed a risk of point loss (which constituted the search cost) with a ; likelihood of 70%. The number of points that might be lost was set to three different levels ; and the level on each trial was indicated to the subject by the color of the box surrounding ; the search alternatives (potential point loss: red = 20; white = 10; green = 5). set expected-search-cost potential-search-cost set lifepoints (lifepoints - cost-per-computation) end to should-isosig ; should I stay or ... ; phased out to include computation of foraging costs in f(movelegs) end to movelegs set heading random 360 fd 1 if random-float 100 < likelihood-pay-search-cost [ set lifepoints (lifepoints - potential-search-cost) ] ;set lifepoints (lifepoints - real-search-cost) ; it's not worth it to calculate a real-search-cost, just throw the dice end to eat-grass ; forager procedure ; sheep eat grass, turn the patch brown if pcolor = green [ ;set lifepoints lifepoints + forager-gain-from-food ; gain lifepoints by eating set lifepoints lifepoints + food ; gain lifepoints by eating set pcolor brown set food 0 ] end to death ; forager procedure ; when energy dips below zero, die if lifepoints < 0 [ die ] end ; Patch procedures to grow-grass ; patch procedure ; countdown on brown patches: if reach 0, grow some grass if pcolor = brown [ ifelse countdown <= 0 [ set pcolor green set countdown grass-regrowth-time set food (max-grass-food / 2 + random max-grass-food / 2) ] [ set countdown countdown - 1 ] ] end to decay-grass ; patch procedure if pcolor = green [ if random-float 100 < grass-decay-prob [ ; will grass survive? throw dice... set pcolor brown set food 0 ] ] end ; REPORT VARIABLES to-report grass let grass-q patches with [pcolor = green] ; patches with [pcolor = green] let grass-report ((count grass-q / 50) * (initial-number-foragers / 25)) report grass-report end
There is only one version of this model, created over 5 years ago by Mike Cisneros-Franco.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Foraging estimates.png | preview | Preview for 'Foraging estimates' | over 5 years ago, by Mike Cisneros-Franco | Download |
This model does not have any ancestors.
This model does not have any descendants.