Merged
This commit is contained in:
parent
2e8d9d0945
commit
1c2d6106e4
|
@ -13,19 +13,20 @@ globals
|
||||||
|
|
||||||
breed [ beekeepers beekeeper ]
|
breed [ beekeepers beekeeper ]
|
||||||
|
|
||||||
breed [ counties county]
|
;;breed [ counties county]
|
||||||
|
|
||||||
breed [ spots spot]
|
breed [ spots spot]
|
||||||
|
|
||||||
patches-own ;;;; wrong patches instead
|
patches-own ;;;; counties as patches
|
||||||
[
|
[
|
||||||
|
best-spot
|
||||||
spots-inside ;;; list of spots inside the county
|
spots-inside ;;; list of spots inside the county
|
||||||
]
|
]
|
||||||
|
|
||||||
spots-own[
|
spots-own[
|
||||||
availability ;;; 0 for free or 1 for occupied
|
availability ;;; 0 for free or 1 for occupied
|
||||||
utility ;;; flower-price
|
utility ;;; flower-price
|
||||||
|
old-utility;;; one of the different utility from the last season
|
||||||
lifetime-of-flowers
|
lifetime-of-flowers
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -58,6 +59,7 @@ to globalinit
|
||||||
set lime-price 4.65
|
set lime-price 4.65
|
||||||
set sunflower-price 2.32
|
set sunflower-price 2.32
|
||||||
set fuelPriceByKm 0.43
|
set fuelPriceByKm 0.43
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -79,8 +81,10 @@ to setup-counties
|
||||||
set color blue
|
set color blue
|
||||||
set strategy-of-turtle 1
|
set strategy-of-turtle 1
|
||||||
]
|
]
|
||||||
create-spots 9 [
|
create-spots 24 [
|
||||||
setxy (nx + random 3) (ny + random 3)
|
setxy (nx + random 3) (ny + random 3)
|
||||||
|
set lifetime-of-flowers 1
|
||||||
|
set utility acacia-price
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -107,10 +111,9 @@ end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
|
||||||
;; GO AND TURTLE STRATEGIES
|
;; GO AND TURTLE STRATEGIES
|
||||||
;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
to go
|
to go
|
||||||
|
|
||||||
|
@ -119,16 +122,16 @@ to go
|
||||||
set current-spot spots-here
|
set current-spot spots-here
|
||||||
ifelse ticks != 0 [ ;;; if its not the beginning
|
ifelse ticks != 0 [ ;;; if its not the beginning
|
||||||
let quant [utility] of current-spot
|
let quant [utility] of current-spot
|
||||||
ifelse quant = 0 [
|
;;;;;;; A REVOIR ;;;;;;;;;;;
|
||||||
|
|
||||||
|
ifelse [lifetime-of-flowers] of current-spot = 0 [
|
||||||
find-a-new-place
|
find-a-new-place
|
||||||
|
|
||||||
]
|
]
|
||||||
[
|
[
|
||||||
stay
|
recolt ;; beekeeper stays on the spot and goes on to recolt
|
||||||
recolt
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
[
|
[;;; at the beginning
|
||||||
follow-strategy
|
follow-strategy
|
||||||
find-a-new-place
|
find-a-new-place
|
||||||
]
|
]
|
||||||
|
@ -138,7 +141,7 @@ to go
|
||||||
set lifetime-of-flowers (lifetime-of-flowers - 1)
|
set lifetime-of-flowers (lifetime-of-flowers - 1)
|
||||||
|
|
||||||
if lifetime-of-flowers = 0 [
|
if lifetime-of-flowers = 0 [
|
||||||
set utility polyflower-price
|
set utility acacia-price
|
||||||
]
|
]
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -146,7 +149,6 @@ to go
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;;;;;Motions procedures;;;;;;;;;;
|
;;;;;;;;Motions procedures;;;;;;;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -164,39 +166,51 @@ to stay
|
||||||
end
|
end
|
||||||
|
|
||||||
to recolt
|
to recolt
|
||||||
set benefit (benefit + ( hivesProd * [utility] of current-spot))
|
set benefit (benefit + ( hivesProd * [utility] of current-spot))
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
to follow-strategy
|
to follow-strategy
|
||||||
;;; its depends of the strategy of the turtle , calibrate in the initialisation
|
;;; its depends of the strategy of the turtle , has to be calibrate in the initialisation
|
||||||
if strategy-of-turtle = 1 [ ;;; choose a random spot
|
|
||||||
let counties-around other counties in-radius max-distance-of-moving
|
|
||||||
set chosen-county one-of counties-around
|
|
||||||
;;;;;
|
|
||||||
cost-of-moving
|
|
||||||
;;;;;
|
|
||||||
move-to chosen-county
|
|
||||||
|
|
||||||
ask chosen-county[ ;;;;;;;;; PROBELMMMMMMMMMMMMMMMMMMMMMM;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
let spots-on-county turtles-here
|
|
||||||
let available-spots spots with [availability = 0] ;; free
|
|
||||||
ifelse any? available-spots
|
|
||||||
[ ;;; there are available spots
|
|
||||||
let best-spot max-one-of available-spots [ utility ]
|
|
||||||
|
|
||||||
set current-spot best-spot
|
|
||||||
move-to best-spot
|
|
||||||
ask best-spot [ set availability 1] ]
|
|
||||||
|
|
||||||
|
|
||||||
[;;;; there arent available spots
|
|
||||||
|
|
||||||
follow-strategy
|
|
||||||
] ] ]
|
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
if strategy-of-turtle = 1 [ ;;; choose a random spot
|
||||||
|
|
||||||
|
let counties-around other patches ;;in-radius max-distance-of-moving
|
||||||
|
set chosen-county one-of counties-around
|
||||||
|
;;;;;
|
||||||
|
;;cost-of-moving
|
||||||
|
;;;;;
|
||||||
|
ask spots-here [
|
||||||
|
set availability 0 ;; as beekeepers is leaving the spot, it becomes free
|
||||||
|
]
|
||||||
|
move-to chosen-county
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; let spots-on-county turtles-here
|
||||||
|
let available-spots spots-here with [availability = 0] ;; free
|
||||||
|
ifelse any? available-spots [ ;;; there are available spots
|
||||||
|
set best-spot max-one-of available-spots [ utility ]
|
||||||
|
]
|
||||||
|
|
||||||
|
[;;;; there isnt any available spot
|
||||||
|
follow-strategy
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
move-to [best-spot] of chosen-county
|
||||||
|
ask [best-spot] of chosen-county [
|
||||||
|
set availability 1
|
||||||
|
]
|
||||||
|
set current-spot [best-spot] of chosen-county
|
||||||
|
|
||||||
|
]
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
if strategy-of-turtle = 2 [ ;;;; choose the nearest county
|
if strategy-of-turtle = 2 [ ;;;; choose the nearest county
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -206,14 +220,6 @@ to follow-strategy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
to check-availability-of-spot
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;;;Utility function;;;;;;;;;;;;;
|
;;;;;;Utility function;;;;;;;;;;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -227,8 +233,6 @@ to cost-of-moving
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;; change the cost and profit variables during a recolt
|
;;; change the cost and profit variables during a recolt
|
||||||
to calculate-cost-profit
|
to calculate-cost-profit
|
||||||
|
|
||||||
|
@ -256,11 +260,11 @@ end
|
||||||
GRAPHICS-WINDOW
|
GRAPHICS-WINDOW
|
||||||
276
|
276
|
||||||
10
|
10
|
||||||
709
|
1296
|
||||||
464
|
1051
|
||||||
23
|
-1
|
||||||
23
|
-1
|
||||||
9.0
|
10.0
|
||||||
1
|
1
|
||||||
10
|
10
|
||||||
1
|
1
|
||||||
|
@ -270,10 +274,10 @@ GRAPHICS-WINDOW
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
-23
|
0
|
||||||
23
|
100
|
||||||
-23
|
0
|
||||||
23
|
100
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
|
@ -349,7 +353,7 @@ BUTTON
|
||||||
59
|
59
|
||||||
NIL
|
NIL
|
||||||
go
|
go
|
||||||
T
|
NIL
|
||||||
1
|
1
|
||||||
T
|
T
|
||||||
OBSERVER
|
OBSERVER
|
||||||
|
@ -946,7 +950,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
|
Polygon -7500403 true true 30 75 75 30 270 225 225 270
|
||||||
|
|
||||||
@#$#@#$#@
|
@#$#@#$#@
|
||||||
NetLogo 5.0.4
|
NetLogo 5.0.3
|
||||||
@#$#@#$#@
|
@#$#@#$#@
|
||||||
set too-close 1.5
|
set too-close 1.5
|
||||||
set too-far 2.0
|
set too-far 2.0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user