Adding average profit

This commit is contained in:
Fabien 2013-07-18 00:33:43 +02:00
parent f685ff89a6
commit 2c1f7d4b41
4 changed files with 76 additions and 8 deletions

View File

@ -81,3 +81,26 @@ to-report color-flower [ hi ]
; the following shouldn't happen
error 1
end
to dailyRevenue
let N count beekeepers
; let travel-distance distance spot one-of old-spot]
let travel-distance 0
if any? spots-here [;flower-type [amount-of-hives] of myself (distance myself)
set sumOfallBeekeepersProfit (sumOfallBeekeepersProfit + beekeep-utility ([flower-type] of one-of spots-here) amount-of-hives travel-distance )
]
set averageProfit sumOfallBeekeepersProfit / N
end
to evaluation-procedure
dailyRevenue
end

View File

@ -9,7 +9,10 @@ globals [
sbegin-uncertainty
send-uncertainty
lbegin-uncertainty
lend-uncertainty ]
lend-uncertainty
averageProfit
sumOfallBeekeepersProfit
]
__includes [
"setup-gis.nls"
@ -44,8 +47,8 @@ to go
ask beekeepers
[ if strategy = "with-collective-strategy"
[ let s with-collective-strategy
if any? spots with [ s = self ] [ move-to with-collective-strategy ] ]
if strategy = "with-blind-strategy" [ move-to with-blind-strategy ] ]
if any? spots with [ s = self ] [ set old-spot [who] of spots-here move-to with-collective-strategy evaluation-procedure ] ]
if strategy = "with-blind-strategy" [ set old-spot [who] of spots-here move-to with-blind-strategy evaluation-procedure ] ]
; collect honey and make money
@ -55,7 +58,10 @@ to go
go-pollinate
set yearly-ticks ticks mod 365
if yearly-ticks = 0 [ setup-seasons-uncertainty ]
if yearly-ticks = 0 [
setup-seasons-uncertainty
setup-new-season
]
end
@#$#@#$#@
@ -297,10 +303,28 @@ SWITCH
488
pollinisation-map-on
pollinisation-map-on
0
1
1
-1000
PLOT
703
575
952
768
Average Profit
NIL
NIL
0.0
10.0
0.0
10.0
true
false
"" ""
PENS
"default" 1.0 0 -16777216 true "" "plot averageProfit"
@#$#@#$#@
## WHAT IS IT?
@ -644,7 +668,7 @@ Polygon -7500403 true true 270 75 225 30 30 225 75 270
Polygon -7500403 true true 30 75 75 30 270 225 225 270
@#$#@#$#@
NetLogo 5.0.4
NetLogo 5.0.3
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@

View File

@ -3,7 +3,14 @@ to-report with-collective-strategy
;let potential-empty-spots spots with [ not any? beekeepers-here or member? myself beekeepers-here ]
;let pes-radius-limited potential-empty-spots in-radius d-max
;report max-one-of pes-radius-limited [ beekeep-utility flower-type ([amount-of-hives] of myself) (distance myself) ]
report max-one-of (spots in-radius d-max) with [ not any? beekeepers-here or member? myself beekeepers-here ] [ beekeep-utility flower-type [amount-of-hives] of myself (distance myself) ]
set persistence-length d-max
let available-spots spots in-radius persistence-length
ifelse any? available-spots [
report max-one-of available-spots with [ not any? beekeepers-here or member? myself beekeepers-here ] [ beekeep-utility flower-type [amount-of-hives] of myself (distance myself) ]
]
[
set persistence-length persistence-length + d-max
]
end
to-report with-blind-strategy

View File

@ -1,8 +1,16 @@
breed [ beekeepers beekeeper ]
beekeepers-own [ amount-of-hives ]
beekeepers-own [
amount-of-hives
old-spot
chosen-spot
persistence-length
]
breed [ spots spot ]
breed [ centroids centroid ]
patches-own [ county-name ]
@ -41,3 +49,9 @@ to setup-seasons-uncertainty
set lbegin-uncertainty random-normal 0 season-uncertainty
set lend-uncertainty random-normal 0 season-uncertainty
end
to setup-new-season
set sumOfallBeekeepersProfit 0
set averageProfit 0
end