CODE NETLOGO 2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SPRITE Regulation Model
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Variable and Breed declarations
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
globals [
country
region
event
a b c d
datafile
resfile0
resfileN
iteration
attempt
TTN ; total turtles number
TPNGat ; total gatekeepers
TPNRes ; total controllers
TPNBus ; total businesses
GiniIndex
MeanLevelOfResources
MeanLevelOfNaturalResources
MeanLevelOfCulturalResources
MeanLevelOfSocialResources
MeanLevelOfEconomicResources
MeanLevelOfTouristsDensity
MaxTouristsDensity
MeanLevelOfTPrefforNaturalResources
MeanLevelOfTPrefforCulturalResources
MeanLevelOfTPrefforSocialResources
MeanLevelOfTPrefforEconomicResources
MeanLevelOfRBGPrefforNaturalResources
MeanLevelOfRBGPrefforCulturalResources
MeanLevelOfRBGPrefforSocialResources
MeanLevelOfRBGPrefforEconomicResources
MeanLevelOfRBGPerceptOfPrefforNaturalResources
MeanLevelOfRBGPerceptOfPrefforCulturalResources
MeanLevelOfRBGPerceptOfPrefforSocialResources
MeanLevelOfRBGPerceptOfPrefforEconomicResources
blast-radius
listof-patches-with-underused-resources
listof-turtles-with-same-profile
collective-build-in-goal
numof-controlled-patches
numof-used-patches
numof-promoted-patches
numof-visited-patches
numof-controlled-patcheswith-natural-resources
numof-controlled-patcheswith-cultural-resources
numof-controlled-patcheswith-social-resources
numof-controlled-patcheswith-economic-resources
numof-used-patcheswith-natural-resources
numof-used-patcheswith-cultural-resources
numof-used-patcheswith-social-resources
numof-used-patcheswith-economic-resources
numof-promoted-patcheswith-natural-resources
numof-promoted-patcheswith-cultural-resources
numof-promoted-patcheswith-social-resources
numof-promoted-patcheswith-economic-resources
numof-visited-patcheswith-natural-resources
numof-visited-patcheswith-cultural-resources
numof-visited-patcheswith-social-resources
numof-visited-patcheswith-economic-resources
numof-visitorsof-patcheswith-natural-resources
numof-visitorsof-patcheswith-cultural-resources
numof-visitorsof-patcheswith-social-resources
numof-visitorsof-patcheswith-economic-resources
numof-unsatisfied-tourists
avenumof-unsatisfied-communities
;minnumof-unsatisfied-communities
;maxnumof-unsatisfied-communities
HostCommunitiesConflicts
;;;;;;;;;; for sitsim ;;;;;;;;;;;;;
BusinessesFor ;; number of white turtles
BusinessesAgainst ;; number of black turtles
Communitiesfor ;; number of white turtles
CommunitiesAgainst ;; number of black turtles
changed? ;; has any turtle changed its colour?
Rfor
Rneu
Rcon
Bfor
Bneu
Bcon
Gfor
Gneu
Gcon
Cfor
Cneu
Ccon
;;;;;;;;;; for iterated NPD ;;;;;;;;;;;;;
;num-turtles-controllers
num-cooperate
num-defect
num-tit-for-tat
num-unforgiving
num-suspicious-tft
num-trusting-ad
;;number of interactions by each strategy
num-cooperate-games
num-defect-games
num-tit-for-tat-games
num-unforgiving-games
num-suspicious-tft-games
num-trusting-ad-games
;;total score of all turtles playing each strategy
cooperate-score
defect-score
tit-for-tat-score
unforgiving-score
suspicious-tft-score
trusting-ad-score
;;;;;;;;;; base scenario ;;;;;;;;;;;;;
px
xpartners
xTp
numof-conflictsVn-between-controllers-and-controllers
numof-conflictsVn-between-controllers-and-businesses
numof-conflictsVn-between-controllers-and-gatekeepers
numof-conflictsVn-between-controllers-and-communities
numof-conflictsVn-between-controllers-and-institutions
numof-conflictsVn-between-businesses-and-controllers
numof-conflictsVn-between-businesses-and-businesses
numof-conflictsVn-between-businesses-and-gatekeepers
numof-conflictsVn-between-businesses-and-communities
numof-conflictsVn-between-businesses-and-institutions
numof-conflictsVn-between-gatekeepers-and-controllers
numof-conflictsVn-between-gatekeepers-and-businesses
numof-conflictsVn-between-gatekeepers-and-gatekeepers
numof-conflictsVn-between-gatekeepers-and-communities
numof-conflictsVn-between-gatekeepers-and-institutions
numof-conflictsVn-between-communities-and-controllers
numof-conflictsVn-between-communities-and-businesses
numof-conflictsVn-between-communities-and-gatekeepers
numof-conflictsVn-between-communities-and-communities
numof-conflictsVn-between-communities-and-institutions
numof-conflictsVn-between-institutions-and-controllers
numof-conflictsVn-between-institutions-and-businesses
numof-conflictsVn-between-institutions-and-gatekeepers
numof-conflictsVn-between-institutions-and-communities
numof-conflictsVn-between-institutions-and-institutions
numof-conflictsVc-between-controllers-and-controllers
numof-conflictsVc-between-controllers-and-businesses
numof-conflictsVc-between-controllers-and-gatekeepers
numof-conflictsVc-between-controllers-and-communities
numof-conflictsVc-between-controllers-and-institutions
numof-conflictsVc-between-businesses-and-controllers
numof-conflictsVc-between-businesses-and-businesses
numof-conflictsVc-between-businesses-and-gatekeepers
numof-conflictsVc-between-businesses-and-communities
numof-conflictsVc-between-businesses-and-institutions
numof-conflictsVc-between-gatekeepers-and-controllers
numof-conflictsVc-between-gatekeepers-and-businesses
numof-conflictsVc-between-gatekeepers-and-gatekeepers
numof-conflictsVc-between-gatekeepers-and-communities
numof-conflictsVc-between-gatekeepers-and-institutions
numof-conflictsVc-between-communities-and-controllers
numof-conflictsVc-between-communities-and-businesses
numof-conflictsVc-between-communities-and-gatekeepers
numof-conflictsVc-between-communities-and-communities
numof-conflictsVc-between-communities-and-institutions
numof-conflictsVc-between-institutions-and-controllers
numof-conflictsVc-between-institutions-and-businesses
numof-conflictsVc-between-institutions-and-gatekeepers
numof-conflictsVc-between-institutions-and-communities
numof-conflictsVc-between-institutions-and-institutions
numof-conflictsXi-between-controllers-and-controllers
numof-conflictsXi-between-controllers-and-businesses
numof-conflictsXi-between-controllers-and-gatekeepers
numof-conflictsXi-between-controllers-and-communities
numof-conflictsXi-between-controllers-and-institutions
numof-conflictsXi-between-businesses-and-controllers
numof-conflictsXi-between-businesses-and-businesses
numof-conflictsXi-between-businesses-and-gatekeepers
numof-conflictsXi-between-businesses-and-communities
numof-conflictsXi-between-businesses-and-institutions
numof-conflictsXi-between-gatekeepers-and-controllers
numof-conflictsXi-between-gatekeepers-and-businesses
numof-conflictsXi-between-gatekeepers-and-gatekeepers
numof-conflictsXi-between-gatekeepers-and-communities
numof-conflictsXi-between-gatekeepers-and-institutions
numof-conflictsXi-between-communities-and-controllers
numof-conflictsXi-between-communities-and-businesses
numof-conflictsXi-between-communities-and-gatekeepers
numof-conflictsXi-between-communities-and-communities
numof-conflictsXi-between-communities-and-institutions
numof-conflictsXi-between-institutions-and-controllers
numof-conflictsXi-between-institutions-and-businesses
numof-conflictsXi-between-institutions-and-gatekeepers
numof-conflictsXi-between-institutions-and-communities
numof-conflictsXi-between-institutions-and-institutions
numof-conflictsEi-between-controllers-and-controllers
numof-conflictsEi-between-controllers-and-businesses
numof-conflictsEi-between-controllers-and-gatekeepers
numof-conflictsEi-between-controllers-and-communities
numof-conflictsEi-between-controllers-and-institutions
numof-conflictsEi-between-businesses-and-controllers
numof-conflictsEi-between-businesses-and-businesses
numof-conflictsEi-between-businesses-and-gatekeepers
numof-conflictsEi-between-businesses-and-communities
numof-conflictsEi-between-businesses-and-institutions
numof-conflictsEi-between-gatekeepers-and-controllers
numof-conflictsei-between-gatekeepers-and-businesses
numof-conflictsEi-between-gatekeepers-and-gatekeepers
numof-conflictsEi-between-gatekeepers-and-communities
numof-conflictsEi-between-gatekeepers-and-institutions
numof-conflictsEi-between-communities-and-controllers
numof-conflictsEi-between-communities-and-businesses
numof-conflictsEi-between-communities-and-gatekeepers
numof-conflictsEi-between-communities-and-communities
numof-conflictsEi-between-communities-and-institutions
numof-conflictsEi-between-institutions-and-controllers
numof-conflictsEi-between-institutions-and-businesses
numof-conflictsEi-between-institutions-and-gatekeepers
numof-conflictsEi-between-institutions-and-communities
numof-conflictsEi-between-institutions-and-institutions
DefectGatekeepers
DefectControllers
DefectBusinesses
DefectCommunities
DefectInstitutions
CoopGatekeepers
CoopControllers
CoopBusinesses
TypeOfRegulation
Provision
Control
NewRegulation
Regulation
Supply
Promotion
Cooperation
KilledTourists
;;Sliders
;Iterations ;; determines the number of simulations to be done
;ResourcesDensity ; low medium high
;ResourcesThreshold ; 0.5 .. 0.9
;CollectiveObjective
;BottomUpRegulation
;UnderUsedResources
;NewTourists ; 0 .. 100
;TouristsDensityEvolution ; 1..5
]
;turtles
;[
;who ; 1 rank order number of each turtle: varies from 0 to ...
;color ; 2 turtle color: varies with breed
;heading ; 3 turtle orientation
;xcor ; 4 turtle x coordinate
;ycor ; 5 turtle y coordinate
;shape ; 6 turtle shape (default)
;pen-down? ; 7 false
;label ; 8 first letter of breed + rank order number in the database
;label-color ; 9 grey (9.9999)
;breed ;10 group (complete name of role)
;hidden? ;11 false
;size ;12 default or copy of energy
;]
turtles-own
[
;input data
energy ; Ri*Si;T occup ;13
Ri ;14
Gi ;15
Si ;16
Xi ;17
Ei ;18
Dij ;19
Nij ;20
preffor-natural-resources ;21
preffor-cultural-resources;22
preffor-social-resources ;23
preffor-economic-resources;24
preffor-accomodations ;25
preffor-catering ;26
preffor-leisures ;27
preffor-attractions ;28
preffor-foods ;29
preffor-landscape ;30
preffor-crafts ;31
tourist-freq ;32 from TQ3.2 1= first time, 2=decond time 3=third time & +
tourist-satisfaction ;33 from TQ4.3 1=Exceeded, 2=Matched, 3=Fallen below, 4=Other respons
tourist-plan ;34 from TQ4.8.3 1=yes, 2=no, 3=?
perceptionOfTpreffor-natural-resources ;35
perceptionOfTpreffor-cultural-resources ;36
perceptionOfTpreffor-social-resources ;37
perceptionOfTpreffor-economic-resources ;38
Qx3 ;39
Qx5 ;40
Q5113i ;41
Q5114i ;42
;intermediate variable
resources-preference
;preffor-underused-resources
tourists-perception
PositionInFaceOfCollectiveObjective
WillingnessToAcceptAccessToPatch
WillingnessToCirculateInformationOnPatch
;;;;;;;;; for sitsim ;;;;;;;;;;;;;;;;;;
strength ;; of influence, set at initialisation to a random value
;;;;;;;;; for iterated NPD ;;;;;;;;;;;
challenger ;; id number (who) of business that convinced a controller
challenged? ;; am I challenged by an other actor, i.e. have I been convinced by an other actor?
strategy
score ;;my current score
partnered? ;;am I partnered?
partner ;;the who of my partner
partner-defected? ;;did my partner defect last round?
partner-history ;;a list containing information about past interactions
;;with other turtles (indexed by WHO values)
defect-now? ;;what will I do this round?
cooperative-partners ;;list of my cooperative partners
defected-partners ;;list of my non cooperative partners
new-active-patches ;;list of patches newly controlled/used/promoted
previous-energy ;;energy at the end of the last iteration
gains ;;energy variation between two successive rounds
total-gains ;;sum of gains
conflict1 ;;actors that moved on the same patch for not doing the same thing
conflict2 ;;actors arround the influence area of one with diffrent objectives
cooperation1 ;;actors that moved on the same patch for doing the same thing
cooperation2 ;;actors arround the influence area of one with the same idea
conflict-with-R
conflict-with-B
conflict-with-C
conflict-with-G
conflict-with-I
conflictVn-with-R
conflictVn-with-B
conflictVn-with-C
conflictVn-with-G
conflictVn-with-I
conflictVc-with-R
conflictVc-with-B
conflictVc-with-C
conflictVc-with-G
conflictVc-with-I
conflictXi-with-R
conflictXi-with-B
conflictXi-with-C
conflictXi-with-G
conflictXi-with-I
conflictEi-with-R
conflictEi-with-B
conflictEi-with-C
conflictEi-with-G
conflictEi-with-I
cooperation-with-R
cooperation-with-B
cooperation-with-G
;ownedpatches ;;list of patches wher I have acted
]
;patches
;[
;pxcor ; 1 patch x coordinate: varies from -12 to +12
;pycor ; 2 patch y coordinate: varies from -12 to +12
;pcolor ; 3 patch color: varies with the amount of local resources
;plabel ; 4 nil
;plabel-color ; 5 9.9999
;]
patches-own
[
;intermediate variables computed as sum of input data preffor... of turtles on each patch
resources ; 6
natural-resources ; 7
cultural-resources ; 8
social-resources ; 9
economic-resources ;10
accomodations ;11
catering ;12
leisures ;13
attractions ;14
foods ;15
landscape ;16
crafts ;17
p ;18
cost ;19
benefit ;20
controlled-by ;21 list of labels the controllers of the resources on the patch
used-by ;22 list of labels the users of the resources on the patch
promoted-by ;23 list of labels the promoters of the resources on the patch
visited-by ;24 list of labels tourists on the patch
liked-by ;25 list of labels communities liking that is on the patch
supported-by ;26 list of labels institutions supporting that is on the patch
controlled-byw ;27 list of who the controllers of the resources on the patch
used-byw ;28 list of who the users of the resources on the patch
promoted-byw ;29 list of who the promoters of the resources on the patch
visited-byw ;30 list of who tourists on the patch
liked-byw ;31 list of who communities liking that is on the patch
supported-byw ;32 list of who institutions supporting that is on the patch
]
breeds
[
tourists
gatekeepers
controllers
businesses
communities
institutions
cooperative-actors
greedy-actors
nodes
edges
]
;;;;;;;;;;;;;;;;;;;;;
;; Setup Procedures ;;
;;;;;;;;;;;;;;;;;;;;;
to setup
locals [cou reg eve w x y z]
clear-all
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;selection of the simulation context
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
set a (user-choice "Please, select a country " [ "CZ" "IR" "UK" "SP" "GR" "FR"])
set country a
set cou a
set b (user-choice "Please, select a study region " [ "1" "2"])
set region b
set reg b
;set c (user-choice "Please, select an event \n(GS=General event; RSS=Region-specific event)" [ "-GS" "-RSS"])
set c "-GS";; regulation model is only to be ran under the general event
set event c
set eve c
set a word "SPRITE-" country
set b word a region
set c word b event
;set datafile word c "worldForRegulation-jpb-b.txt"
;set datafile word c "worldForRegulation.txt"
;;;;;;;;;;;; reusing or not of the model of the simulation contxt ;;;;;;;;;;
ifelse "Yes" = (user-choice "Would you like to use the built-in grid of resources?" [ "Yes" "No" ])
[;1open yes
set datafile word c "resultsOfRegulation0.csv"
print "Please, wait for a few moment..."
print "... I am loading the base scenario"
print datafile
import-world datafile
set country cou
set region reg
set event eve
;setup-user-input-parameters-1
setup-user-input-parameters-2
;;;;;;;;;;;;;; using or not of the current parameters ;;;;;;;;;;;;;;;;;;;;;;;
ifelse "Yes" = (user-choice "Do you agree with the values of these parameters?" [ "Yes" "No" ])
[;2yes
without-interruption
[
;store-initial-turtle-counts ;;record the number of turtles for each strategy
;setup-common-variables ;;sets the variables that all turtles share
;do-plotting
set TTN count turtles
set iteration 0
print-initial-situation
do-base-scenario
set a word "SPRITE-" cou
set b word a reg
set c word b eve
set d word c "resultsOfRegulation"
set w word d "-BaseS-"
set resfile0 word d iteration
export-world resfile0
print "Now, run the simulations"
]
];2
[;2no
print "Setup the parameters"
stop
];2
];1 close yes
[;1 open no
set datafile word c "worldForRegulation.txt"
print "Please, wait for a few moment..."
print "... I am loading the database"
print datafile
import-world datafile
;setup-shape-of-communities-and-institutions-and-gatekeepers
setup-resources-of-patches-from-random
set TTN count turtles
print "... I am distributing the controllers"
setup-preferences-of-controllers
if "No" = (user-choice "Do you agree with this distribution?" [ "Yes" "No" ])
[
print "Setup the data again"
stop
]
print "... I am distributing the businesses"
setup-preferences-of-businesses
if "No" = (user-choice "Do you agree with this distribution?" [ "Yes" "No" ])
[
print "Setup the data again"
stop
]
print "... I am distributing the gatekeepers preferences"
setup-preferences-of-gatekeepers
print "... I am distributing the communities preferences"
setup-preferences-of-communities
print "... I am distributing the institutions preferences"
setup-preferences-of-institutions
print "... I am distributing the tourists"
setup-preferences-of-tourists
setup-user-input-parameters-1
setup-user-input-parameters-2
print-initial-situation
ifelse "Yes" = (user-choice "Do you agree with the values of these parameters?" [ "Yes" "No" ])
[
set iteration 0
print "Please, wait for a few moment..."
print "... I am building the base scenario"
do-base-scenario
; set a word "SPRITE-" country
; set b word a region
; set c word b event
; set d word c "resultsOfRegulation"
; set resfile0 word d iteration
; export-world resfile0
set a word "SPRITE-" cou
set b word a reg
set c word b eve
set d word c "resultsOfRegulation"
set w word d "-BaseS-"
set resfile0 word d iteration
export-world resfile0
print "Now, run the simulations"
]
[
print "Setup the parameters"
stop
]
];close no
end
to setup-user-input-parameters-1
set Iterations 10
;set VisionRange 100
set BottomUpRegulation? true
set ResourcesDensity 1
set ResourcesThreshold 0.5
set UnderUsedResources "natural&cultural"
set TypeOfRegulation "market"
set CollectiveObjective "all together"
set NewTourists 20
set TouristsDensityEvolution 2
;print "Value of parameters:"
;type "NbOf Iterations " print Iterations
;type "VisionRange " print VisionRange
;type "BottomUpRegulation " print BottomUpRegulation?
;type "ResourcesDensity " print ResourcesDensity
;type "ResourcesThreshold " print ResourcesThreshold
;type "UnderUsedResources " print UnderUsedResources
;type "CollectiveObjective " print CollectiveObjective
;type "NewTourists " print NewTourists
;type "TouristsDensityEvolution " print TouristsDensityEvolution
;type "MaxTouristsDensity " print precision MaxTouristsDensity 2
end
to setup-user-input-parameters-2
print "Value of parameters:"
type "NbOf Iterations " print Iterations
;type "VisionRange " print VisionRange
type "BottomUpRegulation " print BottomUpRegulation?
type "ResourcesDensity " print ResourcesDensity
type "ResourcesThreshold " print ResourcesThreshold
type "UnderUsedResources " print UnderUsedResources
type "TypeOfRegulation" print TypeOfRegulation
type "CollectiveObjective " print CollectiveObjective
type "NewTourists " print NewTourists
type "TouristsDensityEvolution " print TouristsDensityEvolution
type "MaxTouristsDensity " print precision MaxTouristsDensity 2
if (CollectiveObjective = "more provision of resources") [set collective-build-in-goal 0]
if (CollectiveObjective = "more quality of resources") [set collective-build-in-goal 2]
;if (CollectiveObjective = "create new regulations") [set collective-build-in-goal 4]
;if (CollectiveObjective = "more application of current regulations") [set collective-build-in-goal 6]
if (CollectiveObjective = "more supply of tourism products & services") [set collective-build-in-goal 8]
if (CollectiveObjective = "more promotion of place and products") [set collective-build-in-goal 10]
;if (CollectiveObjective = "more cooperation") [set collective-build-in-goal 12]
if (CollectiveObjective = "all together") [set collective-build-in-goal 999]
ifelse CollectiveObjective = "all together"
[
ask turtles with [breed = controllers or breed = businesses or breed = gatekeepers or breed = communities]
[
without-interruption
[
ifelse (Ei = 0 or Ei = 2 or Ei = 8 or Ei = 10)
[set Q5113i 999]
[set Q5113i 0]
ifelse (Xi > 0 and Q5113i = 999)
[set PositionInFaceOfCollectiveObjective 1]
[set PositionInFaceOfCollectiveObjective 0]
]
]
]
[
ask turtles with [breed = controllers or breed = businesses or breed = gatekeepers or breed = communities]
[
without-interruption
[
ifelse (Xi > 0 and Ei = collective-build-in-goal)
[set PositionInFaceOfCollectiveObjective 1]
[set PositionInFaceOfCollectiveObjective 0]
]
]
]
end
to setup-shape-of-communities-and-institutions-and-gatekeepers
ask turtles
[
if (breed = communities or breed = institutions or breed = gatekeepers) [hideturtle];
]
end
to setup-resources-of-patches-from-random
locals [economic-products social-products max-economic-products max-social-products]
ask patches
[
without-interruption
[
set controlled-by []
set used-by []
set promoted-by []
set visited-by []
set liked-by []
set supported-by []
set controlled-byw []
set used-byw []
set promoted-byw []
set visited-byw []
set liked-byw []
set supported-byw []
set natural-resources precision (random-int-or-float 1.0) 1
set cultural-resources precision (random-int-or-float 1.0) 1
set social-resources precision (random-int-or-float 1.0) 1
set economic-resources precision (random-int-or-float 1.0) 1
set accomodations precision (random-int-or-float 1.0) 1
set catering precision (random-int-or-float 1.0) 1
set leisures precision (random-int-or-float 1.0) 1
set attractions precision (random-int-or-float 1.0) 1
set foods precision (random-int-or-float 1.0) 1
set landscape precision (random-int-or-float 1.0) 1
set crafts precision (random-int-or-float 1.0) 1
set economic-products []
set economic-products lput accomodations economic-products
set economic-products lput catering economic-products
set economic-products lput foods economic-products
set economic-products lput crafts economic-products
set max-economic-products max economic-products
set social-products []
set social-products lput accomodations social-products
set social-products lput catering social-products
set social-products lput attractions social-products
set max-social-products max social-products
if (natural-resources < landscape) [set natural-resources landscape ]
if (cultural-resources < attractions) [set cultural-resources attractions ]
if (social-resources < max social-products) [set social-resources max-social-products ]
if (economic-resources < max economic-products) [set economic-resources max-economic-products ]
set resources ((natural-resources + cultural-resources + social-resources + economic-resources) / 4)
set pcolor 59 - (resources * 8)
]
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;
; setup of controllers
;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-preferences-of-controllers
locals [tt tpn tpc tps tpe]
set tt count turtles with [breed = controllers]
set tpn count turtles with [breed = controllers and preffor-natural-resources = 1]
set tpc count turtles with [breed = controllers and preffor-cultural-resources = 1]
set tps count turtles with [breed = controllers and preffor-social-resources = 1]
set tpe count turtles with [breed = controllers and preffor-economic-resources = 1]
if ((tpn / tt) < (0.10 * ResourcesDensity))
[
print "controllers preferences for natural resources were randomly redefined"
ask turtles with [breed = controllers and preffor-natural-resources = 0 ]
[
without-interruption
[
set preffor-natural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpc / tt) < (0.10 * ResourcesDensity))
[
print "controllers preferences for cultural resources were randomly redefined"
ask turtles with [breed = controllers and preffor-cultural-resources = 0 ]
[
without-interruption
[
set preffor-cultural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tps / tt) < (0.10 * ResourcesDensity))
[
print "controllers preferences for social resources were randomly redefined"
ask turtles with [breed = controllers and preffor-social-resources = 0 ]
[
without-interruption
[
set preffor-social-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpe / tt) < (0.10 * ResourcesDensity))
[
print "controllers preferences for economic resources were randomly redefined"
ask turtles with [breed = controllers and preffor-economic-resources = 0 ]
[
without-interruption
[
set preffor-economic-resources precision (random-int-or-float 1.0) 1
]
]
]
ask turtles with [breed = controllers]
[
without-interruption
[
set attempt 0
set gains 0
set total-gains 0
set resources-preference ((preffor-natural-resources + preffor-cultural-resources + preffor-social-resources + preffor-economic-resources) / 4)
set WillingnessToAcceptAccessToPatch Xi
search-for-afree-place-for-controllers
]
]
type count patches with [count turtles-here with [breed = controllers] > 0] print " controllers located"
end
to search-for-afree-place-for-controllers
locals [TNp TNp8 OTNp8 MTNp8 MTNp8natural MTNp8cultural MTNp8social MTNp8economic X Y dis]
ifelse (attempt < 2000)
[
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
set TNp count turtles-here
ifelse (TNp > 1)
[;there are other turtles here
set attempt attempt + 1
search-for-afree-place-for-controllers ; search for an other place
]
[;there are no other turtles here
set TNp8 count turtles in-radius (ResourcesDensity * 4);8; number of turtles on the eight patches around the calling turtle or patch
ifelse (TNp8 < 2)
[;there are no other turtles around the asked turtle
expand-preferences-ofcontrollers
]
[; there are other turtles arround the asked turtle
set OTNp8 max-one-of turtles in-radius (ResourcesDensity * 4) [size]; who is the bigest neighbour
set dis distance OTNp8
ifelse (dis >= ((size-of OTNp8 * ResourcesDensity) + (2 * (size * ResourcesDensity))))
[
expand-preferences-ofcontrollers
]
[
;ifelse (resources-preference-of OTNp8 = resources-preference)
set MTNp8natural mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-natural-resources];
set MTNp8cultural mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-cultural-resources];
set MTNp8social mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-social-resources];
set MTNp8economic mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-economic-resources];
ifelse
(
MTNp8natural = preffor-natural-resources
and
MTNp8cultural = preffor-cultural-resources
and
MTNp8social = preffor-social-resources
and
MTNp8economic = preffor-economic-resources
)
[;my neighbours have the same view to me
;expand-preferences-ofcontrollers
set attempt attempt + 1
search-for-afree-place-for-controllers ; search for an other place
]
[;others dont have the same view
set attempt attempt + 1
search-for-afree-place-for-controllers ; search for an other place
];close else
];close else
];close else
];close else
];close if
[
; turtle remains here even if it is not its optimal position !
nonexpand-preferences
]
end
to expand-preferences-ofcontrollers ; optimal position !
locals [TNp TPnr TPcr TPsr TPer TPacc TPcat TPleis TPatt TPlan TPfoo TPcra
economic-products social-products max-economic-products max-social-products]
set TPnr preffor-natural-resources
set TPcr preffor-cultural-resources
set TPsr preffor-social-resources
set TPer preffor-economic-resources
set TPacc preffor-accomodations
set TPcat preffor-catering
set TPleis preffor-leisures
set TPatt preffor-attractions
set TPfoo preffor-foods
set TPlan preffor-landscape
set TPcra preffor-crafts
ask patches in-radius (ResourcesDensity * size)
[
without-interruption
[
set controlled-by lput label-of myself controlled-by
set controlled-byw lput myself controlled-byw
set plabel "."
;if who-of myself >= TTN [set plabel "r."]
set natural-resources TPnr
set cultural-resources TPcr
set social-resources TPsr
set economic-resources TPer
set accomodations TPacc
set catering TPcat
set leisures TPleis
set attractions TPatt
set foods TPfoo
set landscape TPlan
set crafts TPcra
set economic-products []
set economic-products lput accomodations economic-products
set economic-products lput catering economic-products
set economic-products lput foods economic-products
set economic-products lput crafts economic-products
set max-economic-products max economic-products
set social-products []
set social-products lput accomodations social-products
set social-products lput catering social-products
set social-products lput attractions social-products
set max-social-products max social-products
if (natural-resources < landscape) [set natural-resources landscape ]
if (cultural-resources < attractions) [set cultural-resources attractions ]
if (social-resources < max social-products) [set social-resources max-social-products ]
if (economic-resources < max economic-products) [set economic-resources max-economic-products ]
set resources ((natural-resources + cultural-resources + social-resources + economic-resources) / 4)
set pcolor 59 - (resources * 8)
;set pcolor violet
]
]
;set TNp count patches with [member? label-of myself controlled-by]
;type TNp type " patches could be controlled by " print label;-of myself
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; setup of businesses
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-preferences-of-businesses
locals [tt tpn tpc tps tpe]
set tt count turtles with [breed = businesses]
set tpn count turtles with [breed = businesses and preffor-natural-resources = 1]
set tpc count turtles with [breed = businesses and preffor-cultural-resources = 1]
set tps count turtles with [breed = businesses and preffor-social-resources = 1]
set tpe count turtles with [breed = businesses and preffor-economic-resources = 1]
if ((tpn / tt) < (0.10 * ResourcesDensity))
[
print "businesses preferences for natural resources were randomly redefined"
ask turtles with [breed = businesses and preffor-natural-resources = 0 ]
[
without-interruption
[
set preffor-natural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpc / tt) < (0.10 * ResourcesDensity))
[
print "businesses preferences for cultural resources were randomly redefined"
ask turtles with [breed = businesses and preffor-cultural-resources = 0 ]
[
without-interruption
[
set preffor-cultural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tps / tt) < (0.10 * ResourcesDensity))
[
print "businesses preferences for social resources were randomly redefined"
ask turtles with [breed = businesses and preffor-social-resources = 0 ]
[
without-interruption
[
set preffor-social-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpe / tt) < (0.10 * ResourcesDensity))
[
print "businesses preferences for economic resources were randomly redefined"
ask turtles with [breed = businesses and preffor-economic-resources = 0 ]
[
without-interruption
[
set preffor-economic-resources precision (random-int-or-float 1.0) 1
]
]
]
ask turtles with [breed = businesses]
[
without-interruption
[
set attempt 0
set gains 0
set total-gains 0
set resources-preference ((preffor-natural-resources + preffor-cultural-resources + preffor-social-resources + preffor-economic-resources) / 4)
search-for-afree-place-for-businesses
]
]
type count patches with [count turtles-here with [breed = businesses] > 0] print " businesses located"
end
to search-for-afree-place-for-businesses
locals [TNp TNp8 OTNp8 MTNp8 MTNp8natural MTNp8cultural MTNp8social MTNp8economic X Y dis]
ifelse (attempt < 2000)
[
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
set TNp count turtles-here
ifelse (TNp > 1)
[;there are other turtles here
set attempt attempt + 1
search-for-afree-place-for-businesses ; search for an other place
]
[;there are no other turtles here
set TNp8 count turtles in-radius (ResourcesDensity * 4);8; number of turtles on the eight patches around the calling turtle or patch
ifelse (TNp8 < 2)
[;there are no other turtles around the asked turtle
expand-preferences-ofbusinesses
]
[; there are other turtles arround the asked turtle
set blast-radius max values-from turtles in-radius (ResourcesDensity * 4) [size]; size of the bigest neighbour
set OTNp8 max-one-of turtles in-radius (ResourcesDensity * 4) [size]; who is the bigest neighbour
set dis distance OTNp8
ifelse (dis >= ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity * 4)))
[
expand-preferences-ofbusinesses
]
[
;ifelse (resources-preference-of OTNp8 = resources-preference)
set MTNp8natural mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-natural-resources];
set MTNp8cultural mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-cultural-resources];
set MTNp8social mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-social-resources];
set MTNp8economic mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-economic-resources];
ifelse
(
MTNp8natural = preffor-natural-resources
and
MTNp8cultural = preffor-cultural-resources
and
MTNp8social = preffor-social-resources
and
MTNp8economic = preffor-economic-resources
)
[;my neighbours have the same view to me
expand-preferences-ofbusinesses
]
[;others dont have the same view
set attempt attempt + 1
search-for-afree-place-for-businesses ; search for an other place
];close else
];close else
];close else
];close else
];close if
[
; turtle remains here even if it is not its optimal position !
nonexpand-preferences
]
end
to expand-preferences-ofbusinesses ; optimal position !
locals [TNp TPnr TPcr TPsr TPer TPacc TPcat TPleis TPatt TPlan TPfoo TPcra
economic-products social-products max-economic-products max-social-products]
set TPnr preffor-natural-resources
set TPcr preffor-cultural-resources
set TPsr preffor-social-resources
set TPer preffor-economic-resources
set TPacc preffor-accomodations
set TPcat preffor-catering
set TPleis preffor-leisures
set TPatt preffor-attractions
set TPfoo preffor-foods
set TPlan preffor-landscape
set TPcra preffor-crafts
ask patches in-radius (ResourcesDensity * size)
[
without-interruption
[
set used-by lput label-of myself used-by
set used-byw lput myself used-byw
set plabel "+"
;if who-of myself >= TTN [set plabel "b+"]
set natural-resources TPnr
set cultural-resources TPcr
set social-resources TPsr
set economic-resources TPer
set accomodations TPacc
set catering TPcat
set leisures TPleis
set attractions TPatt
set foods TPfoo
set landscape TPlan
set crafts TPcra
set economic-products []
set economic-products lput accomodations economic-products
set economic-products lput catering economic-products
set economic-products lput foods economic-products
set economic-products lput crafts economic-products
set max-economic-products max economic-products
set social-products []
set social-products lput accomodations social-products
set social-products lput catering social-products
set social-products lput attractions social-products
set max-social-products max social-products
if (natural-resources < landscape) [set natural-resources landscape ]
if (cultural-resources < attractions) [set cultural-resources attractions ]
if (social-resources < max social-products) [set social-resources max-social-products ]
if (economic-resources < max economic-products) [set economic-resources max-economic-products ]
set resources ((natural-resources + cultural-resources + social-resources + economic-resources) / 4)
set pcolor 59 - (resources * 8)
;set pcolor violet
]
]
;set TNp count patches with [member? label-of myself used-by]
;type TNp type " patches could be used by " print label;-of myself
end
to nonexpand-preferences ; non optimal position !
locals [TPnr TPcr TPsr TPer TPacc TPcat TPleis TPatt TPlan TPfoo TPcra
economic-products social-products max-economic-products max-social-products]
type label show " has a sub optimal position"
;set TTN TTN + 1
set TPnr preffor-natural-resources
set TPcr preffor-cultural-resources
set TPsr preffor-social-resources
set TPer preffor-economic-resources
set TPacc preffor-accomodations
set TPcat preffor-catering
set TPleis preffor-leisures
set TPatt preffor-attractions
set TPfoo preffor-foods
set TPlan preffor-landscape
set TPcra preffor-crafts
ask patch-here ;in-radius 1; size
[
without-interruption
[
if (breed-of myself = controllers) [set controlled-by lput label-of myself controlled-by]
if (breed-of myself = businesses) [set used-by lput label-of myself used-by]
if (breed-of myself = gatekeepers) [set promoted-by lput label-of myself promoted-by]
if (breed-of myself = tourists) [set visited-by lput label-of myself visited-by]
if (breed-of myself = controllers) [set controlled-byw lput myself controlled-byw]
if (breed-of myself = businesses) [set used-byw lput myself used-byw]
if (breed-of myself = gatekeepers) [set promoted-byw lput myself promoted-byw]
if (breed-of myself = tourists) [set visited-byw lput myself visited-byw]
set natural-resources TPnr
set cultural-resources TPcr
set social-resources TPsr
set economic-resources TPer
set accomodations TPacc
set catering TPcat
set leisures TPleis
set attractions TPatt
set foods TPfoo
set landscape TPlan
set crafts TPcra
set economic-products []
set economic-products lput accomodations economic-products
set economic-products lput catering economic-products
set economic-products lput foods economic-products
set economic-products lput crafts economic-products
set max-economic-products max economic-products
set social-products []
set social-products lput accomodations social-products
set social-products lput catering social-products
set social-products lput attractions social-products
set max-social-products max social-products
if (natural-resources < landscape) [set natural-resources landscape ]
if (cultural-resources < attractions) [set cultural-resources attractions ]
if (social-resources < max social-products) [set social-resources max-social-products ]
if (economic-resources < max economic-products) [set economic-resources max-economic-products ]
set resources ((natural-resources + cultural-resources + social-resources + economic-resources) / 4)
set pcolor 59 - (resources * 8)
;set pcolor violet
]
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; setup of gatekeepers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-preferences-of-gatekeepers
locals [tt tpn tpc tps tpe]
set tt count turtles with [breed = gatekeepers]
set tpn count turtles with [breed = gatekeepers and preffor-natural-resources = 1]
set tpc count turtles with [breed = gatekeepers and preffor-cultural-resources = 1]
set tps count turtles with [breed = gatekeepers and preffor-social-resources = 1]
set tpe count turtles with [breed = gatekeepers and preffor-economic-resources = 1]
if ((tpn / tt) < (0.10 * ResourcesDensity))
[
print "gatekeepers preferences for natural resources were randomly redefined"
ask turtles with [breed = gatekeepers and preffor-natural-resources = 0 ]
[
without-interruption
[
set preffor-natural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpc / tt) < (0.10 * ResourcesDensity))
[
print "gatekeepers preferences for cultural resources were randomly redefined"
ask turtles with [breed = gatekeepers and preffor-cultural-resources = 0 ]
[
without-interruption
[
set preffor-cultural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tps / tt) < (0.10 * ResourcesDensity))
[
print "gatekeepers preferences for social resources were randomly redefined"
ask turtles with [breed = gatekeepers and preffor-social-resources = 0 ]
[
without-interruption
[
set preffor-social-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpe / tt) < (0.10 * ResourcesDensity))
[
print "gatekeepers preferences for economic resources were randomly redefined"
ask turtles with [breed = gatekeepers and preffor-economic-resources = 0 ]
[
without-interruption
[
set preffor-economic-resources precision (random-int-or-float 1.0) 1
]
]
]
ask turtles with [breed = gatekeepers]
[
without-interruption
[
set attempt 0
set gains 0
set total-gains 0
set resources-preference
((preffor-natural-resources
+ preffor-cultural-resources
+ preffor-social-resources
+ preffor-economic-resources) / 4)
set WillingnessToCirculateInformationOnPatch Xi
;search-for-afree-place-for-gatekeepers
expand-preferences-ofgatekeepers
]
]
type count turtles with [breed = gatekeepers] print " gatekeepers patched"
end
to expand-preferences-ofgatekeepers ; optimal position !
locals [TNp]
ask patches with
[
resources > 0
and
( controlled-by != []
or used-by != []
)
]
[
ifelse(
( natural-resources >= (preffor-natural-resources-of myself * ResourcesThreshold)
or cultural-resources >= (preffor-cultural-resources-of myself * ResourcesThreshold)
)
and
( social-resources >= (preffor-social-resources-of myself * ResourcesThreshold)
or economic-resources >= (preffor-economic-resources-of myself * ResourcesThreshold)
)
and
( accomodations >= (preffor-accomodations-of myself * ResourcesThreshold)
or catering >= (preffor-catering-of myself * ResourcesThreshold)
)
and
( leisures >= (preffor-leisures-of myself * ResourcesThreshold)
or attractions >= (preffor-attractions-of myself * ResourcesThreshold)
or foods >= (preffor-foods-of myself * ResourcesThreshold)
or landscape >= (preffor-landscape-of myself * ResourcesThreshold)
or crafts >= (preffor-crafts-of myself * ResourcesThreshold)
)
)
[
set promoted-by lput label-of myself promoted-by
set promoted-byw lput myself promoted-byw
set plabel "*"
;if who-of myself >= TTN [set plabel "g*"]
]
[];type label-of myself print " is not located"
]
;set TNp count patches with [member? label-of myself promoted-by]
;type TNp type " patches could be promoted by " print label;-of myself
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; setup communities
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-preferences-of-communities
locals [tt tpn tpc tps tpe]
set tt count turtles with [breed = communities]
set tpn count turtles with [breed = communities and preffor-natural-resources = 1]
set tpc count turtles with [breed = communities and preffor-cultural-resources = 1]
set tps count turtles with [breed = communities and preffor-social-resources = 1]
set tpe count turtles with [breed = communities and preffor-economic-resources = 1]
if ((tpn / tt) < (0.10 * ResourcesDensity))
[
print "communities preferences for natural resources were randomly redefined"
ask turtles with [breed = communities and preffor-natural-resources = 0 ]
[
without-interruption
[
set preffor-natural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpc / tt) < (0.10 * ResourcesDensity))
[
print "communities preferences for cultural resources were randomly redefined"
ask turtles with [breed = communities and preffor-cultural-resources = 0 ]
[
without-interruption
[
set preffor-cultural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tps / tt) < (0.10 * ResourcesDensity))
[
print "communities preferences for social resources were randomly redefined"
ask turtles with [breed = communities and preffor-social-resources = 0 ]
[
without-interruption
[
set preffor-social-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpe / tt) < (0.10 * ResourcesDensity))
[
print "communities preferences for economic resources were randomly redefined"
ask turtles with [breed = communities and preffor-economic-resources = 0 ]
[
without-interruption
[
set preffor-economic-resources precision (random-int-or-float 1.0) 1
]
]
]
ask turtles with [breed = communities]
[
without-interruption
[
;set attempt 0
set previous-energy energy
set gains 0
set total-gains 0
set resources-preference
(
(perceptionoftpreffor-natural-resources
+ perceptionoftpreffor-cultural-resources
+ perceptionoftpreffor-social-resources
+ perceptionoftpreffor-economic-resources
)
/ 4)
expand-preferences-ofcommunities
]
]
type count turtles with [breed = communities] print " communities patched"
end
to expand-preferences-ofcommunities ; optimal position !
locals [TNp]
ask patches with [resources > 0]
[
ifelse(
( natural-resources >= (perceptionoftpreffor-natural-resources-of myself * ResourcesThreshold)
and cultural-resources >= (perceptionoftpreffor-cultural-resources-of myself * ResourcesThreshold)
)
and
( social-resources >= (perceptionoftpreffor-social-resources-of myself * ResourcesThreshold)
or economic-resources >= (perceptionoftpreffor-economic-resources-of myself * ResourcesThreshold)
)
)
[
set liked-by lput label-of myself liked-by
set liked-byw lput myself liked-byw
]
[];type label-of myself print " is not located"
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; setup institutions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-preferences-of-institutions
locals [tt tpn tpc tps tpe]
set tt count turtles with [breed = institutions]
set tpn count turtles with [breed = institutions and preffor-natural-resources = 1]
set tpc count turtles with [breed = institutions and preffor-cultural-resources = 1]
set tps count turtles with [breed = institutions and preffor-social-resources = 1]
set tpe count turtles with [breed = institutions and preffor-economic-resources = 1]
if ((tpn / tt) < (0.10 * ResourcesDensity))
[
print "institutions preferences for natural resources were randomly redefined"
ask turtles with [breed = institutions and preffor-natural-resources = 0 ]
[
without-interruption
[
set preffor-natural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpc / tt) < (0.10 * ResourcesDensity))
[
print "institutions preferences for cultural resources were randomly redefined"
ask turtles with [breed = institutions and preffor-cultural-resources = 0 ]
[
without-interruption
[
set preffor-cultural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tps / tt) < (0.10 * ResourcesDensity))
[
print "institutions preferences for social resources were randomly redefined"
ask turtles with [breed = institutions and preffor-social-resources = 0 ]
[
without-interruption
[
set preffor-social-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpe / tt) < (0.10 * ResourcesDensity))
[
print "institutions preferences for economic resources were randomly redefined"
ask turtles with [breed = institutions and preffor-economic-resources = 0 ]
[
without-interruption
[
set preffor-economic-resources precision (random-int-or-float 1.0) 1
]
]
]
ask turtles with [breed = institutions]
[
without-interruption
[
;set attempt 0
set previous-energy energy
set gains 0
set total-gains 0
set resources-preference
(
(perceptionoftpreffor-natural-resources
+ perceptionoftpreffor-cultural-resources
+ perceptionoftpreffor-social-resources
+ perceptionoftpreffor-economic-resources
)
/ 4)
expand-preferences-ofinstitutions
]
]
type count turtles with [breed = institutions] print " institution patched"
end
to expand-preferences-ofinstitutions ; optimal position !
locals [TNp]
ask patches with [resources > 0]
[
ifelse(
( natural-resources >= (perceptionoftpreffor-natural-resources-of myself * ResourcesThreshold)
and cultural-resources >= (perceptionoftpreffor-cultural-resources-of myself * ResourcesThreshold)
)
and
( social-resources >= (perceptionoftpreffor-social-resources-of myself * ResourcesThreshold)
or economic-resources >= (perceptionoftpreffor-economic-resources-of myself * ResourcesThreshold)
)
)
[
set supported-by lput label-of myself supported-by
set supported-byw lput myself supported-byw
]
[];type label-of myself print " is not located"
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; setup tourists
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-preferences-of-tourists
locals [tt tpn tpc tps tpe]
set tt count turtles with [breed = tourists]
set tpn count turtles with [breed = tourists and preffor-natural-resources = 1]
set tpc count turtles with [breed = tourists and preffor-cultural-resources = 1]
set tps count turtles with [breed = tourists and preffor-social-resources = 1]
set tpe count turtles with [breed = tourists and preffor-economic-resources = 1]
if ((tpn / tt) < (0.10 * ResourcesDensity))
[
print "tourists preferences for natural resources were randomly redefined"
ask turtles with [breed = tourists and preffor-natural-resources = 0 ]
[
without-interruption
[
set preffor-natural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpc / tt) < (0.10 * ResourcesDensity))
[
print "tourists preferences for cultural resources were randomly redefined"
ask turtles with [breed = tourists and preffor-cultural-resources = 0 ]
[
without-interruption
[
set preffor-cultural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tps / tt) < (0.10 * ResourcesDensity))
[
print "tourists preferences for social resources were randomly redefined"
ask turtles with [breed = tourists and preffor-social-resources = 0 ]
[
without-interruption
[
set preffor-social-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpe / tt) < (0.10 * ResourcesDensity))
[
print "tourists preferences for economic resources were randomly redefined"
ask turtles with [breed = tourists and preffor-economic-resources = 0 ]
[
without-interruption
[
set preffor-economic-resources precision (random-int-or-float 1.0) 1
]
]
]
ask turtles with [breed = tourists]
[
without-interruption
[
set previous-energy energy
set gains 0
set total-gains 0
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (tourist-satisfaction > 2) ;33 from TQ4.3 1=Exceeded, 2=Matched, 3=Fallen below, 4=Other respons
[
;do nothing = Ti remains here, with some differences between the patch features and his preferences
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
;type "No expected match for " type label
;print-preferences-satisfaction
]
[
set attempt 0
move-to-upper-preferences
];close else
];close without
];close ask
type count turtles with [breed = tourists] print " tourists located"
set numof-unsatisfied-tourists count turtles with [breed = tourists and tourist-satisfaction > 2]
type numof-unsatisfied-tourists print " unsatisfied tourists"
end
to move-to-upper-preferences ;; turtle proceduere
ifelse (attempt < 3000)
[;1 less 3000
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse ((promoted-by-of patch-here != []) and (used-by-of patch-here != []))
[;2patch OK
ifelse
(
value-from (patch-here) [natural-resources ] >= (preffor-natural-resources * ResourcesThreshold)
And value-from (patch-here) [cultural-resources ] >= (preffor-cultural-resources * ResourcesThreshold)
And value-from (patch-here) [social-resources ] >= (preffor-social-resources * ResourcesThreshold)
And value-from (patch-here) [economic-resources ] >= (preffor-economic-resources * ResourcesThreshold)
)
[;3 matching
ifelse (substring label 0 1 = "T" )
[;this is an initial tourist
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
set tourist-satisfaction 1
;type "Upper pref of " type label
;print-preferences-satisfaction
]
[;this is a new tourist: it must respect the values of other actors involved on the patch
communities-positions-analysis
]
]
[;3 not matching
set attempt attempt + 1
move-to-upper-preferences
];3
];2
[;2 patch not OK
set attempt attempt + 1
move-to-upper-preferences
]
]
[;more 3000
ifelse (substring label 0 1 = "T" )
[;this is a current tourist
ifelse (count other-turtles-here = 0)
[; there are no other turtles here: he stays here and the patch features are replaced with his preferences
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
nonexpand-preferences
set tourist-satisfaction 2
]
[; there are other turtles here: he move to 0 0
setxy 0 0
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
set tourist-satisfaction 3
type label print " didn't found a patch that matches its preferences, but he stayed here"
]
]
[;this is a new tourist: it must die
; type label print " didn't found a patch that matched its preferences: he didn't stay on the place"
set KilledTourists (KilledTourists + 1)
die
]
];1
end
to communities-positions-analysis
locals [TNp CNp WOp U V LL aa tt]
set TNp length visited-by-of patch-here ;; number of tourists already on the patches
ifelse (TNp >= MaxTouristsDensity)
[;open if1 ;; from green tourists point of view there are too many tourists:tourist doesn't stay here
set attempt attempt + 1
move-to-upper-preferences
;show label
];clos if1
[;open else1;;from green tourists point of view there are not too many tourists
ifelse (BottomUpRegulation? = false)
[;open if 2;; staying doesn't depend on communities positions: tourist stays here
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
set tourist-satisfaction 1
set CNp length liked-by-of patch-here ;; nb of communities supporting the resources on the patch
if (CNp > 0)
[;open isolated if;;there are communities supporting the resources of the patch
set V 0
set WOp liked-byw-of patch-here ; list of who of communities
foreach WOp
[
without-interruption
[
set U Xi-of ? ; position of each community in the face of the event
set V (V + U)
if (U < 1) [ask self [set score (score + 1)]]
]
]
];close isolated if
];close if2
[;open else2;;staying depends on communities positions
set CNp length liked-by-of patch-here ;; nb of communities supporting the resources on the patch
ifelse (CNp > 0)
[;open if3;;there are communities supporting the resources of the patch
set V 0
set WOp liked-byw-of patch-here ; list of who of communities
foreach WOp
[
without-interruption
[
set U Xi-of ? ; position of each community in the face of the event
set V (V + U)
]
]
ifelse (V > 0)
[;open if4;; communities as opponant of T dev. are not majority: tourist stays here
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
set tourist-satisfaction 1
;but conflicts with opponants
foreach WOp
[
without-interruption
[
set U Xi-of ? ; position of each community in the face of the event
if (U < 1) [ask self [set score (score + 1)]]
]
]
;if (BottomUpRegulation? = true)
; [
; set aa count turtles with [breed = communities and who < TTN and Xi = 0]
; if aa > 0
; [
; set tt turtles with [breed = communities and who < TTN and Xi = 0]
; ask random-one-of tt
; [;one communities shift from 'neutral' to 'con' T development
; without-interruption [set Xi -1]
; ]
; ]
; ]
];close if4
[;open else 4;; opponants are majority:tourist doesn't stay here
set attempt attempt + 1
move-to-upper-preferences
];close else 4
];close if3
[;open else3;;there are no communities supporting the patch: tourist stays here
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
set tourist-satisfaction 1
];close else3
];close else2
];close else1
end
to setup-newtourists-preferences
locals [Wi Nts NewTs OTs RTS]
; ;remove current unsatisfied green tourists
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; set OTs count turtles with
; [
; breed = tourists
; and tourist-satisfaction > 2
; and (substring label 0 1 = "T" ); who < TTN ; only "actual" tourists
; and
; (
; preffor-natural-resources = 0
; or preffor-cultural-resources = 0
; )
; ];close with
;
; if (OTs > 0)
; [;there are unstatisfied tourists
; ifelse OTs >= NewTs
; [set RTs round ((NewTs / 4) + 1)]
; [set RTs round ((OTs / 4) + 1)]
;
; ask random-n-of RTs turtles with
; [;kill them
; breed = tourists
; and tourist-satisfaction > 2
; and (substring label 0 1 = "T" ); who < TTN ; only "actual" tourists
; and
; (
; preffor-natural-resources = 0
; or preffor-cultural-resources = 0
; )
; ];close with
; [
; ;show label
;; type label print " didn't found a patch that matched his preferences: he didn't stay on the place"
; set KilledTourists (KilledTourists + 1)
; die
; ];close ask
; ];close if
; set numof-unsatisfied-tourists (count turtles with [breed = tourists and tourist-satisfaction > 2] + KilledTourists)
; type numof-unsatisfied-tourists print " unsatisfied tourists"
;; search for green tourists among the current tourists
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
without-interruption
[
ask patches with [visited-by != []]
[
set visited-byw []
foreach visited-by
[
set Wi ?
if (substring Wi 0 1 = "n" ) [set visited-by remove Wi visited-by]
]
]
]
without-interruption
[
ask turtles with [breed = tourists and who >= TTN] [die]
]
set NewTs (NewTourists * iteration)
set NTs count turtles with
[
breed = tourists
and
(
preffor-natural-resources = 1 ; with high preference for natural resources
or preffor-cultural-resources = 1 ; with high preference for cultural resources
)
];close with
ifelse (NTs > 0)
[; there are green tourists
repeat NewTs
[
ask random-one-of turtles with
[
breed = tourists
and who < TTN
and
(
preffor-natural-resources = 1 ; with high preference for natural resources
or preffor-cultural-resources = 1 ; with high preference for cultural resources
)
];close with
[; open ask create new green tourists with other features of the current satisfied green tourists
hatch 1
[
set shape "default"
set label word "nt" who; -of myself
set preffor-natural-resources 1
set preffor-cultural-resources 1
set tourist-freq 1
];close hatch
];close ask
];close repeat
type NewTs
print " 'new' tourists come on the place with high preference for natural and cultural resources"
print " and other expectations (randomly) like the current 'green' tourists"
];close if else 1
[;there are no current green tourists
repeat NewTs
[
ask random-one-of turtles with
[
breed = tourists
and who < TTN
and tourist-satisfaction < 3
];close with
[; open ask create new green tourists with other features of the current satisfied green tourists
hatch 1
[
set shape "default"
set label word "nt" who; -of myself
set preffor-natural-resources 1
set preffor-cultural-resources 1
set preffor-social-resources precision (random-int-or-float 1.0) 1;(MeanLevelOfSocialResources * ResourcesThreshold)
set preffor-economic-resources precision (random-int-or-float 1.0) 1;(MeanLevelOfEconomicResources * ResourcesThreshold)
set tourist-freq 1
];close hatch
];close ask
];close repeat
type NewTs
print " 'new' tourists come on the place with high preference for natural and cultural resources"
print " and other expectations (randomly) like the current tourists"
];close else
type "total number of tourists = " print count turtles with [breed = tourists]
end
to print-preferences-satisfaction
type "; pnr: " type precision (value-from (patch-here) [natural-resources ]) 1 type " tnr: "type precision (preffor-natural-resources) 1
type " pcr: " type precision (value-from (patch-here) [cultural-resources ]) 1 type " tcr: " type precision (preffor-cultural-resources) 1
type " psr: " type precision (value-from (patch-here) [social-resources ]) 1 type " tsr: " type precision (preffor-social-resources) 1
type " per: " type precision (value-from (patch-here) [economic-resources ]) 1 type " ter: " print precision (preffor-economic-resources) 1
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;to simulate mimetism in collective behaviours
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to simulate-dynamicsof-positions
setup-communities-positions
setup-controllers-positions
setup-businesses-positions
setup-gatekeepers-positions
set Rcon count turtles with [(breed = controllers) and who < TTN and Xi < 0 ]; print " controllers 'con' T development"
set Rneu count turtles with [(breed = controllers) and who < TTN and Xi = 0 ]; print " controllers 'for' T maintaining"
set Rfor count turtles with [(breed = controllers) and who < TTN and Xi > 0 ]; print " controllers 'for' T development"
set Bcon count turtles with [(breed = businesses) and who < TTN and Xi < 0 ]; print " businesses 'con' T development"
set Bneu count turtles with [(breed = businesses) and who < TTN and Xi = 0 ]; print " businesses 'for' T maintaining"
set Bfor count turtles with [(breed = businesses) and who < TTN and Xi > 0 ]; print " businesses 'for' T development"
set Gcon count turtles with [(breed = gatekeepers) and who < TTN and Xi < 0 ]; print " gatekeepers 'con' T development"
set Gneu count turtles with [(breed = gatekeepers) and who < TTN and Xi = 0 ]; print " gatekeepers 'for' T maintaining"
set Gfor count turtles with [(breed = gatekeepers) and who < TTN and Xi > 0 ]; print " gatekeepers 'for' T development"
set Ccon count turtles with [(breed = communities) and who < TTN and Xi < 0 ]; print " communities 'con' T development"
set Cneu count turtles with [(breed = communities) and who < TTN and Xi = 0 ]; print " communities 'for' T maintaining"
set Cfor count turtles with [(breed = communities) and who < TTN and Xi > 0 ]; print " communities 'for' T development"
end
to setup-communities-positions
locals [aa InitMeanLevelOfTouristsDensity InitCommunitiesFor InitCommunitiesNeutral InitCommunitiesAgainst]
set InitCommunitiesAgainst count turtles with [breed = communities and who < TTN and Xi < 0]
set InitCommunitiesNeutral count turtles with [breed = communities and who < TTN and Xi = 0]
set InitCommunitiesFor count turtles with [breed = communities and who < TTN and Xi > 0]
set InitMeanLevelOfTouristsDensity MeanLevelOfTouristsDensity
set MeanLevelOfTouristsDensity (mean values-from patches with [visited-by != []] [length visited-by])
set aa round (InitCommunitiesNeutral * 0.5)
if (aa >= 5)
[;there are communities for maintaining T
ifelse ((MeanLevelOfTouristsDensity - InitMeanLevelOfTouristsDensity) / InitMeanLevelOfTouristsDensity) > 0.2
[;tourist density increased
type aa print " communities shift from 'neutral' to 'con' T dev."
ask random-one-of turtles with [breed = communities and who < TTN and Xi = 0 ]
[;one communities shift from 'neutral' to 'con' T development
without-interruption [set Xi -1]
]
]
[;tourists density decreased
type aa print " communities shift from 'neutral' to 'pro' T dev."
ask random-one-of turtles with [breed = communities and who < TTN and Xi = 0 ]
[;one communities shift from 'neutral' to 'con' T development
without-interruption [set Xi 1]
]
]
]
if (aa > 0 and aa < 5)
[;there are communities for maintaining T
ifelse ((MeanLevelOfTouristsDensity - InitMeanLevelOfTouristsDensity) / InitMeanLevelOfTouristsDensity) > 0.2
[;tourist density increased
type aa print " communities shift from 'neutral' to 'con' T dev."
ask random-one-of turtles with [breed = communities and who < TTN and Xi = 0 ]
[;one communities shift from 'neutral' to 'con' T development
without-interruption [set Xi -1]
]
]
[;tourists density decreased
type aa print " communities shift from 'neutral' to 'pro' T dev."
ask random-one-of turtles with [breed = communities and who < TTN and Xi = 0 ]
[;one communities shift from 'neutral' to 'con' T development
without-interruption [set Xi 1]
]
]
]
end
to setup-controllers-positions ; simulte influence of gains on controllers position about T dev. (Xi)
locals [aa InitcontrollersFor InitcontrollersAgainst FinalcontrollersFor FinalcontrollersAgainst]
set InitcontrollersFor count turtles with [breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 1] ;white
set InitcontrollersAgainst count turtles with [breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 0] ;black
set changed? false ;; assume that no turtle will change its colour
ask turtles with [breed = controllers and who < TTN]
[
without-interruption
[
ifelse (Gains > 0 )
[set strength ((size * Si) + ln Gains)]
[set strength (size * Si)]
]
]
ask random-n-of 5 turtles with [breed = controllers and who < TTN]
[
without-interruption
[
ControllersBeInfluenced
]
]
set FinalcontrollersFor count turtles with [breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 1] ;white
set FinalcontrollersAgainst count turtles with [breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 0] ;black
ifelse (not changed?)
[stop] ;; stop if no turtle has changed its colour
[type (FinalcontrollersFor - InitcontrollersFor) print " more/less controllers support this T development"]
end
to ControllersBeInfluenced ;; turtle procedure
;; find the impact of supporters and opposers and change my colour
;; if the opposers' impact is greater than the supporters'
locals [impactFromWhite impactFromBlack]
set impactFromWhite sum values-from turtles with
[breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 1]
[impact myself] ;white
ifelse (impactFromWhite > 0)
[set impactFromWhite mean values-from turtles with
[breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 1]
[impact myself] ;white
;type label type ":"print impactFromWhite
]
[set impactFromWhite 0
]
set impactFromBlack sum values-from turtles with
[breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 0]
[impact myself] ;black
;type label type ":"print impactFromBlack
ifelse (impactFromBlack > 0)
[
set impactFromBlack mean values-from turtles with
[breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 0]
[impact myself] ;black
;type label type ":"print impactFromBlack
]
[set impactFromBlack 0
]
ifelse (impactFromWhite > impactFromBlack) ;; if the impact from whites is greater than that
;; from blacks, change the turtle's colour to
;; white, and vice versa
[
if (PositionInFaceOfCollectiveObjective = 0) [set changed? true]
set PositionInFaceOfCollectiveObjective 1
ifelse (CollectiveObjective = "all together")
[set Xi 1 set Q5113i 999]
[set Xi 1 set Ei collective-build-in-goal]
]
[
if (PositionInFaceOfCollectiveObjective = 1) [set changed? true]
set PositionInFaceOfCollectiveObjective 0
set Xi -1
]
end
to setup-businesses-positions ; simulte influence of gains on businesses position about T dev. (Xi)
locals [InitBusinessesFor InitBusinessesAgainst FinalBusinessesFor FinalBusinessesAgainst]
set InitBusinessesFor count turtles with [breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 1] ;white
set InitBusinessesAgainst count turtles with [breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 0] ;black
set changed? false ;; assume that no turtle will change its colour
ask turtles with [breed = businesses and who < TTN]
[
without-interruption
[
ifelse (Gains > 0 )
[set strength ((size * Si) + ln Gains)]
[set strength (size * Si)]
]
]
ask random-n-of 10 turtles with [breed = businesses and who < TTN]
[
without-interruption
[
BusinessesBeInfluenced
]
]
set FinalBusinessesFor count turtles with [breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 1] ;white
set FinalBusinessesAgainst count turtles with [breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 0] ;black
ifelse (not changed?)
[stop] ;; stop if no turtle has changed its colour
[type (FinalBusinessesFor - InitBusinessesFor) print " businesses more/less support this T development" ]
end
to BusinessesBeInfluenced ;; turtle procedure
;; find the impact of supporters and opposers and change my colour
;; if the opposers' impact is greater than the supporters'
locals [impactFromWhite impactFromBlack]
set impactFromWhite sum values-from turtles with
[breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 1]
[impact myself] ;white
ifelse (impactFromWhite > 0)
[set impactFromWhite mean values-from turtles with
[breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 1]
[impact myself] ;white
;type label type ":"print impactFromWhite
]
[set impactFromWhite 0
]
set impactFromBlack sum values-from turtles with
[breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 0]
[impact myself] ;black
;type label type ":"print impactFromBlack
ifelse (impactFromBlack > 0)
[
set impactFromBlack mean values-from turtles with
[breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 0]
[impact myself] ;black
;type label type ":"print impactFromBlack
]
[set impactFromBlack 0
]
ifelse (impactFromWhite > impactFromBlack) ;; if the impact from whites is greater than that
;; from blacks, change the turtle's colour to
;; white, and vice versa
[
if (PositionInFaceOfCollectiveObjective = 0) [set changed? true]
set PositionInFaceOfCollectiveObjective 1
ifelse (CollectiveObjective = "all together")
[set Xi 1 set Q5113i 999]
[set Xi 1 set Ei collective-build-in-goal]
]
[
if (PositionInFaceOfCollectiveObjective = 1) [set changed? true]
set PositionInFaceOfCollectiveObjective 0
set Xi -1
]
end
to setup-gatekeepers-positions ; simulte influence of gains on gatekeepers position about T dev. (Xi)
locals [InitgatekeepersFor InitgatekeepersAgainst FinalgatekeepersFor FinalgatekeepersAgainst]
set InitgatekeepersFor count turtles with [breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 1] ;white
set InitgatekeepersAgainst count turtles with [breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 0] ;black
set changed? false ;; assume that no turtle will change its colour
ask turtles with [breed = gatekeepers and who < TTN]
[
without-interruption
[
ifelse (Gains > 0 )
[set strength ((size * Si) + ln Gains)]
[set strength (size * Si)]
]
]
ask random-n-of 5 turtles with [breed = gatekeepers and who < TTN]
[
without-interruption
[
gatekeepersBeInfluenced
]
]
set FinalgatekeepersFor count turtles with [breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 1] ;white
set FinalgatekeepersAgainst count turtles with [breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 0] ;black
ifelse (not changed?)
[stop] ;; stop if no turtle has changed its colour
[type (FinalgatekeepersFor - InitgatekeepersFor) print " gatekeepers more/less support this T development" ]
end
to gatekeepersBeInfluenced ;; turtle procedure
;; find the impact of supporters and opposers and change my colour
;; if the opposers' impact is greater than the supporters'
locals [impactFromWhite impactFromBlack]
set impactFromWhite sum values-from turtles with
[breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 1]
[impact myself] ;white
ifelse (impactFromWhite > 0)
[set impactFromWhite mean values-from turtles with
[breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 1]
[impact myself] ;white
;type label type ":"print impactFromWhite
]
[set impactFromWhite 0
]
set impactFromBlack sum values-from turtles with
[breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 0]
[impact myself] ;black
;type label type ":"print impactFromBlack
ifelse (impactFromBlack > 0)
[
set impactFromBlack mean values-from turtles with
[breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 0]
[impact myself] ;black
;type label type ":"print impactFromBlack
]
[set impactFromBlack 0
]
ifelse (impactFromWhite > impactFromBlack) ;; if the impact from whites is greater than that
;; from blacks, change the turtle's colour to
;; white, and vice versa
[
if (PositionInFaceOfCollectiveObjective = 0) [set changed? true]
set PositionInFaceOfCollectiveObjective 1
ifelse (CollectiveObjective = "all together")
[set Xi 1 set Q5113i 999]
[set Xi 1 set Ei collective-build-in-goal]
]
[
if (PositionInFaceOfCollectiveObjective = 1) [set changed? true]
set PositionInFaceOfCollectiveObjective 0
set Xi -1
]
end
to-report impact [otherTurtle] ;; turtle procedure
;; report the impact of otherTurtle on myself
locals [dis q]
;set dis distance otherTurtle
set dis 0
ifelse (Xi = Xi-of otherTurtle) ; objectives of i and j are similar (diagonale)
[
set dis dis + 1
]
[
if (Xi + Xi-of otherTurtle = 1) [set dis dis + 2 ] ;i or j is for maintaining and the other for increasing
if (Xi + Xi-of otherTurtle = -1)[set dis dis + 2 ] ;i or j is for maintaining and the other for decreasing
if (Xi != 0 and (Xi + Xi-of otherTurtle = 0)) [set dis dis + 5 ] ;i and j are opposite (extrema position in triangle)
if (Xi-of otherTurtle != 0 and (Xi + Xi-of otherTurtle = 0)) [set dis dis + 5 ] ;i and j are opposite (extrema position in triangle)
]
ifelse (Ei = Ei-of otherTurtle) ; preference of i and j are similar
[set dis dis + 0]
[set dis dis + 1]
if (dis = 0) [set dis 1 ] ; 1 = self-distance
;show dis
;; (exp ((ln dis) * exponent)) calculates d to the power 'exponent'
set q square (strength / (exp ((ln dis) * 2))) ; 2 = exponent
;show q
report q
end
to-report square [x]
report x * x
end
to do-bookkeeping-initial-patch-counts
store-initial-patch-counts
set-current-plot "Provisioned Resources"
do-plotting-controls
set-current-plot "Used Resources"
do-plotting-uses
set-current-plot "Promoted Resources"
do-plotting-promotions
set-current-plot "Visited Resources"
do-plotting-visits
set-current-plot "Tourists Density"
do-plotting-visitors
set-current-plot "Tourists"
do-plotting-unsatisfactions
set-current-plot "Communities"
do-plotting-conflicts
end
to store-initial-patch-counts
locals [aa ]
set numof-controlled-patcheswith-natural-resources count patches with [natural-resources > 0.5 and controlled-by != []]
set numof-controlled-patcheswith-cultural-resources count patches with [cultural-resources > 0.5 and controlled-by != []]
set numof-controlled-patcheswith-social-resources count patches with [social-resources > 0.5 and controlled-by != []]
set numof-controlled-patcheswith-economic-resources count patches with [economic-resources > 0.5 and controlled-by != []]
set numof-used-patcheswith-natural-resources count patches with [natural-resources > 0.5 and used-by != []]
set numof-used-patcheswith-cultural-resources count patches with [cultural-resources > 0.5 and used-by != []]
set numof-used-patcheswith-social-resources count patches with [social-resources > 0.5 and used-by != []]
set numof-used-patcheswith-economic-resources count patches with [economic-resources > 0.5 and used-by != []]
set numof-promoted-patcheswith-natural-resources count patches with [natural-resources > 0.5 and promoted-by != []]
set numof-promoted-patcheswith-cultural-resources count patches with [cultural-resources > 0.5 and promoted-by != []]
set numof-promoted-patcheswith-social-resources count patches with [social-resources > 0.5 and promoted-by != []]
set numof-promoted-patcheswith-economic-resources count patches with [economic-resources > 0.5 and promoted-by != []]
set numof-visited-patcheswith-natural-resources count patches with [natural-resources > 0.5 and visited-by != []]
set numof-visited-patcheswith-cultural-resources count patches with [cultural-resources > 0.5 and visited-by != []]
set numof-visited-patcheswith-social-resources count patches with [social-resources > 0.5 and visited-by != []]
set numof-visited-patcheswith-economic-resources count patches with [economic-resources > 0.5 and visited-by != []]
set numof-visitorsof-patcheswith-natural-resources
(sum values-from patches with [natural-resources > 0.5 and visited-by != []][length visited-by ]
/ (numof-visited-patcheswith-natural-resources + 1))
set numof-visitorsof-patcheswith-cultural-resources
(sum values-from patches with [cultural-resources > 0.5 and visited-by != []][length visited-by ]
/ (numof-visited-patcheswith-cultural-resources + 1))
set numof-visitorsof-patcheswith-social-resources
(sum values-from patches with [social-resources > 0.5 and visited-by != []][length visited-by ]
/ (numof-visited-patcheswith-social-resources + 1))
set numof-visitorsof-patcheswith-economic-resources
(sum values-from patches with [economic-resources > 0.5 and visited-by != []][length visited-by ]
/ (numof-visited-patcheswith-economic-resources + 1))
set Rcon count turtles with [(breed = controllers) and who < TTN and Xi < 0 ]; print " controllers 'con' T development"
set Rneu count turtles with [(breed = controllers) and who < TTN and Xi = 0 ]; print " controllers 'for' T maintaining"
set Rfor count turtles with [(breed = controllers) and who < TTN and Xi > 0 ]; print " controllers 'for' T development"
set Bcon count turtles with [(breed = businesses) and who < TTN and Xi < 0 ]; print " businesses 'con' T development"
set Bneu count turtles with [(breed = businesses) and who < TTN and Xi = 0 ]; print " businesses 'for' T maintaining"
set Bfor count turtles with [(breed = businesses) and who < TTN and Xi > 0 ]; print " businesses 'for' T development"
set Gcon count turtles with [(breed = gatekeepers) and who < TTN and Xi < 0 ]; print " gatekeepers 'con' T development"
set Gneu count turtles with [(breed = gatekeepers) and who < TTN and Xi = 0 ]; print " gatekeepers 'for' T maintaining"
set Gfor count turtles with [(breed = gatekeepers) and who < TTN and Xi > 0 ]; print " gatekeepers 'for' T development"
set Ccon count turtles with [(breed = communities) and who < TTN and Xi < 0 ]; print " communities 'con' T development"
set Cneu count turtles with [(breed = communities) and who < TTN and Xi = 0 ]; print " communities 'for' T maintaining"
set Cfor count turtles with [(breed = communities) and who < TTN and Xi > 0 ]; print " communities 'for' T development"
set numof-unsatisfied-tourists (count turtles with [breed = tourists and tourist-satisfaction > 2] + KilledTourists)
;set numof-unsatisfied-communities HostCommunitiesConflicts
set aa count turtles with [breed = tourists and who >= TTN and score > 0]
ifelse (aa > 0) [
set avenumof-unsatisfied-communities precision (mean values-from turtles with [breed = tourists and who >= TTN][score]) 2
;set minnumof-unsatisfied-communities precision (min values-from turtles with [breed = tourists and who >= TTN][score]) 2
;set maxnumof-unsatisfied-communities precision (max values-from turtles with [breed = tourists and who >= TTN][score]) 2
]
[
set avenumof-unsatisfied-communities 0
;set minnumof-unsatisfied-communities 0
;set maxnumof-unsatisfied-communities 0
]
end
to print-initial-situation
locals [ nn kk ss ee rr bb pp vv tp]
; set tp count patches
; set nn count patches with [natural-resources > 0.5]
; set kk count patches with [cultural-resources > 0.5]
; set ss count patches with [social-resources > 0.5]
; set ee count patches with [economic-resources > 0.5]
; set rr count patches with [controlled-by != []]
; set bb count patches with [used-by != []]
; set pp count patches with [promoted-by != []]
; set vv count patches with [visited-by != []]
set MeanLevelOfResources (mean values-from patches with [plabel != "§"] [resources])
set MeanLevelOfNaturalResources (mean values-from patches with [plabel != "§"] [natural-resources])
set MeanLevelOfCulturalResources (mean values-from patches with [plabel != "§"] [cultural-resources])
set MeanLevelOfSocialResources (mean values-from patches with [plabel != "§"] [social-resources])
set MeanLevelOfEconomicResources (mean values-from patches with [plabel != "§"] [economic-resources])
set MeanLevelOfResources (mean values-from patches with [plabel != "§"] [resources])
set MeanLevelOfNaturalResources (mean values-from patches with [plabel != "§"] [natural-resources])
set MeanLevelOfCulturalResources (mean values-from patches with [plabel != "§"] [cultural-resources])
set MeanLevelOfSocialResources (mean values-from patches with [plabel != "§"] [social-resources])
set MeanLevelOfEconomicResources (mean values-from patches with [plabel != "§"] [economic-resources])
set MeanLevelOfTouristsDensity (mean values-from patches with [visited-by != []] [length visited-by])
set MaxTouristsDensity (MeanLevelOfTouristsDensity * TouristsDensityEvolution)
set MeanLevelOfTPrefforNaturalResources (mean values-from turtles with [breed = tourists] [preffor-natural-resources])
set MeanLevelOfTPrefforCulturalResources (mean values-from turtles with [breed = tourists] [preffor-cultural-resources])
set MeanLevelOfTPrefforSocialResources (mean values-from turtles with [breed = tourists] [preffor-social-resources])
set MeanLevelOfTPrefforEconomicResources (mean values-from turtles with [breed = tourists] [preffor-economic-resources])
set MeanLevelOfRBGPrefforNaturalResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [preffor-natural-resources])
set MeanLevelOfRBGPrefforCulturalResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [preffor-cultural-resources])
set MeanLevelOfRBGPrefforSocialResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [preffor-social-resources])
set MeanLevelOfRBGPrefforEconomicResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [preffor-economic-resources])
set MeanLevelOfRBGPerceptOfPrefforNaturalResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [perceptionoftpreffor-natural-resources])
set MeanLevelOfRBGPerceptOfPrefforCulturalResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [perceptionoftpreffor-cultural-resources])
set MeanLevelOfRBGPerceptOfPrefforSocialResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [perceptionoftpreffor-social-resources])
set MeanLevelOfRBGPerceptOfPrefforEconomicResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [perceptionoftpreffor-economic-resources])
print "Current situation"
type count turtles with [breed = controllers and who < TTN] print " controllers"
type count turtles with [breed = businesses and who < TTN] print " businesses"
type count turtles with [breed = gatekeepers and who < TTN] print " gatkeepers"
type count turtles with [breed = communities and who < TTN] print " communities"
type count turtles with [breed = institutions and who < TTN] print " institutions"
type count turtles with [breed = tourists and who < TTN] print " tourists"
set Rcon count turtles with [(breed = controllers) and who < TTN and Xi < 0 ]; print " controllers 'con' T development"
set Rneu count turtles with [(breed = controllers) and who < TTN and Xi = 0 ]; print " controllers 'for' T maintaining"
set Rfor count turtles with [(breed = controllers) and who < TTN and Xi > 0 ]; print " controllers 'for' T development"
set Bcon count turtles with [(breed = businesses) and who < TTN and Xi < 0 ]; print " businesses 'con' T development"
set Bneu count turtles with [(breed = businesses) and who < TTN and Xi = 0 ]; print " businesses 'for' T maintaining"
set Bfor count turtles with [(breed = businesses) and who < TTN and Xi > 0 ]; print " businesses 'for' T development"
set Gcon count turtles with [(breed = gatekeepers) and who < TTN and Xi < 0 ]; print " gatekeepers 'con' T development"
set Gneu count turtles with [(breed = gatekeepers) and who < TTN and Xi = 0 ]; print " gatekeepers 'for' T maintaining"
set Gfor count turtles with [(breed = gatekeepers) and who < TTN and Xi > 0 ]; print " gatekeepers 'for' T development"
set Ccon count turtles with [(breed = communities) and who < TTN and Xi < 0 ]; print " communities 'con' T development"
set Cneu count turtles with [(breed = communities) and who < TTN and Xi = 0 ]; print " communities 'for' T maintaining"
set Cfor count turtles with [(breed = communities) and who < TTN and Xi > 0 ]; print " communities 'for' T development"
type Rcon print " controllers 'con' T development"
type Rneu print " controllers 'for' T maintaining"
type Rfor print " controllers 'for' T development"
type Bcon print " businesses 'con' T development"
type Bneu print " businesses 'for' T maintaining"
type Bfor print " businesses 'for' T development"
type Gcon print " gatekeepers 'con' T development"
type Gneu print " gatekeepers 'for' T maintaining"
type Gfor print " gatekeepers 'for' T development"
type Ccon print " communities 'con' T development"
type Cneu print " communities 'for' T maintaining"
type Cfor print " communities 'for' T development"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 0] print " RBG supporters of T dev. via more provision"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 2] print " RBG supporters of T dev. via more control"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 4] print " RBG supporters of T dev. via new regulation"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 6] print " RBG supporters of T dev. via more appl.of cur.reg."
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 8] print " RBG supporters of T dev. via more supply"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 10] print " RBG supporters of T dev. via more promotion"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 12] print " RBG supporters of T dev. via more cooperation"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and (member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5)] print " RBG supporters of T dev. as cooperators"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and (preffor-natural-resources = 1 or preffor-natural-resources = 1)] print " RBG supporters of T dev. focusing on na. or cult. res."
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and (perceptionofTpreffor-natural-resources = 1 or perceptionofTpreffor-natural-resources = 1)] print " RBG supp.of T dev.believing pos.impact of nat. or cult.res."
type "MeanLevelOfTouristsDensity " print precision MeanLevelOfTouristsDensity 2
;type "MaxTouristsDensity " print precision MaxTouristsDensity 2
type "MeanLevelOfResources " print precision MeanLevelOfResources 2
type "MeanLevelOfNaturalResources " print precision MeanLevelOfNaturalResources 2
type "MeanLevelOfCulturalResources " print precision MeanLevelOfCulturalResources 2
type "MeanLevelOfSocialResources " print precision MeanLevelOfSocialResources 2
type "MeanLevelOfEconomicResources " print precision MeanLevelOfEconomicResources 2
type "MeanLevelOfTPrefforNaturalResources " print precision MeanLevelOfTPrefforNaturalResources 2
type "MeanLevelOfTPrefforCulturalResources " print precision MeanLevelOfTPrefforCulturalResources 2
type "MeanLevelOfTPrefforSocialResources " print precision MeanLevelOfTPrefforSocialResources 2
type "MeanLevelOfTPrefforEconomicResources " print precision MeanLevelOfTPrefforEconomicResources 2
type "MeanLevelOfRBGPrefforNaturalResources " print precision MeanLevelOfRBGPrefforNaturalResources 2
type "MeanLevelOfRBGPrefforCulturalResources " print precision MeanLevelOfRBGPrefforCulturalResources 2
type "MeanLevelOfRBGPrefforSocialResources " print precision MeanLevelOfRBGPrefforSocialResources 2
type "MeanLevelOfRBGPrefforEconomicResources " print precision MeanLevelOfRBGPrefforEconomicResources 2
type "MeanLevelOfRBGPerceptOfPrefforNaturalResources " print precision MeanLevelOfRBGPerceptOfPrefforNaturalResources 2
type "MeanLevelOfRBGPerceptOfPrefforCulturalResources " print precision MeanLevelOfRBGPerceptOfPrefforCulturalResources 2
type "MeanLevelOfRBGPerceptOfPrefforSocialResources " print precision MeanLevelOfRBGPerceptOfPrefforSocialResources 2
type "MeanLevelOfRBGPerceptOfPrefforEconomicResources " print precision MeanLevelOfRBGPerceptOfPrefforEconomicResources 2
end
to print-initial-patch-counts2
locals [aa]
set numof-controlled-patches count patches with [controlled-by != []]
set numof-used-patches count patches with [used-by != []]
set numof-promoted-patches count patches with [promoted-by != []]
set numof-visited-patches count patches with [visited-by != []]
set numof-unsatisfied-tourists (count turtles with [breed = tourists and tourist-satisfaction > 2] + KilledTourists)
;set numof-unsatisfied-communities HostCommunitiesConflicts
set aa count turtles with [breed = tourists and who >= TTN and score > 0]
ifelse (aa > 0) [
set avenumof-unsatisfied-communities round (mean values-from turtles with [breed = tourists and who >= TTN][score])
;set minnumof-unsatisfied-communities round (min values-from turtles with [breed = tourists and who >= TTN][score])
;set maxnumof-unsatisfied-communities round (max values-from turtles with [breed = tourists and who >= TTN][score])
]
[
set avenumof-unsatisfied-communities 0
;set minnumof-unsatisfied-communities 0
;set maxnumof-unsatisfied-communities 0
]
type "numof-controlled-patches: " print numof-controlled-patches
type "numof-used-patches: " print numof-used-patches
type "numof-promoted-patches: " print numof-promoted-patches
type "numof-visited-patches: " print numof-visited-patches
type "numof-unsatisfied-tourists: " print numof-unsatisfied-tourists
type "meannumof-conflicts-with-communities /new tourist: " print avenumof-unsatisfied-communities
end
to print-initial-patch-counts1
type "numof-controlled-patcheswith-natural-resources: " print numof-controlled-patcheswith-natural-resources
type "numof-controlled-patcheswith-cultural-resources: " print numof-controlled-patcheswith-cultural-resources
type "numof-controlled-patcheswith-social-resources: " print numof-controlled-patcheswith-social-resources
type "numof-controlled-patcheswith-economic-resources: " print numof-controlled-patcheswith-economic-resources
type "numof-used-patcheswith-natural-resources: " print numof-used-patcheswith-natural-resources
type "numof-used-patcheswith-cultural-resources: " print numof-used-patcheswith-cultural-resources
type "numof-used-patcheswith-social-resources: " print numof-used-patcheswith-social-resources
type "numof-used-patcheswith-economic-resources: " print numof-used-patcheswith-economic-resources
type "numof-promoted-patcheswith-natural-resources: " print numof-promoted-patcheswith-natural-resources
type "numof-promoted-patcheswith-cultural-resources: " print numof-promoted-patcheswith-cultural-resources
type "numof-promoted-patcheswith-social-resources: " print numof-promoted-patcheswith-social-resources
type "numof-promoted-patcheswith-economic-resources: " print numof-promoted-patcheswith-economic-resources
type "numof-visited-patcheswith-natural-resources: " print numof-visited-patcheswith-natural-resources
type "numof-visited-patcheswith-cultural-resources: " print numof-visited-patcheswith-cultural-resources
type "numof-visited-patcheswith-social-resources: " print numof-visited-patcheswith-social-resources
type "numof-visited-patcheswith-economic-resources: " print numof-visited-patcheswith-economic-resources
type "numof-visitorsof-patcheswith-natural-resources: " print precision numof-visitorsof-patcheswith-natural-resources 4
type "numof-visitorsof-patcheswith-cultural-resources: " print precision numof-visitorsof-patcheswith-cultural-resources 4
type "numof-visitorsof-patcheswith-social-resources: " print precision numof-visitorsof-patcheswith-social-resources 4
type "numof-visitorsof-patcheswith-economic-resources: " print precision numof-visitorsof-patcheswith-economic-resources 4
end
to do-plotting-behaviours-reg
set-current-plot "Controllers Behaviours"
set-current-plot-pen "defect"
plot Rcon
set-current-plot-pen "cooperate"
plot Rfor
set-current-plot-pen "tit-for-tat"
plot Rneu
set-current-plot "Businesses Behaviours"
set-current-plot-pen "defect"
plot Bcon
set-current-plot-pen "cooperate"
plot Bfor
set-current-plot-pen "tit-for-tat"
plot Bneu
set-current-plot "Gatekeepers Behaviours"
set-current-plot-pen "defect"
plot Gcon
set-current-plot-pen "cooperate"
plot Gfor
set-current-plot-pen "tit-for-tat"
plot Gneu
set-current-plot "Communities"
set-current-plot-pen "Ccon"
plot Ccon
set-current-plot-pen "Cfor"
plot Cfor
set-current-plot-pen "Cneu"
plot Cneu
end
to do-plotting-controls
set-current-plot-pen "Natural"
plot numof-controlled-patcheswith-natural-resources
set-current-plot-pen "Cultural"
plot numof-controlled-patcheswith-cultural-resources
set-current-plot-pen "Social"
plot numof-controlled-patcheswith-social-resources
set-current-plot-pen "Economic"
plot numof-controlled-patcheswith-economic-resources
end
to do-plotting-uses
set-current-plot-pen "Natural"
plot numof-used-patcheswith-natural-resources
set-current-plot-pen "Cultural"
plot numof-used-patcheswith-cultural-resources
set-current-plot-pen "Social"
plot numof-used-patcheswith-social-resources
set-current-plot-pen "Economic"
plot numof-used-patcheswith-economic-resources
end
to do-plotting-promotions
set-current-plot-pen "Natural"
plot numof-promoted-patcheswith-natural-resources
set-current-plot-pen "Cultural"
plot numof-promoted-patcheswith-cultural-resources
set-current-plot-pen "Social"
plot numof-promoted-patcheswith-social-resources
set-current-plot-pen "Economic"
plot numof-promoted-patcheswith-economic-resources
end
to do-plotting-visits
set-current-plot-pen "Natural"
plot numof-visited-patcheswith-natural-resources
set-current-plot-pen "Cultural"
plot numof-visited-patcheswith-cultural-resources
set-current-plot-pen "Social"
plot numof-visited-patcheswith-social-resources
set-current-plot-pen "Economic"
plot numof-visited-patcheswith-economic-resources
end
to do-plotting-visitors
set-current-plot-pen "Natural"
plot numof-visitorsof-patcheswith-natural-resources
set-current-plot-pen "Cultural"
plot numof-visitorsof-patcheswith-cultural-resources
set-current-plot-pen "Social"
plot numof-visitorsof-patcheswith-social-resources
set-current-plot-pen "Economic"
plot numof-visitorsof-patcheswith-economic-resources
end
to do-plotting-conflicts-and-cooperations-RBGC
set-current-plot "Controllers Interactions"
set-current-plot-pen "conflict-R"
plot ((sum values-from turtles with [breed = controllers][conflict-with-R]) / count turtles with [breed = controllers and who < TTN])
set-current-plot-pen "conflict-B"
plot ((sum values-from turtles with [breed = controllers][conflict-with-B]) / count turtles with [breed = controllers and who < TTN])
set-current-plot-pen "conflict-G"
plot ((sum values-from turtles with [breed = controllers][conflict-with-G]) / count turtles with [breed = controllers and who < TTN])
set-current-plot-pen "cooperate-R"
plot ((sum values-from turtles with [breed = controllers][cooperation-with-R]) / count turtles with [breed = controllers and who < TTN])
set-current-plot-pen "cooperate-B"
plot ((sum values-from turtles with [breed = controllers][cooperation-with-B]) / count turtles with [breed = controllers and who < TTN])
set-current-plot-pen "cooperate-G"
plot ((sum values-from turtles with [breed = controllers][cooperation-with-G]) / count turtles with [breed = controllers and who < TTN])
set-current-plot "Businesses Interactions"
set-current-plot-pen "conflict-B"
plot ((sum values-from turtles with [breed = businesses][conflict-with-B]) / count turtles with [breed = businesses and who < TTN])
set-current-plot-pen "conflict-R"
plot ((sum values-from turtles with [breed = businesses][conflict-with-R]) / count turtles with [breed = businesses and who < TTN])
set-current-plot-pen "conflict-G"
plot ((sum values-from turtles with [breed = businesses][conflict-with-G]) / count turtles with [breed = businesses and who < TTN])
set-current-plot-pen "cooperate-B"
plot ((sum values-from turtles with [breed = businesses][cooperation-with-B]) / count turtles with [breed = businesses and who < TTN])
set-current-plot-pen "cooperate-R"
plot ((sum values-from turtles with [breed = businesses][cooperation-with-R]) / count turtles with [breed = businesses and who < TTN])
set-current-plot-pen "cooperate-G"
plot ((sum values-from turtles with [breed = businesses][cooperation-with-G]) / count turtles with [breed = businesses and who < TTN])
set-current-plot "Gatekeepers Interactions"
set-current-plot-pen "conflict-B"
plot ((sum values-from turtles with [breed = gatekeepers][conflict-with-B]) / count turtles with [breed = gatekeepers and who < TTN])
set-current-plot-pen "conflict-R"
plot ((sum values-from turtles with [breed = gatekeepers][conflict-with-R]) / count turtles with [breed = gatekeepers and who < TTN])
set-current-plot-pen "conflict-G"
plot ((sum values-from turtles with [breed = gatekeepers][conflict-with-G]) / count turtles with [breed = gatekeepers and who < TTN])
set-current-plot-pen "cooperate-B"
plot ((sum values-from turtles with [breed = gatekeepers][cooperation-with-B]) / count turtles with [breed = gatekeepers and who < TTN])
set-current-plot-pen "cooperate-R"
plot ((sum values-from turtles with [breed = gatekeepers][cooperation-with-R]) / count turtles with [breed = gatekeepers and who < TTN])
set-current-plot-pen "cooperate-G"
plot ((sum values-from turtles with [breed = gatekeepers][cooperation-with-G]) / count turtles with [breed = gatekeepers and who < TTN])
end
to do-plotting-conflicts-and-cooperations-RBG
set-current-plot "Controllers Interactions"
set-current-plot-pen "conflict-R"
plot sum values-from turtles with [breed = controllers][conflict-with-R]; / count turtles with [breed = controllers and who < TTN]
set-current-plot-pen "conflict-B"
plot sum values-from turtles with [breed = controllers][conflict-with-B]; / count turtles with [breed = controllers and who < TTN]
set-current-plot-pen "conflict-G"
plot sum values-from turtles with [breed = controllers][conflict-with-G]; / count turtles with [breed = controllers and who < TTN]
set-current-plot-pen "cooperate-R"
plot sum values-from turtles with [breed = controllers][cooperation-with-R]
set-current-plot-pen "cooperate-B"
plot sum values-from turtles with [breed = controllers][cooperation-with-B]
set-current-plot-pen "cooperate-G"
plot sum values-from turtles with [breed = controllers][cooperation-with-G]
if (iteration = Iterations)
[
type "conflict-RR: " print sum values-from turtles with [breed = controllers][conflict-with-R]
type "conflict-RB: " print sum values-from turtles with [breed = controllers][conflict-with-B]
type "conflict-RG: " print sum values-from turtles with [breed = controllers][conflict-with-G]
type "cooperate-RR: " print sum values-from turtles with [breed = controllers][cooperation-with-R]
type "cooperate-RB: " print sum values-from turtles with [breed = controllers][cooperation-with-B]
type "cooperate-RG: " print sum values-from turtles with [breed = controllers][cooperation-with-G]
]
set-current-plot "Businesses Interactions"
set-current-plot-pen "conflict-B"
plot sum values-from turtles with [breed = businesses][conflict-with-B]; / count turtles with [breed = businesses and who < TTN]
set-current-plot-pen "conflict-R"
plot sum values-from turtles with [breed = businesses][conflict-with-R]; / count turtles with [breed = businesses and who < TTN]
set-current-plot-pen "conflict-G"
plot sum values-from turtles with [breed = businesses][conflict-with-G]; / count turtles with [breed = businesses and who < TTN]
set-current-plot-pen "cooperate-B"
plot sum values-from turtles with [breed = businesses][cooperation-with-B]
set-current-plot-pen "cooperate-R"
plot sum values-from turtles with [breed = businesses][cooperation-with-R]
set-current-plot-pen "cooperate-G"
plot sum values-from turtles with [breed = businesses][cooperation-with-G]
if (iteration = Iterations)
[
type "conflict-BR: " print sum values-from turtles with [breed = businesses][conflict-with-R]
type "conflict-BB: " print sum values-from turtles with [breed = businesses][conflict-with-B]
type "conflict-BG: " print sum values-from turtles with [breed = businesses][conflict-with-G]
type "cooperate-BR: " print sum values-from turtles with [breed = businesses][cooperation-with-R]
type "cooperate-BB: " print sum values-from turtles with [breed = businesses][cooperation-with-B]
type "cooperate-BG: " print sum values-from turtles with [breed = businesses][cooperation-with-G]
]
set-current-plot "Gatekeepers Interactions"
set-current-plot-pen "conflict-B"
plot sum values-from turtles with [breed = gatekeepers][conflict-with-B]; / count turtles with [breed = gatekeepers and who < TTN]
set-current-plot-pen "conflict-R"
plot sum values-from turtles with [breed = gatekeepers][conflict-with-R]; / count turtles with [breed = gatekeepers and who < TTN]
set-current-plot-pen "conflict-G"
plot sum values-from turtles with [breed = gatekeepers][conflict-with-G]; / count turtles with [breed = gatekeepers and who < TTN]
set-current-plot-pen "cooperate-B"
plot sum values-from turtles with [breed = gatekeepers][cooperation-with-B]
set-current-plot-pen "cooperate-R"
plot sum values-from turtles with [breed = gatekeepers][cooperation-with-R]
set-current-plot-pen "cooperate-G"
plot sum values-from turtles with [breed = gatekeepers][cooperation-with-G]
if (iteration = Iterations)
[
type "conflict-GR: " print sum values-from turtles with [breed = gatekeepers][conflict-with-R]
type "conflict-GB: " print sum values-from turtles with [breed = gatekeepers][conflict-with-B]
type "conflict-GG: " print sum values-from turtles with [breed = gatekeepers][conflict-with-G]
type "cooperate-GR: " print sum values-from turtles with [breed = gatekeepers][cooperation-with-R]
type "cooperate-GB: " print sum values-from turtles with [breed = gatekeepers][cooperation-with-B]
type "cooperate-GG: " print sum values-from turtles with [breed = gatekeepers][cooperation-with-G]
]
end
to do-plotting-unsatisfactions
set-current-plot "Tourists"
set-current-plot-pen "Unsatisf"
plot numof-unsatisfied-tourists
end
to do-plotting-conflicts
set-current-plot "Communities"
set-current-plot-pen "Conflict"
plot avenumof-unsatisfied-communities
;set-current-plot-pen "MinConf"
;plot minnumof-unsatisfied-communities
;set-current-plot-pen "MaxConf"
;plot maxnumof-unsatisfied-communities
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; base scenario: possible conflicts about Xi Ei and role of resources
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-base-scenario
without-interruption
[
setup-controllers-energy
setup-businesses-energy
setup-gatekeepers-energy
update-lorenz-and-gini-plots
controllers-views-and-others
businesses-views-and-others
gatekeepers-views-and-others
communities-views-and-others
institutions-views-and-others
; print "Possible future conflicts generated by the actors expectations (ref Q2)"
count-conflictsXi-amongRBGCI
; print-conflictsXi-amongRBGCI
; print "Possible future conflicts generated by the actors strategies -- preferred actions (ref Q4)"
count-conflictsEi-amongRBGCI
; print-conflictsEi-amongRBGCI
; print "Possible future conflicts generated by the actors perceptions of natural resources"
count-conflictsVn-amongRBGCI
; print-conflictsVn-amongRBGCI
; print "Possible future conflicts generated by the actors perceptions of cultural resources"
count-conflictsVc-amongRBGCI
; print-conflictsVc-amongRBGCI
]
end
to setup-controllers-energy
locals [NT]
ask turtles with [breed = controllers and who < TTN]
[
without-interruption
[
set previous-energy energy
set NT sum values-from patches with [(visited-by != []) and (controlled-by != []) and (member? label-of myself controlled-by)][length visited-by]
ifelse (NT > 0)
[set energy (size + NT)]
[set energy size]
ifelse (iteration > 0)
[set gains (energy - previous-energy) set total-gains (total-gains + gains)]
[set gains (energy - size) set total-gains gains]
]
];end ask turtles
end
to setup-businesses-energy
locals [NT]
ask turtles with [breed = businesses and who < TTN]
[
without-interruption
[
set previous-energy energy
set NT sum values-from patches with [(visited-by != []) and (used-by != []) and (member? label-of myself used-by)][length visited-by]
ifelse (NT > 0)
[set energy (size + NT)]
[set energy size]
ifelse (iteration > 0)
[set gains (energy - previous-energy) set total-gains (total-gains + gains)]
[set gains (energy - size) set total-gains gains]
]
];end ask turtles
end
to setup-gatekeepers-energy
locals [NT]
ask turtles with [breed = gatekeepers and who < TTN]
[
without-interruption
[
set previous-energy energy
set NT sum values-from patches with [(visited-by != []) and (promoted-by != []) and (member? label-of myself promoted-by)][length visited-by]
ifelse (NT > 0)
[set energy (size + NT)]
[set energy size]
ifelse (iteration > 0)
[set gains (energy - previous-energy) set total-gains (total-gains + gains)]
[set gains (energy - size) set total-gains gains]
]
];end ask turtles
end
to update-lorenz-and-gini-plots
locals [WTPNG LTPNG ETPNG WTPNR LTPNR ETPNR WTPNB LTPNB ETPNB En total-wealth sorted-wealths wealth-sum-so-far index gini-index-reserve ]
; WTPN; list of lwho of turtles of production arena
; ETPN; list of energy of ...
; TPN ; number of turtles of ... (excluding phantoms)
set-current-plot "Scale (Lorenz Curve)"
clear-plot
;; draw a straight line from lower left to upper right
;set-current-plot-pen "equal"
;plot 100
;plot 0
;;;;;;;;;;;;;;;;;;;;;;
;gatekeepers
;;;;;;;;;;;;;;;;;;;;;;
set WTPNG values-from turtles with [breed = gatekeepers and who < TTN][who]
set TPNGat count turtles with [breed = gatekeepers and who < TTN]
set ETPNG []
without-interruption
[
foreach WTPNG; LTPN
[
;set En sum values-from turtles with [label = ?][energy]
set En energy-of turtle(?)
set ETPNG lput En ETPNG
];end foreach
];end without
set-current-plot "Scale (Lorenz Curve)"
set-current-plot-pen "gatekeepers"
set-plot-pen-interval (100 / TPNGat); num-people
plot 0
set sorted-wealths sort ETPNG
set total-wealth sum sorted-wealths
set wealth-sum-so-far 0
set index 0
set gini-index-reserve 0
;; now actually plot the Lorenz curve -- along the way, we also
;; calculate the Gini index
repeat TPNGat
[
without-interruption
[
set wealth-sum-so-far (wealth-sum-so-far + item index sorted-wealths)
plot (wealth-sum-so-far / total-wealth) * 100
set index (index + 1)
set gini-index-reserve
gini-index-reserve +
(index / TPNGat ) -
(wealth-sum-so-far / total-wealth)
]
]
;; plot Gini Index
set-current-plot "Scale (Gini Index)"
set-current-plot-pen "gatekeepers"
plot (gini-index-reserve / TPNGat) / area-of-equality-triangleG
set GiniIndex (gini-index-reserve / TPNGat) / area-of-equality-triangleG
if (iteration = 0 or iteration = Iteration) [type "gatekeepers's Gini Index: " print precision GiniIndex 2]
;;;;;;;;;;;;;;;;;;;;;;
;controllers
;;;;;;;;;;;;;;;;;;;;;;
set WTPNR values-from turtles with [breed = controllers and who < TTN][who]
set TPNRes count turtles with [breed = controllers and who < TTN]
set ETPNR []
without-interruption
[
foreach WTPNR; LTPN
[
;set En sum values-from turtles with [label = ?][energy]
set En energy-of turtle(?)
set ETPNR lput En ETPNR
];end foreach
];end without
set-current-plot "Scale (Lorenz Curve)"
set-current-plot-pen "controllers"
set-plot-pen-interval (100 / TPNRes); num-people
plot 0
set sorted-wealths sort ETPNR
set total-wealth sum sorted-wealths
set wealth-sum-so-far 0
set index 0
set gini-index-reserve 0
;; now actually plot the Lorenz curve -- along the way, we also
;; calculate the Gini index
repeat TPNRes
[
without-interruption
[
set wealth-sum-so-far (wealth-sum-so-far + item index sorted-wealths)
plot (wealth-sum-so-far / total-wealth) * 100
set index (index + 1)
set gini-index-reserve
gini-index-reserve +
(index / TPNRes ) -
(wealth-sum-so-far / total-wealth)
]
]
;; plot Gini Index
set-current-plot "Scale (Gini Index)"
set-current-plot-pen "controllers"
plot (gini-index-reserve / TPNRes) / area-of-equality-triangleR
set GiniIndex (gini-index-reserve / TPNRes) / area-of-equality-triangleR
if (iteration = 0 or iteration = Iteration) [type "controllers's Gini Index: " print precision GiniIndex 2]
;;;;;;;;;;;;;;;;;;;;;;
;businesses
;;;;;;;;;;;;;;;;;;;;;;
set WTPNB values-from turtles with [breed = businesses and who < TTN][who]
set TPNBus count turtles with [breed = businesses and who < TTN]
set ETPNB []
without-interruption
[
foreach WTPNB; LTPN
[
;set En sum values-from turtles with [label = ?][energy]
set En energy-of turtle(?)
set ETPNB lput En ETPNB
];end foreach
];end without
set-current-plot "Scale (Lorenz Curve)"
set-current-plot-pen "businesses"
set-plot-pen-interval (100 / TPNBus); num-people
plot 0
set sorted-wealths sort ETPNB
set total-wealth sum sorted-wealths
set wealth-sum-so-far 0
set index 0
set gini-index-reserve 0
;; now actually plot the Lorenz curve -- along the way, we also
;; calculate the Gini index
repeat TPNBus
[
without-interruption
[
set wealth-sum-so-far (wealth-sum-so-far + item index sorted-wealths)
plot (wealth-sum-so-far / total-wealth) * 100
set index (index + 1)
set gini-index-reserve
gini-index-reserve +
(index / TPNBus ) -
(wealth-sum-so-far / total-wealth)
]
]
;; plot Gini Index
set-current-plot "Scale (Gini Index)"
set-current-plot-pen "businesses"
plot (gini-index-reserve / TPNBus) / area-of-equality-triangleB
set GiniIndex (gini-index-reserve / TPNBus) / area-of-equality-triangleG
if (iteration = 0 or iteration = Iteration) [type "businesses's Gini Index: " print precision GiniIndex 2]
end
to-report area-of-equality-triangleG
;; not really necessary to compute this when num-people is large;
;; if num-people is large, could just use estimate of 0.5
report (TPNGat * (TPNGat - 1) / 2) / (TPNGat ^ 2)
end
to-report area-of-equality-triangleR
;; not really necessary to compute this when num-people is large;
;; if num-people is large, could just use estimate of 0.5
report (TPNRes * (TPNRes - 1) / 2) / (TPNRes ^ 2)
end
to-report area-of-equality-triangleB
;; not really necessary to compute this when num-people is large;
;; if num-people is large, could just use estimate of 0.5
report (TPNBus * (TPNBus - 1) / 2) / (TPNBus ^ 2)
end
to controllers-views-and-others
ask turtles with [breed = controllers]
[;open ask1
without-interruption
[;open without
set px Xi
count-conflicts-for-Xi
set px Ei
count-conflicts-for-Ei
set px perceptionOftpreffor-natural-resources
count-conflicts-for-Vn
set px perceptionOftpreffor-cultural-resources
count-conflicts-for-Vc
];close without
];close ask 1
end
to businesses-views-and-others
ask turtles with [breed = businesses]
[;open ask1
without-interruption
[;open without
set px Xi
count-conflicts-for-Xi
set px Ei
count-conflicts-for-Ei
set px perceptionOftpreffor-natural-resources
count-conflicts-for-Vn
set px perceptionOftpreffor-cultural-resources
count-conflicts-for-Vc
];close without
];close ask 1
end
to gatekeepers-views-and-others
ask turtles with [breed = gatekeepers]
[;open ask1
without-interruption
[;open without
set px Xi
count-conflicts-for-Xi
set px Ei
count-conflicts-for-Ei
set px perceptionOftpreffor-natural-resources
count-conflicts-for-Vn
set px perceptionOftpreffor-cultural-resources
count-conflicts-for-Vc
];close without
];close ask 1
end
to communities-views-and-others
ask turtles with [breed = communities]
[;open ask1
without-interruption
[;open without
set px Xi
count-conflicts-for-Xi
set px Ei
count-conflicts-for-Ei
set px perceptionOftpreffor-natural-resources
count-conflicts-for-Vn
set px perceptionOftpreffor-cultural-resources
count-conflicts-for-Vc
];close without
];close ask 1
end
to institutions-views-and-others
ask turtles with [breed = institutions]
[;open ask1
without-interruption
[;open without
set px Xi
count-conflicts-for-Xi
set px Ei
count-conflicts-for-Ei
set px perceptionOftpreffor-natural-resources
count-conflicts-for-Vn
set px perceptionOftpreffor-cultural-resources
count-conflicts-for-Vc
];close without
];close ask 1
end
to count-conflicts-for-Xi
set xpartners turtles with [breed = controllers and self != myself and Xi != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictXi-with-R xTp
];close if
set xpartners turtles with [breed = businesses and self != myself and Xi != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictXi-with-B xTp
];close if
set xpartners turtles with [breed = communities and self != myself and Xi != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictXi-with-C xTp
];close if
set xpartners turtles with [breed = gatekeepers and self != myself and Xi != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictXi-with-G xTp
];close if
set xpartners turtles with [breed = institutions and self != myself and Xi != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictXi-with-I xTp
];close if
end
to count-conflicts-for-Ei
set xpartners turtles with [breed = controllers and self != myself and Ei != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictEi-with-R xTp
];close if
set xpartners turtles with [breed = businesses and self != myself and Ei != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictEi-with-B xTp
];close if
set xpartners turtles with [breed = communities and self != myself and Ei != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictEi-with-C xTp
];close if
set xpartners turtles with [breed = gatekeepers and self != myself and Ei != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictEi-with-G xTp
];close if
set xpartners turtles with [breed = institutions and self != myself and Ei != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictEi-with-I xTp
];close if
end
to count-conflicts-for-Vn
set xpartners turtles with [breed = controllers and self != myself and perceptionOftpreffor-natural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVn-with-R xTp
];close if
set xpartners turtles with [breed = businesses and self != myself and perceptionOftpreffor-natural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVn-with-B xTp
];close if
set xpartners turtles with [breed = communities and self != myself and perceptionOftpreffor-natural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVn-with-C xTp
];close if
set xpartners turtles with [breed = gatekeepers and self != myself and perceptionOftpreffor-natural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVn-with-G xTp
];close if
set xpartners turtles with [breed = institutions and self != myself and perceptionOftpreffor-natural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVn-with-I xTp
];close if
end
to count-conflicts-for-Vc
set xpartners turtles with [breed = controllers and self != myself and perceptionOftpreffor-cultural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVc-with-R xTp
];close if
set xpartners turtles with [breed = businesses and self != myself and perceptionOftpreffor-cultural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVc-with-B xTp
];close if
set xpartners turtles with [breed = communities and self != myself and perceptionOftpreffor-cultural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVc-with-C xTp
];close if
set xpartners turtles with [breed = gatekeepers and self != myself and perceptionOftpreffor-cultural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVc-with-G xTp
];close if
set xpartners turtles with [breed = institutions and self != myself and perceptionOftpreffor-cultural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVc-with-I xTp
];close if
end
to count-conflictsXi-amongRBGCI
set numof-conflictsXi-between-controllers-and-controllers
((sum values-from turtles with [breed = controllers][conflictXi-with-R]) / count turtles with [breed = controllers])
set numof-conflictsXi-between-controllers-and-businesses
((sum values-from turtles with [breed = controllers][conflictXi-with-B]) / count turtles with [breed = controllers])
set numof-conflictsXi-between-controllers-and-gatekeepers
((sum values-from turtles with [breed = controllers][conflictXi-with-G]) / count turtles with [breed = controllers])
set numof-conflictsXi-between-controllers-and-communities
((sum values-from turtles with [breed = controllers][conflictXi-with-C]) / count turtles with [breed = controllers])
set numof-conflictsXi-between-controllers-and-institutions
((sum values-from turtles with [breed = controllers][conflictXi-with-I]) / count turtles with [breed = controllers])
set numof-conflictsXi-between-businesses-and-controllers
((sum values-from turtles with [breed = businesses][conflictXi-with-R]) / count turtles with [breed = businesses])
set numof-conflictsXi-between-businesses-and-businesses
((sum values-from turtles with [breed = businesses][conflictXi-with-B]) / count turtles with [breed = businesses])
set numof-conflictsXi-between-businesses-and-gatekeepers
((sum values-from turtles with [breed = businesses][conflictXi-with-G]) / count turtles with [breed = businesses])
set numof-conflictsXi-between-businesses-and-communities
((sum values-from turtles with [breed = businesses][conflictXi-with-C]) / count turtles with [breed = businesses])
set numof-conflictsXi-between-businesses-and-institutions
((sum values-from turtles with [breed = businesses][conflictXi-with-I]) / count turtles with [breed = businesses])
set numof-conflictsXi-between-gatekeepers-and-controllers
((sum values-from turtles with [breed = gatekeepers][conflictXi-with-R]) / count turtles with [breed = gatekeepers])
set numof-conflictsXi-between-gatekeepers-and-businesses
((sum values-from turtles with [breed = gatekeepers][conflictXi-with-B]) / count turtles with [breed = gatekeepers])
set numof-conflictsXi-between-gatekeepers-and-gatekeepers
((sum values-from turtles with [breed = gatekeepers][conflictXi-with-G]) / count turtles with [breed = gatekeepers])
set numof-conflictsXi-between-gatekeepers-and-communities
((sum values-from turtles with [breed = gatekeepers][conflictXi-with-C]) / count turtles with [breed = gatekeepers])
set numof-conflictsXi-between-gatekeepers-and-institutions
((sum values-from turtles with [breed = gatekeepers][conflictXi-with-I]) / count turtles with [breed = gatekeepers])
set numof-conflictsXi-between-communities-and-controllers
((sum values-from turtles with [breed = communities][conflictXi-with-R]) / count turtles with [breed = communities])
set numof-conflictsXi-between-communities-and-businesses
((sum values-from turtles with [breed = communities][conflictXi-with-B]) / count turtles with [breed = communities])
set numof-conflictsXi-between-communities-and-gatekeepers
((sum values-from turtles with [breed = communities][conflictXi-with-G]) / count turtles with [breed = communities])
set numof-conflictsXi-between-communities-and-communities
((sum values-from turtles with [breed = communities][conflictXi-with-C]) / count turtles with [breed = communities])
set numof-conflictsXi-between-communities-and-institutions
((sum values-from turtles with [breed = communities][conflictXi-with-I]) / count turtles with [breed = communities])
set numof-conflictsXi-between-institutions-and-controllers
((sum values-from turtles with [breed = institutions][conflictXi-with-R]) / count turtles with [breed = institutions])
set numof-conflictsXi-between-institutions-and-businesses
((sum values-from turtles with [breed = institutions][conflictXi-with-B]) / count turtles with [breed = institutions])
set numof-conflictsXi-between-institutions-and-gatekeepers
((sum values-from turtles with [breed = institutions][conflictXi-with-G]) / count turtles with [breed = institutions])
set numof-conflictsXi-between-institutions-and-communities
((sum values-from turtles with [breed = institutions][conflictXi-with-C]) / count turtles with [breed = institutions])
set numof-conflictsXi-between-institutions-and-institutions
((sum values-from turtles with [breed = institutions][conflictXi-with-I]) / count turtles with [breed = institutions])
end
to print-conflictsXi-amongRBGCI
type "numof-conflictsXi-between-controllers-and-controllers: " print precision numof-conflictsXi-between-controllers-and-controllers 2
type "numof-conflictsXi-between-controllers-and-businesses: " print precision numof-conflictsXi-between-controllers-and-businesses 2
type "numof-conflictsXi-between-controllers-and-gatekeepers: " print precision numof-conflictsXi-between-controllers-and-gatekeepers 2
type "numof-conflictsXi-between-controllers-and-communities: " print precision numof-conflictsXi-between-controllers-and-communities 2
type "numof-conflictsXi-between-controllers-and-institutions: " print precision numof-conflictsXi-between-controllers-and-institutions 2
type "numof-conflictsXi-between-businesses-and-controllers: " print precision numof-conflictsXi-between-businesses-and-controllers 2
type "numof-conflictsXi-between-businesses-and-businesses: " print precision numof-conflictsXi-between-businesses-and-businesses 2
type "numof-conflictsXi-between-businesses-and-gatekeepers: " print precision numof-conflictsXi-between-businesses-and-gatekeepers 2
type "numof-conflictsXi-between-businesses-and-communities: " print precision numof-conflictsXi-between-businesses-and-communities 2
type "numof-conflictsXi-between-businesses-and-institutions: " print precision numof-conflictsXi-between-businesses-and-institutions 2
type "numof-conflictsXi-between-gatekeepers-and-controllers: " print precision numof-conflictsXi-between-gatekeepers-and-controllers 2
type "numof-conflictsXi-between-gatekeepers-and-businesses: " print precision numof-conflictsXi-between-gatekeepers-and-businesses 2
type "numof-conflictsXi-between-gatekeepers-and-gatekeepers: " print precision numof-conflictsXi-between-gatekeepers-and-gatekeepers 2
type "numof-conflictsXi-between-gatekeepers-and-communities: " print precision numof-conflictsXi-between-gatekeepers-and-communities 2
type "numof-conflictsXi-between-gatekeepers-and-institutions: " print precision numof-conflictsXi-between-gatekeepers-and-institutions 2
type "numof-conflictsXi-between-communities-and-controllers: " print precision numof-conflictsXi-between-communities-and-controllers 2
type "numof-conflictsXi-between-communities-and-businesses: " print precision numof-conflictsXi-between-communities-and-businesses 2
type "numof-conflictsXi-between-communities-and-gatekeepers: " print precision numof-conflictsXi-between-communities-and-gatekeepers 2
type "numof-conflictsXi-between-communities-and-communities: " print precision numof-conflictsXi-between-communities-and-communities 2
type "numof-conflictsXi-between-communities-and-institutions: " print precision numof-conflictsXi-between-communities-and-institutions 2
type "numof-conflictsXi-between-institutions-and-controllers: " print precision numof-conflictsXi-between-institutions-and-controllers 2
type "numof-conflictsXi-between-institutions-and-businesses: " print precision numof-conflictsXi-between-institutions-and-businesses 2
type "numof-conflictsXi-between-institutions-and-gatekeepers: " print precision numof-conflictsXi-between-institutions-and-gatekeepers 2
type "numof-conflictsXi-between-institutions-and-communities: " print precision numof-conflictsXi-between-institutions-and-communities 2
type "numof-conflictsXi-between-institutions-and-institutions: " print precision numof-conflictsXi-between-institutions-and-institutions 2
end
to count-conflictsEi-amongRBGCI
set numof-conflictsEi-between-controllers-and-controllers
((sum values-from turtles with [breed = controllers][conflictEi-with-R]) / count turtles with [breed = controllers])
set numof-conflictsEi-between-controllers-and-businesses
((sum values-from turtles with [breed = controllers][conflictEi-with-B]) / count turtles with [breed = controllers])
set numof-conflictsEi-between-controllers-and-gatekeepers
((sum values-from turtles with [breed = controllers][conflictEi-with-G]) / count turtles with [breed = controllers])
set numof-conflictsEi-between-controllers-and-communities
((sum values-from turtles with [breed = controllers][conflictEi-with-C]) / count turtles with [breed = controllers])
set numof-conflictsEi-between-controllers-and-institutions
((sum values-from turtles with [breed = controllers][conflictEi-with-I]) / count turtles with [breed = controllers])
set numof-conflictsEi-between-businesses-and-controllers
((sum values-from turtles with [breed = businesses][conflictEi-with-R]) / count turtles with [breed = businesses])
set numof-conflictsEi-between-businesses-and-businesses
((sum values-from turtles with [breed = businesses][conflictEi-with-B]) / count turtles with [breed = businesses])
set numof-conflictsEi-between-businesses-and-gatekeepers
((sum values-from turtles with [breed = businesses][conflictEi-with-G]) / count turtles with [breed = businesses])
set numof-conflictsEi-between-businesses-and-communities
((sum values-from turtles with [breed = businesses][conflictEi-with-C]) / count turtles with [breed = businesses])
set numof-conflictsEi-between-businesses-and-institutions
((sum values-from turtles with [breed = businesses][conflictEi-with-I]) / count turtles with [breed = businesses])
set numof-conflictsEi-between-gatekeepers-and-controllers
((sum values-from turtles with [breed = gatekeepers][conflictEi-with-R]) / count turtles with [breed = gatekeepers])
set numof-conflictsEi-between-gatekeepers-and-businesses
((sum values-from turtles with [breed = gatekeepers][conflictEi-with-B]) / count turtles with [breed = gatekeepers])
set numof-conflictsEi-between-gatekeepers-and-gatekeepers
((sum values-from turtles with [breed = gatekeepers][conflictEi-with-G]) / count turtles with [breed = gatekeepers])
set numof-conflictsEi-between-gatekeepers-and-communities
((sum values-from turtles with [breed = gatekeepers][conflictEi-with-C]) / count turtles with [breed = gatekeepers])
set numof-conflictsEi-between-gatekeepers-and-institutions
((sum values-from turtles with [breed = gatekeepers][conflictEi-with-I]) / count turtles with [breed = gatekeepers])
set numof-conflictsEi-between-communities-and-controllers
((sum values-from turtles with [breed = communities][conflictEi-with-R]) / count turtles with [breed = communities])
set numof-conflictsEi-between-communities-and-businesses
((sum values-from turtles with [breed = communities][conflictEi-with-B]) / count turtles with [breed = communities])
set numof-conflictsEi-between-communities-and-gatekeepers
((sum values-from turtles with [breed = communities][conflictEi-with-G]) / count turtles with [breed = communities])
set numof-conflictsEi-between-communities-and-communities
((sum values-from turtles with [breed = communities][conflictEi-with-C]) / count turtles with [breed = communities])
set numof-conflictsEi-between-communities-and-institutions
((sum values-from turtles with [breed = communities][conflictEi-with-I]) / count turtles with [breed = communities])
set numof-conflictsEi-between-institutions-and-controllers
((sum values-from turtles with [breed = institutions][conflictEi-with-R]) / count turtles with [breed = institutions])
set numof-conflictsEi-between-institutions-and-businesses
((sum values-from turtles with [breed = institutions][conflictEi-with-B]) / count turtles with [breed = institutions])
set numof-conflictsEi-between-institutions-and-gatekeepers
((sum values-from turtles with [breed = institutions][conflictEi-with-G]) / count turtles with [breed = institutions])
set numof-conflictsEi-between-institutions-and-communities
((sum values-from turtles with [breed = institutions][conflictEi-with-C]) / count turtles with [breed = institutions])
set numof-conflictsEi-between-institutions-and-institutions
((sum values-from turtles with [breed = institutions][conflictEi-with-I]) / count turtles with [breed = institutions])
end
to print-conflictsEi-amongRBGCI
type "numof-conflictsEi-between-controllers-and-controllers: " print precision numof-conflictsEi-between-controllers-and-controllers 2
type "numof-conflictsEi-between-controllers-and-businesses: " print precision numof-conflictsEi-between-controllers-and-businesses 2
type "numof-conflictsEi-between-controllers-and-gatekeepers: " print precision numof-conflictsEi-between-controllers-and-gatekeepers 2
type "numof-conflictsEi-between-controllers-and-communities: " print precision numof-conflictsEi-between-controllers-and-communities 2
type "numof-conflictsEi-between-controllers-and-institutions: " print precision numof-conflictsEi-between-controllers-and-institutions 2
type "numof-conflictsEi-between-businesses-and-controllers: " print precision numof-conflictsEi-between-businesses-and-controllers 2
type "numof-conflictsEi-between-businesses-and-businesses: " print precision numof-conflictsEi-between-businesses-and-businesses 2
type "numof-conflictsEi-between-businesses-and-gatekeepers: " print precision numof-conflictsEi-between-businesses-and-gatekeepers 2
type "numof-conflictsEi-between-businesses-and-communities: " print precision numof-conflictsEi-between-businesses-and-communities 2
type "numof-conflictsEi-between-businesses-and-institutions: " print precision numof-conflictsEi-between-businesses-and-institutions 2
type "numof-conflictsEi-between-gatekeepers-and-controllers: " print precision numof-conflictsEi-between-gatekeepers-and-controllers 2
type "numof-conflictsEi-between-gatekeepers-and-businesses: " print precision numof-conflictsEi-between-gatekeepers-and-businesses 2
type "numof-conflictsEi-between-gatekeepers-and-gatekeepers: " print precision numof-conflictsEi-between-gatekeepers-and-gatekeepers 2
type "numof-conflictsEi-between-gatekeepers-and-communities: " print precision numof-conflictsEi-between-gatekeepers-and-communities 2
type "numof-conflictsEi-between-gatekeepers-and-institutions: " print precision numof-conflictsEi-between-gatekeepers-and-institutions 2
type "numof-conflictsEi-between-communities-and-controllers: " print precision numof-conflictsEi-between-communities-and-controllers 2
type "numof-conflictsEi-between-communities-and-businesses: " print precision numof-conflictsEi-between-communities-and-businesses 2
type "numof-conflictsEi-between-communities-and-gatekeepers: " print precision numof-conflictsEi-between-communities-and-gatekeepers 2
type "numof-conflictsEi-between-communities-and-communities: " print precision numof-conflictsEi-between-communities-and-communities 2
type "numof-conflictsEi-between-communities-and-institutions: " print precision numof-conflictsEi-between-communities-and-institutions 2
type "numof-conflictsEi-between-institutions-and-controllers: " print precision numof-conflictsEi-between-institutions-and-controllers 2
type "numof-conflictsEi-between-institutions-and-businesses: " print precision numof-conflictsEi-between-institutions-and-businesses 2
type "numof-conflictsEi-between-institutions-and-gatekeepers: " print precision numof-conflictsEi-between-institutions-and-gatekeepers 2
type "numof-conflictsEi-between-institutions-and-communities: " print precision numof-conflictsEi-between-institutions-and-communities 2
type "numof-conflictsEi-between-institutions-and-institutions: " print precision numof-conflictsEi-between-institutions-and-institutions 2
end
to count-conflictsVn-amongRBGCI
set numof-conflictsVn-between-controllers-and-controllers
((sum values-from turtles with [breed = controllers][conflictVn-with-R]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVn-between-controllers-and-businesses
((sum values-from turtles with [breed = controllers][conflictVn-with-B]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVn-between-controllers-and-gatekeepers
((sum values-from turtles with [breed = controllers][conflictVn-with-G]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVn-between-controllers-and-communities
((sum values-from turtles with [breed = controllers][conflictVn-with-C]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVn-between-controllers-and-institutions
((sum values-from turtles with [breed = controllers][conflictVn-with-I]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVn-between-businesses-and-controllers
((sum values-from turtles with [breed = businesses][conflictVn-with-R]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVn-between-businesses-and-businesses
((sum values-from turtles with [breed = businesses][conflictVn-with-B]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVn-between-businesses-and-gatekeepers
((sum values-from turtles with [breed = businesses][conflictVn-with-G]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVn-between-businesses-and-communities
((sum values-from turtles with [breed = businesses][conflictVn-with-C]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVn-between-businesses-and-institutions
((sum values-from turtles with [breed = businesses][conflictVn-with-I]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVn-between-gatekeepers-and-controllers
((sum values-from turtles with [breed = gatekeepers][conflictVn-with-R]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVn-between-gatekeepers-and-businesses
((sum values-from turtles with [breed = gatekeepers][conflictVn-with-B]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVn-between-gatekeepers-and-gatekeepers
((sum values-from turtles with [breed = gatekeepers][conflictVn-with-G]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVn-between-gatekeepers-and-communities
((sum values-from turtles with [breed = gatekeepers][conflictVn-with-C]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVn-between-gatekeepers-and-institutions
((sum values-from turtles with [breed = gatekeepers][conflictVn-with-I]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVn-between-communities-and-controllers
((sum values-from turtles with [breed = communities][conflictVn-with-R]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVn-between-communities-and-businesses
((sum values-from turtles with [breed = communities][conflictVn-with-B]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVn-between-communities-and-gatekeepers
((sum values-from turtles with [breed = communities][conflictVn-with-G]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVn-between-communities-and-communities
((sum values-from turtles with [breed = communities][conflictVn-with-C]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVn-between-communities-and-institutions
((sum values-from turtles with [breed = communities][conflictVn-with-I]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVn-between-institutions-and-controllers
((sum values-from turtles with [breed = institutions][conflictVn-with-R]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVn-between-institutions-and-businesses
((sum values-from turtles with [breed = institutions][conflictVn-with-B]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVn-between-institutions-and-gatekeepers
((sum values-from turtles with [breed = institutions][conflictVn-with-G]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVn-between-institutions-and-communities
((sum values-from turtles with [breed = institutions][conflictVn-with-C]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVn-between-institutions-and-institutions
((sum values-from turtles with [breed = institutions][conflictVn-with-I]) / count turtles with [breed = institutions and who < TTN])
end
to print-conflictsVn-amongRBGCI
type "numof-conflictsVn-between-controllers-and-controllers: " print precision numof-conflictsVn-between-controllers-and-controllers 2
type "numof-conflictsVn-between-controllers-and-businesses: " print precision numof-conflictsVn-between-controllers-and-businesses 2
type "numof-conflictsVn-between-controllers-and-gatekeepers: " print precision numof-conflictsVn-between-controllers-and-gatekeepers 2
type "numof-conflictsVn-between-controllers-and-communities: " print precision numof-conflictsVn-between-controllers-and-communities 2
type "numof-conflictsVn-between-controllers-and-institutions: " print precision numof-conflictsVn-between-controllers-and-institutions 2
type "numof-conflictsVn-between-businesses-and-controllers: " print precision numof-conflictsVn-between-businesses-and-controllers 2
type "numof-conflictsVn-between-businesses-and-businesses: " print precision numof-conflictsVn-between-businesses-and-businesses 2
type "numof-conflictsVn-between-businesses-and-gatekeepers: " print precision numof-conflictsVn-between-businesses-and-gatekeepers 2
type "numof-conflictsVn-between-businesses-and-communities: " print precision numof-conflictsVn-between-businesses-and-communities 2
type "numof-conflictsVn-between-businesses-and-institutions: " print precision numof-conflictsVn-between-businesses-and-institutions 2
type "numof-conflictsVn-between-gatekeepers-and-controllers: " print precision numof-conflictsVn-between-gatekeepers-and-controllers 2
type "numof-conflictsVn-between-gatekeepers-and-businesses: " print precision numof-conflictsVn-between-gatekeepers-and-businesses 2
type "numof-conflictsVn-between-gatekeepers-and-gatekeepers: " print precision numof-conflictsVn-between-gatekeepers-and-gatekeepers 2
type "numof-conflictsVn-between-gatekeepers-and-communities: " print precision numof-conflictsVn-between-gatekeepers-and-communities 2
type "numof-conflictsVn-between-gatekeepers-and-institutions: " print precision numof-conflictsVn-between-gatekeepers-and-institutions 2
type "numof-conflictsVn-between-communities-and-controllers: " print precision numof-conflictsVn-between-communities-and-controllers 2
type "numof-conflictsVn-between-communities-and-businesses: " print precision numof-conflictsVn-between-communities-and-businesses 2
type "numof-conflictsVn-between-communities-and-gatekeepers: " print precision numof-conflictsVn-between-communities-and-gatekeepers 2
type "numof-conflictsVn-between-communities-and-communities: " print precision numof-conflictsVn-between-communities-and-communities 2
type "numof-conflictsVn-between-communities-and-institutions: " print precision numof-conflictsVn-between-communities-and-institutions 2
type "numof-conflictsVn-between-institutions-and-controllers: " print precision numof-conflictsVn-between-institutions-and-controllers 2
type "numof-conflictsVn-between-institutions-and-businesses: " print precision numof-conflictsVn-between-institutions-and-businesses 2
type "numof-conflictsVn-between-institutions-and-gatekeepers: " print precision numof-conflictsVn-between-institutions-and-gatekeepers 2
type "numof-conflictsVn-between-institutions-and-communities: " print precision numof-conflictsVn-between-institutions-and-communities 2
type "numof-conflictsVn-between-institutions-and-institutions: " print precision numof-conflictsVn-between-institutions-and-institutions 2
end
to count-conflictsVc-amongRBGCI
set numof-conflictsVc-between-controllers-and-controllers
((sum values-from turtles with [breed = controllers][conflictVc-with-R]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVc-between-controllers-and-businesses
((sum values-from turtles with [breed = controllers][conflictVc-with-B]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVc-between-controllers-and-gatekeepers
((sum values-from turtles with [breed = controllers][conflictVc-with-G]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVc-between-controllers-and-communities
((sum values-from turtles with [breed = controllers][conflictVc-with-C]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVc-between-controllers-and-institutions
((sum values-from turtles with [breed = controllers][conflictVc-with-I]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVc-between-businesses-and-controllers
((sum values-from turtles with [breed = businesses][conflictVc-with-R]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVc-between-businesses-and-businesses
((sum values-from turtles with [breed = businesses][conflictVc-with-B]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVc-between-businesses-and-gatekeepers
((sum values-from turtles with [breed = businesses][conflictVc-with-G]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVc-between-businesses-and-communities
((sum values-from turtles with [breed = businesses][conflictVc-with-C]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVc-between-businesses-and-institutions
((sum values-from turtles with [breed = businesses][conflictVc-with-I]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVc-between-gatekeepers-and-controllers
((sum values-from turtles with [breed = gatekeepers][conflictVc-with-R]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVc-between-gatekeepers-and-businesses
((sum values-from turtles with [breed = gatekeepers][conflictVc-with-B]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVc-between-gatekeepers-and-gatekeepers
((sum values-from turtles with [breed = gatekeepers][conflictVc-with-G]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVc-between-gatekeepers-and-communities
((sum values-from turtles with [breed = gatekeepers][conflictVc-with-C]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVc-between-gatekeepers-and-institutions
((sum values-from turtles with [breed = gatekeepers][conflictVc-with-I]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVc-between-communities-and-controllers
((sum values-from turtles with [breed = communities][conflictVc-with-R]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVc-between-communities-and-businesses
((sum values-from turtles with [breed = communities][conflictVc-with-B]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVc-between-communities-and-gatekeepers
((sum values-from turtles with [breed = communities][conflictVc-with-G]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVc-between-communities-and-communities
((sum values-from turtles with [breed = communities][conflictVc-with-C]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVc-between-communities-and-institutions
((sum values-from turtles with [breed = communities][conflictVc-with-I]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVc-between-institutions-and-controllers
((sum values-from turtles with [breed = institutions][conflictVc-with-R]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVc-between-institutions-and-businesses
((sum values-from turtles with [breed = institutions][conflictVc-with-B]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVc-between-institutions-and-gatekeepers
((sum values-from turtles with [breed = institutions][conflictVc-with-G]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVc-between-institutions-and-communities
((sum values-from turtles with [breed = institutions][conflictVc-with-C]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVc-between-institutions-and-institutions
((sum values-from turtles with [breed = institutions][conflictVc-with-I]) / count turtles with [breed = institutions and who < TTN])
end
to print-conflictsVc-amongRBGCI
type "numof-conflictsVc-between-controllers-and-controllers: " print precision numof-conflictsVc-between-controllers-and-controllers 2
type "numof-conflictsVc-between-controllers-and-businesses: " print precision numof-conflictsVc-between-controllers-and-businesses 2
type "numof-conflictsVc-between-controllers-and-gatekeepers: " print precision numof-conflictsVc-between-controllers-and-gatekeepers 2
type "numof-conflictsVc-between-controllers-and-communities: " print precision numof-conflictsVc-between-controllers-and-communities 2
type "numof-conflictsVc-between-controllers-and-institutions: " print precision numof-conflictsVc-between-controllers-and-institutions 2
type "numof-conflictsVc-between-businesses-and-controllers: " print precision numof-conflictsVc-between-businesses-and-controllers 2
type "numof-conflictsVc-between-businesses-and-businesses: " print precision numof-conflictsVc-between-businesses-and-businesses 2
type "numof-conflictsVc-between-businesses-and-gatekeepers: " print precision numof-conflictsVc-between-businesses-and-gatekeepers 2
type "numof-conflictsVc-between-businesses-and-communities: " print precision numof-conflictsVc-between-businesses-and-communities 2
type "numof-conflictsVc-between-businesses-and-institutions: " print precision numof-conflictsVc-between-businesses-and-institutions 2
type "numof-conflictsVc-between-gatekeepers-and-controllers: " print precision numof-conflictsVc-between-gatekeepers-and-controllers 2
type "numof-conflictsVc-between-gatekeepers-and-businesses: " print precision numof-conflictsVc-between-gatekeepers-and-businesses 2
type "numof-conflictsVc-between-gatekeepers-and-gatekeepers: " print precision numof-conflictsVc-between-gatekeepers-and-gatekeepers 2
type "numof-conflictsVc-between-gatekeepers-and-communities: " print precision numof-conflictsVc-between-gatekeepers-and-communities 2
type "numof-conflictsVc-between-gatekeepers-and-institutions: " print precision numof-conflictsVc-between-gatekeepers-and-institutions 2
type "numof-conflictsVc-between-communities-and-controllers: " print precision numof-conflictsVc-between-communities-and-controllers 2
type "numof-conflictsVc-between-communities-and-businesses: " print precision numof-conflictsVc-between-communities-and-businesses 2
type "numof-conflictsVc-between-communities-and-gatekeepers: " print precision numof-conflictsVc-between-communities-and-gatekeepers 2
type "numof-conflictsVc-between-communities-and-communities: " print precision numof-conflictsVc-between-communities-and-communities 2
type "numof-conflictsVc-between-communities-and-institutions: " print precision numof-conflictsVc-between-communities-and-institutions 2
type "numof-conflictsVc-between-institutions-and-controllers: " print precision numof-conflictsVc-between-institutions-and-controllers 2
type "numof-conflictsVc-between-institutions-and-businesses: " print precision numof-conflictsVc-between-institutions-and-businesses 2
type "numof-conflictsVc-between-institutions-and-gatekeepers: " print precision numof-conflictsVc-between-institutions-and-gatekeepers 2
type "numof-conflictsVc-between-institutions-and-communities: " print precision numof-conflictsVc-between-institutions-and-communities 2
type "numof-conflictsVc-between-institutions-and-institutions: " print precision numof-conflictsVc-between-institutions-and-institutions 2
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Runtime Procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; TO BUILD NO REGULATED SCENARIOS
;; by simulating controllers, businesses and gatekeepers, acting as they said in Q4 and Qx5 + something else ..
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to build-no-regulated-scenarios
locals [w x y z]
;setup-user-input-parameters-1
if iteration = 0
[
set-current-plot "Controllers Behaviours"
clear-plot
set-current-plot "Businesses Behaviours"
clear-plot
set-current-plot "Gatekeepers Behaviours"
clear-plot
set-current-plot "Controllers Interactions"
clear-plot
set-current-plot "Businesses Interactions"
clear-plot
set-current-plot "Gatekeepers Interactions"
clear-plot
set-current-plot "Provisioned Resources"
clear-plot
set-current-plot "Used Resources"
clear-plot
set-current-plot "Promoted Resources"
clear-plot
set-current-plot "Visited Resources"
clear-plot
set-current-plot "Tourists Density"
clear-plot
set-current-plot "Tourists"
clear-plot
set-current-plot "Communities"
clear-plot
set TypeOfRegulation " market"
setup-user-input-parameters-2
reset-phantoms
]
set TTN count turtles
setup-conflicts-and-cooperations-to-zero
do-plotting-conflicts-and-cooperations-RBG
do-bookkeeping-initial-patch-counts
print-initial-patch-counts2
do-plotting-behaviours-reg
while [iteration < Iterations] ; true
[
without-interruption
[
set iteration iteration + 1
type "No Regualtion scenario, iter " print iteration
remove-duplicates-controls-uses-promotions
do-NO-REGULATION
do-bookkeeping-initial-patch-counts
print-initial-patch-counts2
do-plotting-conflicts-and-cooperations-RBG
do-plotting-behaviours-reg
set numof-unsatisfied-tourists 0
set avenumof-unsatisfied-communities 0
;set minnumof-unsatisfied-communities 0
;set maxnumof-unsatisfied-communities 0
set KilledTourists 0
type "End of iteration " print iteration
];without
];while
print-initial-situation
count-conflictsVn-amongRBGCI
; print-conflictsVn-amongRBGCI
count-conflictsVc-amongRBGCI
; print-conflictsVc-amongRBGCI
; reset-phantoms
; set a word "SPRITE-" country
; set b word a region
; set c word b event
; set d word c "resultsOfRegulation"
; set resfileN word d iteration
; export-world resfileN
set w word d "-AltNoRegS-R-"
set x word w UnderUsedResources
; set y word x CollectiveObjective
; set z word y CollectiveObjective
set resfileN word x iteration
export-world resfileN
print "End of the simulations"
print "Save & Clear the Command Center"
end
to do-NO-REGULATION
without-interruption
[
controllers-attemptto-control-underused-resources-NO-REGULATION
businesses-attemptto-use-underused-resources-NO-REGULATION
gatekeepers-attemptto-promote-underused-resources-NO-REGULATION
tourists-attemptto-visit-underused-resources-NO-REGULATION
setup-controllers-energy
setup-businesses-energy
setup-gatekeepers-energy
update-lorenz-and-gini-plots
if (BottomUpRegulation? = true) [simulate-dynamicsof-positions]
]
end
to controllers-attemptto-control-underused-resources-NO-REGULATION
type "Controllers are attempting to make more available the " type UnderUsedResources print "resources"
if (UnderUsedResources = "natural") [controllers-explore-natural-resources-NO-REGULATION]
if (UnderUsedResources = "cultural") [controllers-explore-cultural-resources-NO-REGULATION]
if (UnderUsedResources = "natural&cultural") [controllers-explore-undefined-resources-NO-REGULATION]
end
to controllers-explore-undefined-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
(natural-resources >= ResourcesThreshold or cultural-resources >= ResourcesThreshold) ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by = []
and used-by = []
]
;show listof-patches-with-underused-resources
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
;show label
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
controllers-moves-to-underused-resources-NO-REGULATION
]
]
end
to controllers-explore-natural-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by = []
and used-by = []
]
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and preffor-natural-resources >= ResourcesThreshold ; with high preference for natural resources
and perceptionoftpreffor-natural-resources >= ResourcesThreshold
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
controllers-moves-to-underused-resources-NO-REGULATION
]
]
end
to controllers-explore-cultural-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
cultural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by = []
and used-by = []
]
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and preffor-cultural-resources >= ResourcesThreshold ; with high preference for natural resources
and perceptionoftpreffor-cultural-resources >= ResourcesThreshold
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
controllers-moves-to-underused-resources-NO-REGULATION
]
]
end
to controllers-moves-to-underused-resources-NO-REGULATION ;; turtle proceduere
locals [Wp Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
set Tp count other-turtles-here with [breed = controllers and who >= TTN]
ifelse (Tp > 0)
[; one other phantom controllers is candidate to control the same patch
controllers-internal-conflicts-analysis-NO-REGULATION ; --> partners 1
ifelse (partners != [])
[;there are partners 1
;search for the bigest controllers
set bigest max-one-of turtles-here with [breed = controllers and who >= TTN][energy];[size]
ifelse (who-of bigest = who-of myself)
[;i am the winer of conflict
;set Wp values-from other-turtles-here with [breed = controllers and who >= TTN] [label]
;ask turtles with [Wp] [die]
ask other-turtles-here with [breed = controllers and who >= TTN]
[
without-interruption
[
if (member? label controlled-by-of patch-here)
[set controlled-by-of patch-here (remove label controlled-by-of patch-here)]
die
]
]
print-shiftsin-controls
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4)
ifelse (TNp8 > 1)
[; there are other actual controllers or businesses arround the asked turtle: test their objectives
controllers-external-conflicts-analysis-NO-REGULATION ; --> partners 2
]
[; no other turtles arround
;expand-preferences-ofcontrollers
print-expand-shiftsin-controls
]
]
[;i am the loser of all possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-NO-REGULATION]
]
]
[;no partners
]
]
[;no other phantom turtle is candidate to use this patch
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4);
ifelse (TNp8 > 1)
[; there are other controllers or businesses arround the asked turtle: test their objectives
controllers-external-conflicts-analysis-NO-REGULATION ; --> partners 2
]
[; no other turtles arround
;expand-preferences-ofcontrollers
print-expand-shiftsin-controls
]
]
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-NO-REGULATION]
]
end
to controllers-internal-conflicts-analysis-NO-REGULATION; to get other phantom controllers on the patch
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
set Tp count other-turtles-here with [breed = controllers and who >= TTN and Xi < 1 ]
set partners other-turtles-here with [breed = controllers and who >= TTN and Xi < 1 ]
;if partners != []
if (Tp > 0)
[; other phantom controllers would not develop tourism
type label ; type " (" type who type ")"
type " conflicts with "
type values-from partners [label]; defected-partners 1
type " to control " print patch-here
set conflict1 Tp;(conflict1 + Tp); defected-partners 1
set conflict-with-R (conflict-with-R + Tp)
if (UnderUsedResources = "natural") [set conflictVn-with-R (conflictVn-with-R + Tp)]
if (UnderUsedResources = "cultural") [set conflictVc-with-R (conflictVc-with-R + Tp)]
ask partners
[
without-interruption
[
set defected-partners lput label-of myself defected-partners
set defected-partners remove-duplicates defected-partners
]
]
]
end
to controllers-external-conflicts-analysis-NO-REGULATION; for other actual turtle around the patch
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi < 1
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi < 1
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
;if partners != [] ; partners 2
if (Tp > 0)
[;others arround would not develop tourism
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi < 1 and who < TTN]
in-radius (ResourcesDensity * 4)[energy]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible conflicts
type label ; type " (" type who type ")"
type " conflicts with "
type values-from partners [label]; defected-partners
type " to control " print patch-here
set conflict2 Tp; (conflict2 + Tp)
set conflict-with-R (conflict-with-R + count partners with [breed = controllers])
set conflict-with-B (conflict-with-B + count partners with [breed = businesses])
set conflict-with-G (conflict-with-G + count partners with [breed = gatekeepers])
if (UnderUsedResources = "natural")
[
set conflictVn-with-R (conflictVn-with-R + count partners with [breed = controllers])
set conflictVn-with-B (conflictVn-with-B + count partners with [breed = businesses])
set conflictVn-with-G (conflictVn-with-G + count partners with [breed = gatekeepers])
]
if (UnderUsedResources = "cultural")
[
set conflictVc-with-R (conflictVc-with-R + count partners with [breed = controllers])
set conflictVc-with-B (conflictVc-with-B + count partners with [breed = businesses])
set conflictVc-with-G (conflictVc-with-G + count partners with [breed = gatekeepers])
]
ask partners
[
without-interruption
[
set defected-partners lput label-of myself defected-partners
set defected-partners remove-duplicates defected-partners
]
]
;expand-preferences-ofcontrollers
set bigest max-one-of partners [energy]; [size]
ifelse (energy-of myself > energy-of bigest); I am the winner: I impose my view
[
print-shiftsin-controls
]
[
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-NO-REGULATION]
]
]
[;no conflict
;expand-preferences-ofcontrollers
print-expand-shiftsin-controls
]
]
if (member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5)
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
;if partners != []
ifelse (Tp > 0)
[;others have the same objective
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN]
in-radius (ResourcesDensity * 4) [size]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible alliances
type label ; type " (" type who type ")"
type " cooperates with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation2 Tp;(cooperation2 + Tp)
set cooperation-with-R (cooperation-with-R + count partners with [breed = controllers])
set cooperation-with-B (cooperation-with-B + count partners with [breed = businesses])
set cooperation-with-G (cooperation-with-G + count partners with [breed = gatekeepers])
ask partners
[
without-interruption
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
]
;expand-preferences-ofcontrollers
print-shiftsin-controls
]
[;no possibles alliances
]
]
[;possible conflict
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-NO-REGULATION]
]
]
end
to businesses-attemptto-use-underused-resources-NO-REGULATION
type "Businesses are attempting to make more integrated the " print UnderUsedResources
if (UnderUsedResources = "natural") [businesses-explore-natural-resources-NO-REGULATION]
if (UnderUsedResources = "cultural") [businesses-explore-cultural-resources-NO-REGULATION]
if (UnderUsedResources = "natural&cultural") [businesses-explore-undefined-resources-NO-REGULATION]
end
to businesses-explore-undefined-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
(natural-resources >= ResourcesThreshold or cultural-resources >= ResourcesThreshold) ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by = []
]
;show listof-patches-with-underused-resources
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" businesses
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
;show label
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
businesses-moves-to-underused-resources-NO-REGULATION
]
]
end
to businesses-explore-natural-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by = []
]
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" businesses
and gains > 0
and preffor-natural-resources >= ResourcesThreshold ; with high preference for natural resources
and perceptionoftpreffor-natural-resources >= ResourcesThreshold
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
businesses-moves-to-underused-resources-NO-REGULATION
]
]
end
to businesses-explore-cultural-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
cultural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by = []
]
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" businesses
and gains > 0
and preffor-cultural-resources >= ResourcesThreshold ; with high preference for natural resources
and perceptionoftpreffor-cultural-resources >= ResourcesThreshold
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
businesses-moves-to-underused-resources-NO-REGULATION
]
]
end
to businesses-moves-to-underused-resources-NO-REGULATION ;; turtle proceduere
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
set Tp count other-turtles-here with [breed = businesses and who >= TTN]
ifelse (Tp > 0)
[; one other phantom businesses is candidate to control the same patch
;type Tp print " other phantom businesse(s) on the patch"
businesses-internal-conflicts-analysis-NO-REGULATION ; --> partners
ifelse (partners != [])
[;there are partners
;search for the bigest businesses
set bigest max-one-of turtles-here with [breed = businesses and who >= TTN][energy];[size]
ifelse (who-of bigest = who-of myself)
[;i am the winer of all possible conflicts
ask other-turtles-here with [breed = businesses and who >= TTN]
[
without-interruption
[
if (member? label used-by-of patch-here)
[set used-by-of patch-here (remove label used-by-of patch-here)]
die
]
]
print-shiftsin-uses
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4); and who >= TTN
ifelse (TNp8 > 1)
[; there are other actual businesses arround the asked turtle
businesses-external-conflicts-analysis-NO-REGULATION
]
[; no other turtles arround
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
]
[;i am the loser of all possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-NO-REGULATION]
]
]
[;no partners
]
]
[;no other phantom turtle is candidate to use this patch
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4)
ifelse (TNp8 > 1)
[; there are other businesses arround the asked turtle
businesses-external-conflicts-analysis-NO-REGULATION
]
[; no other turtles arround
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
]
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-NO-REGULATION]
]
end
to businesses-internal-conflicts-analysis-NO-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
set Tp count other-turtles-here with [breed = businesses and Xi < 1 and who >= TTN]
set partners other-turtles-here with [breed = businesses and Xi < 1 and who >= TTN]
;if partners != []
if (Tp > 0)
[; other phantom businesses would not develop tourism
type Tp print " other phantom business(es) with different view on the patch"
type label ; type " (" type who type ")"
type " conflicts with "
type values-from partners [label]; defected-partners
type " to use " print patch-here
set conflict1 Tp;(conflict1 + Tp)
set conflict-with-B (conflict-with-B + Tp)
if (UnderUsedResources = "natural") [set conflictVn-with-B (conflictVn-with-B + Tp)]
if (UnderUsedResources = "cultural")[set conflictVc-with-B (conflictVc-with-B + Tp)]
ask partners
[
set defected-partners lput label-of myself defected-partners
set defected-partners remove-duplicates defected-partners
]
]
end
to businesses-external-conflicts-analysis-NO-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
set Tp count turtles with [(breed = businesses or breed = controllers or breed = gatekeepers)
and Xi < 1
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = businesses or breed = controllers or breed = gatekeepers)
and Xi < 1
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
;if partners != []
if (Tp > 0)
[;others arround would not develop tourism
set OTNp8 max-one-of turtles with [(breed = businesses or breed = controllers) and Xi < 1 and who < TTN]
in-radius (ResourcesDensity * 4)[energy]; [size]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible conflicts
type label ; type " (" type who type ")"
type " conflicts with "
type values-from partners [label]; defected-partners
type " to use " print patch-here
set conflict2 Tp; (conflict2 + Tp)
set conflict-with-R (conflict-with-R + count partners with [breed = controllers])
set conflict-with-B (conflict-with-B + count partners with [breed = businesses])
set conflict-with-G (conflict-with-G + count partners with [breed = gatekeepers])
if (UnderUsedResources = "natural")
[
set conflictVn-with-R (conflictVn-with-R + count partners with [breed = controllers])
set conflictVn-with-B (conflictVn-with-B + count partners with [breed = businesses])
set conflictVn-with-G (conflictVn-with-G + count partners with [breed = gatekeepers])
]
if (UnderUsedResources = "cultural")
[
set conflictVc-with-R (conflictVc-with-R + count partners with [breed = controllers])
set conflictVc-with-B (conflictVc-with-B + count partners with [breed = businesses])
set conflictVc-with-G (conflictVc-with-G + count partners with [breed = gatekeepers])
]
ask partners
[
set defected-partners lput label-of myself defected-partners
set defected-partners remove-duplicates defected-partners
]
;expand-preferences-ofbusinesses
set bigest max-one-of partners [energy];[size]
ifelse (energy-of myself > energy-of bigest)
[
print-shiftsin-uses
]
[
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-NO-REGULATION]
]
]
[;no conflict
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
]
if (member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5)
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
;if partners != []
ifelse (Tp > 0)
[;others have the same objective
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN]
in-radius (ResourcesDensity * 4) [energy]; [size]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible alliances
type label ; type " (" type who type ")"
type " cooperates with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation2 Tp;(cooperation2 + Tp)
set cooperation-with-R (cooperation-with-R + count partners with [breed = controllers])
set cooperation-with-B (cooperation-with-B + count partners with [breed = businesses])
set cooperation-with-G (cooperation-with-G + count partners with [breed = gatekeepers])
ask partners
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
[;no possible alliances
]
]
[;possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-NO-REGULATION]
]
]
end
to gatekeepers-attemptto-promote-underused-resources-NO-REGULATION
type "Gatekeepers are attempting to make more promoted the " print UnderUsedResources
if (UnderUsedResources = "natural") [gatekeepers-explore-natural-resources-NO-REGULATION]
if (UnderUsedResources = "cultural") [gatekeepers-explore-cultural-resources-NO-REGULATION]
if (UnderUsedResources = "natural&cultural") [gatekeepers-explore-undefined-resources-NO-REGULATION]
end
to gatekeepers-explore-undefined-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
(natural-resources >= ResourcesThreshold or cultural-resources >= ResourcesThreshold) ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and promoted-by = []
and (controlled-by != [] or used-by != [])
]
;show listof-patches-with-underused-resources
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" gatekeepers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
;show label
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
gatekeepers-moves-to-underused-resources-NO-REGULATION
]
]
end
to gatekeepers-explore-natural-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and promoted-by = []
and (controlled-by != [] or used-by != [])
]
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" gatekeepers
and gains > 0
and preffor-natural-resources >= ResourcesThreshold ; with high preference for natural resources
and perceptionoftpreffor-natural-resources >= ResourcesThreshold
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
gatekeepers-moves-to-underused-resources-NO-REGULATION
]
]
end
to gatekeepers-explore-cultural-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
cultural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and promoted-by = []
and (controlled-by != [] or used-by != [])
]
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" gatekeepers
and gains > 0
and preffor-cultural-resources >= ResourcesThreshold ; with high preference for natural resources
and perceptionoftpreffor-cultural-resources >= ResourcesThreshold
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
gatekeepers-moves-to-underused-resources-NO-REGULATION
]
]
end
to gatekeepers-moves-to-underused-resources-NO-REGULATION-old ;; turtle proceduere
locals [bigest TNp8 OTNp8 dis]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
;expand-preferences-ofgatekeepers
print-shiftsin-promotions
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-NO-REGULATION ]
]
end
to gatekeepers-moves-to-underused-resources-NO-REGULATION ;; turtle proceduere
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
set Tp count other-turtles-here with [breed = gatekeepers and who >= TTN]
ifelse (Tp > 0)
[; one other phantom gatekeepers is candidate to control the same patch
;type Tp print " other phantom businesse(s) on the patch"
gatekeepers-internal-conflicts-analysis-NO-REGULATION ; --> partners
ifelse (partners != [])
[;there are partners
;search for the bigest businesses
set bigest max-one-of turtles-here with [breed = gatekeepers and who >= TTN][size]
ifelse (who-of bigest = who-of myself)
[;i am the winer of all possible conflicts
ask other-turtles-here with [breed = gatekeepers and who >= TTN]
[
without-interruption
[
if (member? label promoted-by-of patch-here)
[set promoted-by-of patch-here (remove label promoted-by-of patch-here)]
die
]
]
print-shiftsin-promotions
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4); and who >= TTN
ifelse (TNp8 > 1)
[; there are other actual turtles arround the asked turtle
gatekeepers-external-conflicts-analysis-NO-REGULATION
]
[; no other turtles arround
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
]
[;i am the loser of all possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-NO-REGULATION]
]
]
[;no partners
]
]
[;no other phantom turtle is candidate to use this patch
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4)
ifelse (TNp8 > 1)
[; there are other gatekeepers arround the asked turtle
gatekeepers-external-conflicts-analysis-NO-REGULATION
]
[; no other turtles arround
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
]
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-NO-REGULATION]
]
end
to gatekeepers-internal-conflicts-analysis-NO-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
set Tp count other-turtles-here with [breed = gatekeepers and Xi < 1 and who >= TTN]
set partners other-turtles-here with [breed = gatekeepers and Xi < 1 and who >= TTN]
;if partners != []
if (Tp > 0)
[; other phantom gatekeepers would not develop tourism
type Tp print " other phantom gatekeepers(es) with different view on the patch"
type label ; type " (" type who type ")"
type " conflicts with "
type values-from partners [label]; defected-partners
type " to use " print patch-here
set conflict1 Tp;(conflict1 + Tp)
set conflict-with-G (conflict-with-G + Tp)
if (UnderUsedResources = "natural") [set conflictVn-with-G (conflictVn-with-G + Tp)]
if (UnderUsedResources = "cultural") [set conflictVc-with-G (conflictVc-with-G + Tp)]
ask partners
[
set defected-partners lput label-of myself defected-partners
set defected-partners remove-duplicates defected-partners
]
]
end
to gatekeepers-external-conflicts-analysis-NO-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
set Tp count turtles with [(breed = businesses or breed = controllers or breed = gatekeepers)
and Xi < 1
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = businesses or breed = controllers or breed = gatekeepers)
and Xi < 1
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
;if partners != []
if (Tp > 0)
[;others arround would not develop tourism
set OTNp8 max-one-of turtles with [(breed = businesses or breed = controllers or breed = gatekeepers) and Xi < 1 and who < TTN]
in-radius (ResourcesDensity * 4) [size]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible conflicts
type label ; type " (" type who type ")"
type " conflicts with "
type values-from partners [label]; defected-partners
type " to use " print patch-here
set conflict2 Tp; (conflict2 + Tp)
set conflict-with-R (conflict-with-R + count partners with [breed = controllers])
set conflict-with-B (conflict-with-B + count partners with [breed = businesses])
set conflict-with-G (conflict-with-G + count partners with [breed = gatekeepers])
if (UnderUsedResources = "natural")
[
set conflictVn-with-R (conflictVn-with-R + count partners with [breed = controllers])
set conflictVn-with-B (conflictVn-with-B + count partners with [breed = businesses])
set conflictVn-with-G (conflictVn-with-G + count partners with [breed = gatekeepers])
]
if (UnderUsedResources = "cultural")
[
set conflictVc-with-R (conflictVc-with-R + count partners with [breed = controllers])
set conflictVc-with-B (conflictVc-with-B + count partners with [breed = businesses])
set conflictVc-with-G (conflictVc-with-G + count partners with [breed = gatekeepers])
]
ask partners
[
set defected-partners lput label-of myself defected-partners
set defected-partners remove-duplicates defected-partners
]
;expand-preferences-ofgatekeepers
set bigest max-one-of partners [size]
ifelse (size-of myself > size-of bigest)
[
print-shiftsin-promotions
]
[
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-NO-REGULATION]
]
]
[;no conflict
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
]
if (member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5)
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
;if partners != []
ifelse (Tp > 0)
[;others have the same objective
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [size]
ifelse OTNp8 != nobody [set dis distance OTNp8] [set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible alliances
type label ; type " (" type who type ")"
type " could cooperate 2 with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation2 Tp;(cooperation2 + Tp)
set cooperation-with-R (cooperation-with-R + count partners with [breed = controllers])
set cooperation-with-B (cooperation-with-B + count partners with [breed = businesses])
set cooperation-with-G (cooperation-with-G + count partners with [breed = gatekeepers])
ask partners
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
[;no possibles alliances
]
]
[;possible conflict
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-NO-REGULATION]
]
]
end
to tourists-attemptto-visit-underused-resources-NO-REGULATION
locals [ta tb tc]
print "New tourists are attempting to find patches that match their expectations "
;set NTs count turtles with [breed = tourists and who >= TTN]
;set OTs count turtles with [breed = tourists and who < TTN]
set numof-unsatisfied-tourists 0
set KilledTourists 0
set HostCommunitiesConflicts 0
set avenumof-unsatisfied-communities 0
;set minnumof-unsatisfied-communities 0
;set maxnumof-unsatisfied-communities 0
;set ta count turtles with [breed = communities and who < TTN and Xi < 0]
setup-newtourists-preferences
ask turtles with [breed = tourists and who >= TTN]
[
without-interruption
[
set attempt 0
set score 0
move-to-upper-preferences
];close without
];close ask
set tb count turtles with [breed = tourists and who >= TTN and score > 0]
ifelse (tb > 0) [
set avenumof-unsatisfied-communities round (mean values-from turtles with [breed = tourists and who >= TTN][score])
;set minnumof-unsatisfied-communities round (min values-from turtles with [breed = tourists and who >= TTN][score])
;set maxnumof-unsatisfied-communities round (max values-from turtles with [breed = tourists and who >= TTN][score])
]
[
set avenumof-unsatisfied-communities 0
;set minnumof-unsatisfied-communities 0
;set maxnumof-unsatisfied-communities 0
]
;set tc count turtles with [breed = communities and who < TTN and Xi < 0]
;type (tc - ta) print " communities shift from 'neutral' to 'against' T evolution"
end
to setup-conflicts-and-cooperations-to-zero
set numof-conflictsVn-between-controllers-and-controllers 0
set numof-conflictsVn-between-controllers-and-businesses 0
set numof-conflictsVn-between-controllers-and-gatekeepers 0
set numof-conflictsVn-between-controllers-and-communities 0
set numof-conflictsVn-between-controllers-and-institutions 0
set numof-conflictsVn-between-businesses-and-controllers 0
set numof-conflictsVn-between-businesses-and-businesses 0
set numof-conflictsVn-between-businesses-and-gatekeepers 0
set numof-conflictsVn-between-businesses-and-communities 0
set numof-conflictsVn-between-businesses-and-institutions 0
set numof-conflictsVc-between-controllers-and-controllers 0
set numof-conflictsVC-between-controllers-and-businesses 0
set numof-conflictsVc-between-controllers-and-gatekeepers 0
set numof-conflictsVc-between-controllers-and-communities 0
set numof-conflictsVc-between-controllers-and-institutions 0
set numof-conflictsVc-between-businesses-and-controllers 0
set numof-conflictsVc-between-businesses-and-businesses 0
set numof-conflictsVc-between-businesses-and-gatekeepers 0
set numof-conflictsVc-between-businesses-and-communities 0
set numof-conflictsVc-between-businesses-and-institutions 0
ask turtles
[
without-interruption
[
set defected-partners []
set cooperative-partners []
set conflict1 0
set conflict2 0
set cooperation1 0
set cooperation2 0
set conflict-with-R 0
set conflict-with-B 0
set conflict-with-G 0
set cooperation-with-R 0
set cooperation-with-B 0
set cooperation-with-G 0
];without
];ask
end
to remove-duplicates-controls-uses-promotions
ask patches
[
without-interruption
[
set controlled-by remove-duplicates controlled-by
set used-by remove-duplicates used-by
set promoted-by remove-duplicates promoted-by
set visited-by remove-duplicates visited-by
set liked-by remove-duplicates liked-by
set supported-by remove-duplicates supported-by
set controlled-byw remove-duplicates controlled-byw
set used-byw remove-duplicates used-byw
set promoted-byw remove-duplicates promoted-byw
set visited-byw remove-duplicates visited-byw
set liked-byw remove-duplicates liked-byw
set supported-byw remove-duplicates supported-byw
]
]
end
to print-shiftsin-controls
locals [PNi PNf PNv]
set PNi count patches with [member? label-of myself controlled-by]
;ask patches in-radius (ResourcesDensity * size)
ask patch-here
[
without-interruption
[
set controlled-by lput label-of myself controlled-by
set controlled-byw lput myself controlled-byw
if who-of myself >= TTN [set plabel "r."]
]
]
set PNf count patches with [member? label-of myself controlled-by]
set new-active-patches PNf
set PNv (PNf - PNi)
if PNv > 0 [type label type " controls " type PNv type " patches more (" type PNf print ")"]
end
to print-shiftsin-uses
locals [PNi PNf PNv]
set PNi count patches with [member? label-of myself used-by]
;ifelse (resources-of patch-here < resources-preference);-of myself)
; [
; expand-preferences-ofbusinesses
; ]
; [
;ask patches in-radius (ResourcesDensity * size)
ask patch-here
[
without-interruption
[
set used-by lput label-of myself used-by
set used-byw lput myself used-byw
if who-of myself >= TTN [set plabel "b+"]
]
]
; ]
set PNf count patches with [member? label-of myself used-by]
set new-active-patches PNf
set PNv (PNf - PNi)
if PNv > 0 [type label type " uses " type PNv type " patches more (" type PNf print ")"]
end
to print-shiftsin-promotions
locals [PNi PNf PNv]
set PNi count patches with [member? label-of myself promoted-by]
;ask patches in-radius (ResourcesDensity * size)
ask patch-here
[
without-interruption
[
set promoted-by lput label-of myself promoted-by
set promoted-byw lput myself promoted-byw
if who-of myself >= TTN [set plabel "g*"]
]
]
set PNf count patches with [member? label-of myself promoted-by]
set new-active-patches PNf
set PNv (PNf - PNi)
if PNv > 0 [type label type " promotes " type PNv type " patches more (" type PNf print ")"]
end
to print-expand-shiftsin-controls
locals [PNi PNf PNv]
set PNi count patches with [member? label-of myself controlled-by]
ask patches in-radius (ResourcesDensity * size)
[
without-interruption
[
set controlled-by lput label-of myself controlled-by
set controlled-byw lput myself controlled-byw
if who-of myself >= TTN [set plabel "r."]
]
]
set PNf count patches with [member? label-of myself controlled-by]
set new-active-patches PNf
set PNv (PNf - PNi)
if PNv > 0 [type label type " controls " type PNv type " patches more (" type PNf print ")"]
end
to print-expand-shiftsin-uses
locals [PNi PNf PNv]
set PNi count patches with [member? label-of myself used-by]
;ifelse (resources-of patch-here < resources-preference);-of myself)
; [
; expand-preferences-ofbusinesses
; ]
; [
ask patches in-radius (ResourcesDensity * size)
[
without-interruption
[
set used-by lput label-of myself used-by
set used-byw lput myself used-byw
if who-of myself >= TTN [set plabel "b+"]
]
]
; ]
set PNf count patches with [member? label-of myself used-by]
set new-active-patches PNf
set PNv (PNf - PNi)
if PNv > 0 [type label type " uses " type PNv type " patches more (" type PNf print ")"]
end
to print-expand-shiftsin-promotions
locals [PNi PNf PNv]
set PNi count patches with [member? label-of myself promoted-by]
ask patches in-radius (ResourcesDensity * size)
[
without-interruption
[
set promoted-by lput label-of myself promoted-by
set promoted-byw lput myself promoted-byw
if who-of myself >= TTN [set plabel "g*"]
]
]
set PNf count patches with [member? label-of myself promoted-by]
set new-active-patches PNf
set PNv (PNf - PNi)
if PNv > 0 [type label type " promotes " type PNv type " patches more (" type PNf print ")"]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; TO BUILD INSTITUTIONS LEADED SCENARIOS (TOP DOWN REGULATION)
;; simulate controllers, businesses, and gatekeepers acting as institutions and them would like to see done (charter)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to build-topdown-regulated-scenarios
locals [w x y z]
;setup-user-input-parameters-1
if iteration = 0
[
set-current-plot "Controllers Behaviours"
clear-plot
set-current-plot "Businesses Behaviours"
clear-plot
set-current-plot "Gatekeepers Behaviours"
clear-plot
set-current-plot "Controllers Interactions"
clear-plot
set-current-plot "Businesses Interactions"
clear-plot
set-current-plot "Gatekeepers Interactions"
clear-plot
set-current-plot "Provisioned Resources"
clear-plot
set-current-plot "Used Resources"
clear-plot
set-current-plot "Promoted Resources"
clear-plot
set-current-plot "Visited Resources"
clear-plot
set-current-plot "Tourists Density"
clear-plot
set-current-plot "Tourists"
clear-plot
set-current-plot "Communities"
clear-plot
reset-phantoms
set TypeOfRegulation " policy"
setup-user-input-parameters-2
]
set TTN count turtles
setup-conflicts-and-cooperations-to-zero
do-plotting-conflicts-and-cooperations-RBG
do-bookkeeping-initial-patch-counts
print-initial-patch-counts2
do-plotting-behaviours-reg
while [iteration < Iterations] ; true
[
without-interruption
[
set iteration iteration + 1
type "No Regualtion scenario, iter " print iteration
remove-duplicates-controls-uses-promotions
do-TOPDOWN-REGULATION
do-bookkeeping-initial-patch-counts
print-initial-patch-counts2
do-plotting-conflicts-and-cooperations-RBG
do-plotting-behaviours-reg
set numof-unsatisfied-tourists 0
set avenumof-unsatisfied-communities 0
;set minnumof-unsatisfied-communities 0
;set maxnumof-unsatisfied-communities 0
set KilledTourists 0
type "End of iteration " print iteration
];without
];while
print-initial-situation
count-conflictsVn-amongRBGCI
; print-conflictsVn-amongRBGCI
count-conflictsVc-amongRBGCI
; print-conflictsVc-amongRBGCI
; reset-phantoms
; set a word "SPRITE-" country
; set b word a region
; set c word b event
; set d word c "resultsOfRegulation"
; set resfileN word d iteration
; export-world resfileN
set w word d "-AltRegS-R-"
set x word w UnderUsedResources
set y word x CollectiveObjective
; set z word y CollectiveObjective
set resfileN word y iteration
export-world resfileN
print "End of the simulations"
print "Save & Clear the Command Center"
end
to do-TOPDOWN-REGULATION
without-interruption
[
controllers-attemptto-control-underused-resources-TOPDOWN-REGULATION
businesses-attemptto-use-underused-resources-TOPDOWN-REGULATION
gatekeepers-attemptto-promote-underused-resources-TOPDOWN-REGULATION
tourists-attemptto-visit-underused-resources-TOPDOWN-REGULATION
setup-controllers-energy
setup-businesses-energy
setup-gatekeepers-energy
update-lorenz-and-gini-plots
if (BottomUpRegulation? = true) [simulate-dynamicsof-positions]
]
end
to controllers-attemptto-control-underused-resources-TOPDOWN-REGULATION
type "Controllers are attempting to make more available the " print UnderUsedResources
if (UnderUsedResources = "natural") [controllers-explore-natural-resources-TOPDOWN-REGULATION]
if (UnderUsedResources = "cultural") [controllers-explore-cultural-resources-TOPDOWN-REGULATION]
if (UnderUsedResources = "natural&cultural") [controllers-explore-undefined-resources-TOPDOWN-REGULATION]
end
to controllers-explore-undefined-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
(natural-resources >= ResourcesThreshold or cultural-resources >= ResourcesThreshold) ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by = []
and used-by = []
]
;show listof-patches-with-underused-resources
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
controllers-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to controllers-explore-natural-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by != []
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
controllers-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to controllers-explore-cultural-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by != []
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
controllers-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to controllers-moves-to-underused-resources-TOPDOWN-REGULATION ;; turtle proceduere
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
set Tp count other-turtles-here with [breed = controllers and who >= TTN]
ifelse (Tp > 0)
[; one other phantom controllers is candidate to control the same patch
controllers-internal-conflicts-analysis-TOPDOWN-REGULATION ; --> partners
ifelse (partners != [])
[;there are partners
;search for the bigest controllers
set bigest max-one-of turtles-here with [breed = controllers and who >= TTN][energy];[size]
ifelse (who-of bigest = who-of myself)
[;i am the winer of conflict but I have to respect others
;ask other-turtles-here with [breed = controllers and who >= TTN] [die]
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4)
ifelse (TNp8 > 1)
[; there are other actual controllers or businesses arround the asked turtle
controllers-external-conflicts-analysis-TOPDOWN-REGULATION
]
[; no other controllers arround
;expand-preferences-ofcontrollers
print-expand-shiftsin-controls
]
]
[;i am the loser of all possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-TOPDOWN-REGULATION]
]
]
[;no partners
]
]
[;no other phantom turtle is candidate to use this patch
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4); and who >= TTN
ifelse (TNp8 > 1)
[; there are other controllers or businesses arround the asked turtle
controllers-external-conflicts-analysis-TOPDOWN-REGULATION
]
[; no other controllers arround
;expand-preferences-ofcontrollers
print-expand-shiftsin-controls
]
]
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-TOPDOWN-REGULATION]
]
end
to controllers-internal-conflicts-analysis-TOPDOWN-REGULATION; to get other phantom controllers on the patch
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
ifelse CollectiveObjective = "all together"
[
set Tp count other-turtles-here with [breed = controllers and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
set partners other-turtles-here with [breed = controllers and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
]
[
set Tp count other-turtles-here with [breed = controllers and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
set partners other-turtles-here with [breed = controllers and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
]
;if partners != []
ifelse (Tp > 0)
[; other phantom has the same objectives
type label ; type " (" type who type ")"
type " cooperates 1 with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation1 Tp; (cooperation1 + Tp)
set cooperation-with-R (cooperation-with-R + Tp)
ask partners
[
without-interruption
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
]
;expand-preferences-ofcontrollers
print-shiftsin-controls
]
[;possible conflict
;see above
]
end
to controllers-external-conflicts-analysis-TOPDOWN-REGULATION; for other actual turtle around the patch
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
ifelse CollectiveObjective = "all together"
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
]
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
]
;if partners != []
ifelse (Tp > 0)
[;others have the same objective
ifelse CollectiveObjective = "all together"
[
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [size]
]
[
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [size]
]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible alliances
type label ; type " (" type who type ")"
type " cooperates with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation2 Tp;(cooperation2 + Tp)
set cooperation-with-R (cooperation-with-R + count partners with [breed = controllers])
set cooperation-with-B (cooperation-with-B + count partners with [breed = businesses])
set cooperation-with-G (cooperation-with-G + count partners with [breed = gatekeepers])
ask partners
[
without-interruption
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
]
;expand-preferences-ofcontrollers
print-shiftsin-controls
]
[;no possibles alliances
]
]
[;possible conflict
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-TOPDOWN-REGULATION]
]
end
to businesses-attemptto-use-underused-resources-TOPDOWN-REGULATION
type "Businesses are attempting to make more integrated the " print UnderUsedResources
if (UnderUsedResources = "natural") [businesses-explore-natural-resources-TOPDOWN-REGULATION]
if (UnderUsedResources = "cultural") [businesses-explore-cultural-resources-TOPDOWN-REGULATION]
if (UnderUsedResources = "natural&cultural") [businesses-explore-undefined-resources-TOPDOWN-REGULATION]
end
to businesses-explore-undefined-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by != []
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
businesses-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to businesses-explore-natural-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by != []
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
businesses-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to businesses-explore-cultural-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by != []
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
businesses-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to businesses-moves-to-underused-resources-TOPDOWN-REGULATION ;; turtle proceduere
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
set Tp count other-turtles-here with [breed = businesses and who >= TTN]
ifelse (Tp > 0)
[; one other phantom businesses is candidate to control the same patch
;type Tp print " other phantom businesse(s) on the patch"
businesses-internal-conflicts-analysis-TOPDOWN-REGULATION ; --> partners
ifelse (partners != [])
[;there are partners
;search for the bigest businesses
set bigest max-one-of turtles-here with [breed = businesses and who >= TTN][energy];[size]
ifelse (who-of bigest = who-of myself)
[;i am the winer of all possible conflicts but I have to respect others
;ask other-turtles-here with [breed = businesses and who >= TTN] [die]
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4); and who >= TTN
ifelse (TNp8 > 1)
[; there are other actual businesses arround the asked turtle
businesses-external-conflicts-analysis-TOPDOWN-REGULATION
]
[; no other businesses arround
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
]
[;i am the loser of all possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-TOPDOWN-REGULATION]
]
]
[;no partners
]
]
[;no other phantom turtle is candidate to use this patch
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4)
ifelse (TNp8 > 1)
[; there are other businesses arround the asked turtle
businesses-external-conflicts-analysis-TOPDOWN-REGULATION
]
[; no other businesses arround
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
]
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-TOPDOWN-REGULATION]
]
end
to businesses-internal-conflicts-analysis-TOPDOWN-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
ifelse CollectiveObjective = "all together"
[
set Tp count other-turtles-here with [breed = businesses and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
set partners other-turtles-here with [breed = businesses and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
]
[
set Tp count other-turtles-here with [breed = businesses and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
set partners other-turtles-here with [breed = businesses and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
]
;if partners != []
ifelse (Tp > 0)
[; other phantom has the same objectives
type label ; type " (" type who type ")"
type " could cooperate 1 with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation1 Tp; (cooperation1 + Tp)
set cooperation-with-B (cooperation-with-B + Tp)
ask partners
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
[;possible conflict
;see above
]
end
to businesses-external-conflicts-analysis-TOPDOWN-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
ifelse CollectiveObjective = "all together"
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
]
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
]
;if partners != []
ifelse (Tp > 0)
[;others have the same objective
ifelse CollectiveObjective = "all together"
[
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [energy]; [size]
]
[
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [energy]; [size]
]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible alliances
type label ; type " (" type who type ")"
type " cooperates with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation2 Tp;(cooperation2 + Tp)
set cooperation-with-R (cooperation-with-R + count partners with [breed = controllers])
set cooperation-with-B (cooperation-with-B + count partners with [breed = businesses])
set cooperation-with-G (cooperation-with-G + count partners with [breed = gatekeepers])
ask partners
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
[;no possible alliances
]
]
[;possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-TOPDOWN-REGULATION]
]
end
to gatekeepers-attemptto-promote-underused-resources-TOPDOWN-REGULATION
type "Gatekeepers are attempting to make more promoted the " print UnderUsedResources
if (UnderUsedResources = "natural") [gatekeepers-explore-natural-resources-TOPDOWN-REGULATION]
if (UnderUsedResources = "cultural") [gatekeepers-explore-cultural-resources-TOPDOWN-REGULATION]
if (UnderUsedResources = "natural&cultural") [gatekeepers-explore-undefined-resources-TOPDOWN-REGULATION]
end
to gatekeepers-explore-undefined-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and promoted-by = []
and (controlled-by != [] or used-by != [])
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to gatekeepers-explore-natural-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and promoted-by = []
and (controlled-by != [] or used-by != [])
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to gatekeepers-explore-cultural-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and promoted-by = []
and (controlled-by != [] or used-by != [])
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION-old ;; turtle proceduere
locals [bigest TNp8 OTNp8 dis]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[
;expand-preferences-ofgatekeepers
print-shiftsin-promotions
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION ]
]
end
to gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION ;; turtle proceduere
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
set Tp count other-turtles-here with [breed = gatekeepers and who >= TTN]
ifelse (Tp > 0)
[; one other phantom gatekeepers is candidate to control the same patch
;type Tp print " other phantom businesse(s) on the patch"
gatekeepers-internal-conflicts-analysis-TOPDOWN-REGULATION ; --> partners
ifelse (partners != [])
[;there are partners
;search for the bigest businesses
set bigest max-one-of turtles-here with [breed = gatekeepers and who >= TTN][size]
ifelse (who-of bigest = who-of myself)
[;i am the winer of all possible conflicts but I have to respect others
;ask other-turtles-here with [breed = gatekeepers and who >= TTN] [die]
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4); and who >= TTN
ifelse (TNp8 > 1)
[; there are other actual businesses arround the asked turtle
gatekeepers-external-conflicts-analysis-TOPDOWN-REGULATION
]
[; no other gatekeepers arround
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
]
[;i am the loser of all possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION]
]
]
[;no partners
]
]
[;no other phantom turtle is candidate to use this patch
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4)
ifelse (TNp8 > 1)
[; there are other gatekeepers arround the asked turtle
gatekeepers-external-conflicts-analysis-TOPDOWN-REGULATION
]
[; no other gatekeepers arround
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
]
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION]
]
end
to gatekeepers-internal-conflicts-analysis-TOPDOWN-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
ifelse CollectiveObjective = "all together"
[
set Tp count other-turtles-here with [breed = gatekeepers and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
set partners other-turtles-here with [breed = gatekeepers and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
]
[
set Tp count other-turtles-here with [breed = gatekeepers and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
set partners other-turtles-here with [breed = gatekeepers and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
]
;if partners != []
ifelse (Tp > 0)
[; other phantom has the same objectives
type label ; type " (" type who type ")"
type " could cooperate 1 with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation1 Tp; (cooperation1 + Tp)
set cooperation-with-G (cooperation-with-G + Tp)
ask partners
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
[;possible conflict
;see above
]
end
to gatekeepers-external-conflicts-analysis-TOPDOWN-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
ifelse CollectiveObjective = "all together"
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
]
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
]
;if partners != []
ifelse (Tp > 0)
[;others have the same objective
ifelse CollectiveObjective = "all together"
[
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [size]
]
[
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [size]
]
ifelse OTNp8 != nobody [set dis distance OTNp8] [set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible alliances
type label ; type " (" type who type ")"
type " could cooperate 2 with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation2 Tp;(cooperation2 + Tp)
set cooperation-with-R (cooperation-with-R + count partners with [breed = controllers])
set cooperation-with-B (cooperation-with-B + count partners with [breed = businesses])
set cooperation-with-G (cooperation-with-G + count partners with [breed = gatekeepers])
ask partners
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
[;no possibles alliances
]
]
[;possible conflict
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-TOPDOWN-REGULATION]
]
end
to tourists-attemptto-visit-underused-resources-TOPDOWN-REGULATION
locals [NTs NNTs OTs ONTs DNTs DONTs]
print "New tourists are attempting to find patches that match their expectations "
set NTs count turtles with [breed = tourists and who >= TTN]
set OTs count turtles with [breed = tourists and who < TTN]
set numof-unsatisfied-tourists 0
set KilledTourists 0
setup-newtourists-preferences
ask turtles with [breed = tourists and who >= TTN]
[
without-interruption
[
set attempt 0
move-to-upper-preferences
];close without
];close ask
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; GAME LEADED INTERACTIONS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-games
do-iterated-controllers-NPD
do-evolutionary-businesses-CG
do-evolutionary-gatekeepers-CG
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ITERATED N PRISONER'S DILEMMA
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-iterated-controllers-NPD
;; secondary setup procedures
set iteration 0
set-current-plot "Controllers Behaviours"
clear-plot
reset-count-games
reset-phantoms
set TTN count turtles; to be used to differentiate hatched ("phantom") turtles to actual turtles
show TTN
setup-more-controllers-NPD
store-initial-turtle-counts-NPD
setup-common-variables-NPD
;; runtime procedures
while [iteration < 500];(100 * Iterations)] ; true
[
do-iNPD
]
if num-cooperate-games > 0 [type "average payoff of cooperation (S1): " print precision (cooperate-score / (num-cooperate-games)) 1]
if num-defect-games > 0 [type "average payoff of defection (S2): " print precision (defect-score / (num-defect-games)) 1]
if num-unforgiving-games > 0 [type "average payoff of unforgiving (S3): " print precision (unforgiving-score / (num-unforgiving-games)) 1]
if num-tit-for-tat-games > 0 [type "average payoff of tit-for-tat (S4): " print precision (tit-for-tat-score / (num-tit-for-tat-games)) 1]
if num-suspicious-tft-games > 0 [type "average payoff of suspicious-tft (S5): " print precision (suspicious-tft-score / (num-suspicious-tft-games)) 1]
if num-trusting-ad-games > 0 [type "average payoff of trusting-ad (S6): " print precision (trusting-ad-score / (num-trusting-ad-games)) 1]
ask turtles with [breed = controllers and who >= TTN]
[;3 o ask
die
];3 c ask
set resfileN word "resultsOfRegulation-CPD-" iteration
export-world resfileN
print "End of the simulation of the CPD"
print "Save &Clear the Command Center"
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; secondary setup procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-more-controllers-NPD
locals [strategies-list dice]
set strategies-list ["defect" "tit-for-tat" "suspicious-tft" "unforgiving" "trusting-ad"]
ask turtles with [breed = controllers]
[;3 o ask
hatch (1 + round (Ri * Si))
[;o atch
set shape "default"
set size 1
ifelse (Xi = -1)
[
set strategy "defect" ;;defect always
]
[
ifelse (Ei = 12)
[set strategy "cooperate"] ;;cooperate always
[
set dice random-int-or-float 5 ;; will give 0, 1, 2, 3 or 4
set strategy item dice strategies-list
]
]
]; c hatch
];3 c ask
end
to store-initial-turtle-counts-NPD
set num-cooperate count turtles with [breed = controllers and who >= TTN and strategy = "cooperate"]
set num-defect count turtles with [breed = controllers and who >= TTN and strategy = "defect"]
set num-unforgiving count turtles with [breed = controllers and who >= TTN and strategy = "unforgiving"]
set num-tit-for-tat count turtles with [breed = controllers and who >= TTN and strategy = "tit-for-tat"]
set num-suspicious-tft count turtles with [breed = controllers and who >= TTN and strategy = "suspicious-tft"]
set num-trusting-ad count turtles with [breed = controllers and who >= TTN and strategy = "trusting-ad"]
type "num-cooperate positions (S1) : " print num-cooperate
type "num-defect positions (S2): " print num-defect
type "num-unforgiving positions (S3): " print num-unforgiving
type "num-tit-for-tat positions (S4): " print num-tit-for-tat
type "num-suspicious-tft (S5): " print num-suspicious-tft
type "num-trusting-ad (S6): " print num-trusting-ad
end
to setup-common-variables-NPD
ask turtles
[
set score 0
set defect-now? false
set partnered? false
set partner nobody
;rt random 360
;fd random (screen-edge-x + screen-edge-y)
]
ask turtles with [breed = controllers and who >= TTN]
[
rt random-int-or-float 360
fd random-int-or-float (screen-edge-x + screen-edge-y)
]
setup-history-lists ;;initialize PARTNER-HISTORY list in all turtles
end
;;initialize PARTNER-HISTORY list in all turtles
to setup-history-lists
locals [ default-history num-turtles ]
set num-turtles count turtles
set default-history [] ;;initialize the DEFAULT-HISTORY variable to be a list
;;create a list with NUM-TURTLE elements for storing partner histories
repeat num-turtles
[ set default-history (fput false default-history) ]
;;give each turtle a copy of this list for tracking partner histories
ask turtles ;with [breed = controllers]
[
set partner-history default-history
set cooperative-partners []
]
end
to reset-count-games
set num-cooperate-games 0
set cooperate-score 0
set num-cooperate-games 0
set num-defect-games 0
set defect-score 0
set num-defect-games 0
set num-unforgiving-games 0
set unforgiving-score 0
set num-unforgiving-games 0
set num-tit-for-tat-games 0
set tit-for-tat-score 0
set num-tit-for-tat-games 0
set num-suspicious-tft-games 0
set suspicious-tft-score 0
set num-suspicious-tft-games 0
set num-trusting-ad-games 0
set trusting-ad-score 0
set num-trusting-ad-games 0
end
to reset-phantoms
ask turtles with [who >= TTN][die]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; runtime procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-iNPD
locals [ partnered-turtles ]
without-interruption [ clear-last-round-NPD ]
set iteration iteration + 1
ask turtles with [breed = controllers and who >= TTN ]
[ partner-up-NPD ] ;;have turtles try to find a partner
set partnered-turtles turtles with [breed = controllers and who >= TTN and partnered? ]
ask partnered-turtles with [breed = controllers and who >= TTN]
[ select-action ] ;;all partnered turtles select action
ask partnered-turtles with [breed = controllers and who >= TTN]
[ play-a-round-NPD ]
do-bookkeeping-NPD
end
to clear-last-round-NPD
locals [ partnered-turtles ]
set partnered-turtles turtles with [breed = controllers and who >= TTN and partnered? ]
ask partnered-turtles with [breed = controllers and who >= TTN][ release-partners ]
end
;;release partner and turn around to leave
to release-partners
set partnered? false
set partner nobody
rt 180
;set label no-label
end
;;have turtles try to find a partner
;;This will be done using without-interruption.
;;This is so that other turtles can't act while one is trying to partner up.
;;Also, since other turtles that have already executed partner-up may have
;;caused the turtle executing partner-up to be partnered,
;;a check is needed to make sure the calling turtle isn't partnered.
to partner-up-NPD ;;turtle procedure
without-interruption
[ ;;we don't want other turtles acting
ifelse(not partnered?)
[ ;;make sure still not partnered
rt (random-int-or-float 90 - random-int-or-float 90) fd 1 ;;move around randomly
set partner random-one-of (turtles-at -1 0)
with [ breed = controllers and who >= TTN and not partnered? ]
if partner != nobody
[ ;;if successful grabbing a partner, partner up
set partnered? true
set (partnered?-of partner) true
;show partner
ask partner [ set partner myself ]
set heading 270 ;;face partner
set (heading-of partner) 90
]
]
[] ;;if partnered, don't do anything
]
end
;;choose an action based upon the strategy being played
to select-action ;;turtle procedure
if strategy = "cooperate" [ cooperate ]
if strategy = "defect" [ defect ]
if strategy = "tit-for-tat" [ tit-for-tat ]
if strategy = "unforgiving" [ unforgiving ]
if strategy = "suspicious-tft" [ suspicious-tft ]
if strategy = "trusting-ad" [ trusting-ad ]
end
to play-a-round-NPD ;;turtle procedure
get-payoff-NPD ;;calculate the payoff for this round
update-history ;;store the results for next time
end
;;calculate the payoff for this round and
;;display a label with that payoff.
to get-payoff-NPD
set partner-defected? defect-now?-of partner
ifelse partner-defected?
[
ifelse defect-now?
[
set score (score + 1)
set label 1 ;;P
]
[
set score (score + 0)
set label 0 ;;S
]
]
[
ifelse defect-now?
[
set score (score + 5 + (Si * Ri / 4))
set label 5 ;;T
]
[
set score (score + 3 + (0.5 * ((Si * Ri / 4) + (Si-of partner * Ri-of partner / 4))))
set label 3 ;;R
]
]
end
;;update PARTNER-HISTORY based upon the strategy being played
to update-history
if strategy = "cooperate" [ cooperate-history-update ]
if strategy = "defect" [ defect-history-update ]
if strategy = "tit-for-tat" [ tit-for-tat-history-update ]
if strategy = "unforgiving" [ unforgiving-history-update ]
if strategy = "suspicious-tft" [ suspicious-tft-history-update ]
if strategy = "trusting-ad" [ trusting-ad-history-update ]
end
;;;;;;;;;;;;;;;;
;;;Strategies;;;
;;;;;;;;;;;;;;;;
;;All the strategies are described in the Information Tab.
to cooperate
set num-cooperate-games num-cooperate-games + 1
set defect-now? false
set cooperative-partners (fput partner cooperative-partners)
end
to cooperate-history-update
;;uses no history- this is just for similarity with the other strategies
end
to defect
set num-defect-games num-defect-games + 1
set defect-now? true
end
to defect-history-update
;;uses no history- this is just for similarity with the other strategies
end
to trusting-ad
set num-trusting-ad-games num-trusting-ad-games + 1
ifelse (member? partner cooperative-partners)
[set defect-now? true]
[
set defect-now? false
set cooperative-partners (fput partner cooperative-partners)
]
end
to trusting-ad-history-update
set partner-history
(replace-item (who-of partner) partner-history partner-defected?)
end
to tit-for-tat
set num-tit-for-tat-games num-tit-for-tat-games + 1
set partner-defected? item (who-of partner) partner-history
ifelse (partner-defected?)
[set defect-now? true]
[
set defect-now? false
set cooperative-partners (fput partner cooperative-partners)
]
end
to tit-for-tat-history-update
set partner-history
(replace-item (who-of partner) partner-history partner-defected?)
end
to suspicious-tft
set num-suspicious-tft-games num-suspicious-tft-games + 1
set partner-defected? item (who-of partner) partner-history
ifelse (partner-defected?)
[set defect-now? true ]
[
ifelse (Xi = 1) ;Ei-of partner = 12)
[
set defect-now? false
set cooperative-partners (fput partner cooperative-partners)
]
[set defect-now? true ]
]
end
to suspicious-tft-history-update
set partner-history
(replace-item (who-of partner) partner-history partner-defected?)
end
to unforgiving
set num-unforgiving-games num-unforgiving-games + 1
set partner-defected? item (who-of partner) partner-history
ifelse (partner-defected? or defect-now?)
[set defect-now? true ]
[
set defect-now? false
set cooperative-partners (fput partner cooperative-partners)
]
end
to unforgiving-history-update
if partner-defected? [
set partner-history
(replace-item (who-of partner) partner-history partner-defected?)
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Plotting Procedures;;;
;;;;;;;;;;;;;;;;;;;;;;;;;
;;procedure called by go that calculates scores and plots
to do-bookkeeping-NPD
do-scoring
set-current-plot "Controllers Behaviours"
do-plotting-behaviours
end
to do-bookkeeping-BCG
do-scoring
set-current-plot "Businesses Behaviours"
do-plotting-behaviours
end
to do-bookkeeping-GCG
do-scoring
set-current-plot "Gatekeepers Behaviours"
do-plotting-behaviours
end
;;calculate the total scores of each strategy
to do-scoring
set cooperate-score (calc-score "cooperate" num-cooperate)
set defect-score (calc-score "defect" num-defect)
set tit-for-tat-score (calc-score "tit-for-tat" num-tit-for-tat)
set unforgiving-score (calc-score "unforgiving" num-unforgiving)
set suspicious-tft-score (calc-score "suspicious-tft" num-suspicious-tft)
set trusting-ad-score (calc-score "trusting-ad" num-trusting-ad)
end
;; returns the total score for a strategy if any turtles exist that are playing it
to-report calc-score [strategy-type num-with-strategy]
ifelse num-with-strategy > 0 [
report (sum values-from (turtles with [ strategy = strategy-type ]) [ score ])
] [
report 0
]
end
;;if a strategy has had any interactions, plot the avereage score per interaction
to do-plotting-behaviours
;set-current-plot "Controllers Behaviours"
if num-defect-games > 0 [
set-current-plot-pen "defect"
plot defect-score / (num-defect-games)
]
if num-cooperate-games > 0 [
set-current-plot-pen "cooperate"
plot cooperate-score / (num-cooperate-games)
]
if num-tit-for-tat-games > 0 [
set-current-plot-pen "tit-for-tat"
plot tit-for-tat-score / (num-tit-for-tat-games)
]
if num-unforgiving-games > 0 [
set-current-plot-pen "unforgiving"
plot unforgiving-score / (num-unforgiving-games)
]
if num-suspicious-tft-games > 0 [
set-current-plot-pen "suspicious-tft"
plot suspicious-tft-score / (num-suspicious-tft-games)
]
if num-trusting-ad-games > 0 [
set-current-plot-pen "trusting-ad"
plot trusting-ad-score / (num-trusting-ad-games)
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; EVOLUTIONARY BUSINESS CHICKEN GAME
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-evolutionary-businesses-CG
;; secondary setup procedures
set iteration 0
set-current-plot "Businesses Behaviours"
clear-plot
reset-count-games
reset-phantoms
setup-more-businesses-BCG
store-initial-turtle-counts-of-BCG
setup-common-variables-of-BCG
do-bookkeeping-BCG
;; runtime procedures
while [iteration < 500] ;(100 * Iterations)] ; true
[
do-iBCG
]
if num-cooperate-games > 0 [type "average payoff of cooperation (S1): " print precision (cooperate-score / (num-cooperate-games)) 1]
if num-defect-games > 0 [type "average payoff of defection (S2): " print precision (defect-score / (num-defect-games)) 1]
if num-unforgiving-games > 0 [type "average payoff of unforgiving (S3): " print precision (unforgiving-score / (num-unforgiving-games)) 1]
if num-tit-for-tat-games > 0 [type "average payoff of tit-for-tat (S4): " print precision (tit-for-tat-score / (num-tit-for-tat-games)) 1]
if num-suspicious-tft-games > 0 [type "average payoff of suspicious-tft (S5): " print precision (suspicious-tft-score / (num-suspicious-tft-games)) 1]
if num-trusting-ad-games > 0 [type "average payoff of trusting-ad (S6): " print precision (trusting-ad-score / (num-trusting-ad-games)) 1]
ask turtles with [(breed = businesses) and who >= TTN]
[;3 o ask
die
];3 c ask
set resfileN word "resultsOfRegulation-CPD-" iteration
export-world resfileN
print "End of the simulation of the BCG"
print "Save &Clear the Command Center"
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; secondary setup procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-more-businesses-BCG
locals [strategies-list dice]
set strategies-list ["defect" "tit-for-tat" "suspicious-tft" "unforgiving" "trusting-ad"]
ask turtles with [breed = businesses]
[;3 o ask
hatch (1 + round (Ri * Si))
[;o atch
set shape "default"
set size 1
ifelse (Xi = -1)
[
set strategy "defect" ;;defect always
]
[
ifelse (Ei = 12)
[set strategy "cooperate"] ;;cooperate always
[
set dice random-int-or-float 5 ;; will give 0, 1, 2, 3 or 4
set strategy item dice strategies-list
]
]
]; c hatch
];3 c ask
end
to store-initial-turtle-counts-of-BCG
set num-cooperate count turtles with [(breed = businesses) and who >= TTN and strategy = "cooperate"]
set num-defect count turtles with [(breed = businesses) and who >= TTN and strategy = "defect"]
set num-unforgiving count turtles with [(breed = businesses) and who >= TTN and strategy = "unforgiving"]
set num-tit-for-tat count turtles with [(breed = businesses) and who >= TTN and strategy = "tit-for-tat"]
set num-suspicious-tft count turtles with [(breed = businesses) and who >= TTN and strategy = "suspicious-tft"]
set num-trusting-ad count turtles with [(breed = businesses) and who >= TTN and strategy = "trusting-ad"]
type "num-cooperate positions (S1) : " print num-cooperate
type "num-defect positions (S2): " print num-defect
type "num-unforgiving positions (S3): " print num-unforgiving
type "num-tit-for-tat positions (S4): " print num-tit-for-tat
type "num-suspicious-tft (S5): " print num-suspicious-tft
type "num-trusting-ad (S6): " print num-trusting-ad
end
to setup-common-variables-of-BCG
ask turtles
[
set score 0
set defect-now? false
set partnered? false
set partner nobody
;rt random 360
;fd random (screen-edge-x + screen-edge-y)
]
ask turtles with [(breed = businesses) and who >= TTN]
[
rt random-int-or-float 360
fd random-int-or-float (screen-edge-x + screen-edge-y)
]
setup-history-lists ;;initialize PARTNER-HISTORY list in all turtles
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; runtime procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-iBCG
locals [ partnered-turtles ]
without-interruption [ clear-last-round-BCG ]
set iteration iteration + 1
ask turtles with [(breed = businesses) and who >= TTN ]
[ partner-up-BCG ] ;;have turtles try to find a partner
set partnered-turtles turtles with [(breed = businesses) and who >= TTN and partnered? ]
ask partnered-turtles with [(breed = businesses) and who >= TTN]
[ select-action ] ;;all partnered turtles select action
ask partnered-turtles with [(breed = businesses) and who >= TTN]
[ play-a-round-CG ]
do-bookkeeping-BCG
end
to clear-last-round-BCG
locals [ partnered-turtles ]
set partnered-turtles turtles with [(breed = businesses) and who >= TTN and partnered? ]
ask partnered-turtles with [(breed = businesses) and who >= TTN][ release-partners ]
end
;;have turtles try to find a partner
;;This will be done using without-interruption.
;;This is so that other turtles can't act while one is trying to partner up.
;;Also, since other turtles that have already executed partner-up may have
;;caused the turtle executing partner-up to be partnered,
;;a check is needed to make sure the calling turtle isn't partnered.
to partner-up-BCG ;;turtle procedure
without-interruption
[ ;;we don't want other turtles acting
ifelse(not partnered?)
[ ;;make sure still not partnered
rt (random-int-or-float 90 - random-int-or-float 90) fd 1 ;;move around randomly
set partner random-one-of (turtles-at -1 0)
with [ (breed = businesses) and who >= TTN and not partnered? ]
if partner != nobody
[ ;;if successful grabbing a partner, partner up
set partnered? true
set (partnered?-of partner) true
;show partner
ask partner [ set partner myself ]
set heading 270 ;;face partner
set (heading-of partner) 90
]
]
[] ;;if partnered, don't do anything
]
end
to play-a-round-CG ;;turtle procedure
get-payoff-CG ;;calculate the payoff for this round
update-history ;;store the results for next time
end
;;calculate the payoff for this round and
;;display a label with that payoff.
to get-payoff-CG
set partner-defected? defect-now?-of partner
ifelse partner-defected?
[
ifelse defect-now?
[
set score (score - 1)
set label -1 ;;P
]
[
set score (score + 2)
set label 2 ;;S
]
]
[
ifelse defect-now?
[
set score (score + 4 + (Si * Ri / 4))
set label 4 ;;T
]
[
set score (score + 3 + (0.5 * ((Si * Ri / 4) + (Si-of partner * Ri-of partner / 4))))
set label 3 ;;R
]
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; EVOLUTIONARY GATEKEEPERS CHICKEN GAME
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-evolutionary-gatekeepers-CG
;; secondary setup procedures
set iteration 0
set-current-plot "Gatekeepers Behaviours"
clear-plot
reset-count-games
reset-phantoms
setup-more-gatekeepers-GCG
store-initial-turtle-counts-of-GCG
setup-common-variables-of-GCG
do-bookkeeping-GCG
;; runtime procedures
while [iteration < 500] ;(100 * Iterations)] ; true
[
do-iGCG
]
if num-cooperate-games > 0 [type "average payoff of cooperation (S1): " print precision (cooperate-score / (num-cooperate-games)) 1]
if num-defect-games > 0 [type "average payoff of defection (S2): " print precision (defect-score / (num-defect-games)) 1]
if num-unforgiving-games > 0 [type "average payoff of unforgiving (S3): " print precision (unforgiving-score / (num-unforgiving-games)) 1]
if num-tit-for-tat-games > 0 [type "average payoff of tit-for-tat (S4): " print precision (tit-for-tat-score / (num-tit-for-tat-games)) 1]
if num-suspicious-tft-games > 0 [type "average payoff of suspicious-tft (S5): " print precision (suspicious-tft-score / (num-suspicious-tft-games)) 1]
if num-trusting-ad-games > 0 [type "average payoff of trusting-ad (S6): " print precision (trusting-ad-score / (num-trusting-ad-games)) 1]
ask turtles with [(breed = gatekeepers) and who >= TTN]
[;3 o ask
die
];3 c ask
set resfileN word "resultsOfRegulation-GCG" iteration
export-world resfileN
print "End of the simulation of the GCG"
print "Save &Clear the Command Center"
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; secondary setup procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-more-gatekeepers-GCG
locals [strategies-list dice]
set strategies-list ["defect" "tit-for-tat" "suspicious-tft" "unforgiving" "trusting-ad"]
ask turtles with [breed = gatekeepers]
[;3 o ask
hatch (1 + round (Ri * Si))
[;o atch
set shape "default"
set size 1
ifelse (Xi = -1)
[
set strategy "defect" ;;defect always
]
[
ifelse (Ei = 12)
[set strategy "cooperate"] ;;cooperate always
[
set dice random-int-or-float 5 ;; will give 0, 1, 2, 3 or 4
set strategy item dice strategies-list
]
]
]; c hatch
];3 c ask
end
to store-initial-turtle-counts-of-GCG
set num-cooperate count turtles with [(breed = gatekeepers) and who >= TTN and strategy = "cooperate"]
set num-defect count turtles with [(breed = gatekeepers) and who >= TTN and strategy = "defect"]
set num-unforgiving count turtles with [(breed = gatekeepers) and who >= TTN and strategy = "unforgiving"]
set num-tit-for-tat count turtles with [(breed = gatekeepers) and who >= TTN and strategy = "tit-for-tat"]
set num-suspicious-tft count turtles with [(breed = gatekeepers) and who >= TTN and strategy = "suspicious-tft"]
set num-trusting-ad count turtles with [(breed = gatekeepers) and who >= TTN and strategy = "trusting-ad"]
type "num-cooperate positions (S1) : " print num-cooperate
type "num-defect positions (S2): " print num-defect
type "num-unforgiving positions (S3): " print num-unforgiving
type "num-tit-for-tat positions (S4): " print num-tit-for-tat
type "num-suspicious-tft (S5): " print num-suspicious-tft
type "num-trusting-ad (S6): " print num-trusting-ad
end
to setup-common-variables-of-GCG
ask turtles
[
set score 0
set defect-now? false
set partnered? false
set partner nobody
;rt random 360
;fd random (screen-edge-x + screen-edge-y)
]
ask turtles with [(breed = gatekeepers) and who >= TTN]
[
rt random-int-or-float 360
fd random-int-or-float (screen-edge-x + screen-edge-y)
]
setup-history-lists ;;initialize PARTNER-HISTORY list in all turtles
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; runtime procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-iGCG
locals [ partnered-turtles ]
without-interruption [ clear-last-round-GCG ]
set iteration iteration + 1
ask turtles with [(breed = gatekeepers) and who >= TTN ]
[ partner-up-GCG ] ;;have turtles try to find a partner
set partnered-turtles turtles with [(breed = gatekeepers) and who >= TTN and partnered? ]
ask partnered-turtles with [(breed = gatekeepers) and who >= TTN]
[ select-action ] ;;all partnered turtles select action
ask partnered-turtles with [(breed = gatekeepers) and who >= TTN]
[ play-a-round-CG ]
do-bookkeeping-GCG
end
to clear-last-round-GCG
locals [ partnered-turtles ]
set partnered-turtles turtles with [(breed = gatekeepers) and who >= TTN and partnered? ]
ask partnered-turtles with [(breed = gatekeepers) and who >= TTN][ release-partners ]
end
;;have turtles try to find a partner
;;This will be done using without-interruption.
;;This is so that other turtles can't act while one is trying to partner up.
;;Also, since other turtles that have already executed partner-up may have
;;caused the turtle executing partner-up to be partnered,
;;a check is needed to make sure the calling turtle isn't partnered.
to partner-up-GCG ;;turtle procedure
without-interruption
[ ;;we don't want other turtles acting
ifelse(not partnered?)
[ ;;make sure still not partnered
rt (random-int-or-float 90 - random-int-or-float 90) fd 1 ;;move around randomly
set partner random-one-of (turtles-at -1 0)
with [ (breed = gatekeepers) and who >= TTN and not partnered? ]
if partner != nobody
[ ;;if successful grabbing a partner, partner up
set partnered? true
set (partnered?-of partner) true
;show partner
ask partner [ set partner myself ]
set heading 270 ;;face partner
set (heading-of partner) 90
]
]
[] ;;if partnered, don't do anything
]
end
;;;;;;;;;;;;;;;;;;;;;;;;
;; Plotting Functions ;;
;;;;;;;;;;;;;;;;;;;;;;;;
to do-plotting-positions
set-current-plot "Positions"
set-current-plot-pen "BusinessesFor"
plot BusinessesFor
set-current-plot-pen "BusinessesAgainst"
plot BusinessesAgainst
set-current-plot-pen "CommunitiesFor"
plot CommunitiesFor
set-current-plot-pen "CommunitiesAgainst"
plot CommunitiesAgainst
end
to do-plotting-cooperations2
set-current-plot "Controllers Behaviours"
set-current-plot-pen "cooperate"
plot CoopControllers
set-current-plot "Businesses Behaviours"
set-current-plot-pen "cooperate"
plot CoopBusinesses
set-current-plot "Gatekeepers Behaviours"
set-current-plot-pen "cooperate"
plot CoopGatekeepers
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Calculation Functions ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;to-report impact [otherTurtle] ;; turtle procedure
; ;; report the impact of otherTurtle on myself
; locals [d]
; set d distance otherTurtle
; if (d = 0) [set d 1 ] ; 1 = self-distance
; ;; (exp ((ln d) * exponent)) calculates d to the power 'exponent'
; report square strength / (exp ((ln d) * 2)) ; 2 = exponent
;end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; *** Regulation Model Copyright Notice ***
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This model was created as part of the SPRITE project
; These projects gratefully acknowledge the support of the
; European Union -- grant numbers
; ...
;
; Copyright 2003 by Jean-Paul Bousset. All rights reserved.
;
; Permission to use, modify or redistribute this model is hereby granted,
; provided that both of the following requirements are followed:
; a) this copyright notice is included.
; b) this model will not be redistributed for profit without permission
; from the copyright holders.
; Contact the copyright holders for appropriate licenses for redistribution
; for profit.
;
; To refer to this model in academic publications, please use:
; Bousset, J-P. (2003). Negotiation model, SPRITE project,
; Cemagref, 24 av. des Landais,
; 63200 Aubiere, France.
;
; *** End of SPRITE Regulation Model Copyright Notice ***
@#$#@#$#@
GRAPHICS-WINDOW
463
10
969
537
15
15
16.0
1
10
1
1
1
0
1
1
1
CC-WINDOW
5
799
1222
894
Command Center
0
BUTTON
973
12
1113
47
run N-iterated games
do-games
NIL
1
T
OBSERVER
T
NIL
BUTTON
4
10
64
44
setup
setup
NIL
1
T
OBSERVER
T
NIL
CHOOSER
3
118
178
163
UnderUsedResources
UnderUsedResources
"natural&cultural" "natural" "cultural"
0
SLIDER
5
82
179
115
ResourcesDensity
ResourcesDensity
1
2
1.0
0.1
1
NIL
CHOOSER
180
119
464
164
CollectiveObjective
CollectiveObjective
"more provision of resources" "more quality of resources" "more supply of tourism products & services" "more promotion of place and products" "all together"
4
PLOT
972
49
1211
213
Controllers Behaviours
Iteration
PayOff
0.0
10.0
0.0
5.0
true
true
PENS
"cooperate" 1.0 0 -10899396 true
"defect" 1.0 0 -13345367 true
"tit-for-tat" 1.0 0 -2674135 true
"unforgiving" 1.0 0 -11221820 true
"suspicious-tft" 1.0 0 -16777216 true
"trusting-ad" 1.0 2 -8630108 true
SLIDER
348
83
461
116
Iterations
Iterations
1
20
10
1
1
NIL
PLOT
972
214
1211
377
Businesses Behaviours
Iteration
PayOff
0.0
10.0
0.0
5.0
true
true
PENS
"cooperate" 1.0 0 -10899396 true
"defect" 1.0 0 -13345367 true
"tit-for-tat" 1.0 0 -2674135 true
"unforgiving" 1.0 0 -11221820 true
"suspicious-tft" 1.0 0 -16777216 true
"trusting-ad" 1.0 2 -8630108 true
PLOT
972
378
1211
542
Gatekeepers Behaviours
Iteration
PayOff
0.0
10.0
0.0
5.0
true
true
PENS
"cooperate" 1.0 0 -10899396 true
"defect" 1.0 0 -13345367 true
"tit-for-tat" 1.0 0 -2674135 true
"unforgiving" 1.0 0 -11221820 true
"suspicious-tft" 1.0 0 -16777216 true
"trusting-ad" 1.0 2 -8630108 true
PLOT
1
166
246
333
Provisioned Resources
Iteration
Patches
0.0
10.0
0.0
100.0
true
true
PENS
"Natural" 1.0 0 -10899396 true
"Cultural" 1.0 0 -8630108 true
"Social" 1.0 0 -11221820 true
"Economic" 1.0 0 -2674135 true
PLOT
2
333
245
495
Used Resources
Iteration
Patches
0.0
10.0
0.0
100.0
true
true
PENS
"Natural" 1.0 0 -10899396 true
"Cultural" 1.0 0 -8630108 true
"Social" 1.0 0 -11221820 true
"Economic" 1.0 0 -2674135 true
PLOT
4
495
244
658
Promoted Resources
Iteration
Patches
0.0
10.0
0.0
100.0
true
true
PENS
"Natural" 1.0 0 -10899396 true
"Cultural" 1.0 0 -8630108 true
"Social" 1.0 0 -11221820 true
"Economic" 1.0 0 -2674135 true
PLOT
4
659
243
783
Visited Resources
Iteration
Patches
0.0
10.0
0.0
100.0
true
true
PENS
"Natural" 1.0 0 -10899396 true
"Cultural" 1.0 0 -8630108 true
"Social" 1.0 0 -11221820 true
"Economic" 1.0 0 -2674135 true
PLOT
245
660
465
783
Tourists Density
Iteration
Visists
0.0
10.0
0.0
1.0
true
true
PENS
"Natural" 1.0 0 -10899396 true
"Cultural" 1.0 0 -8630108 true
"Social" 1.0 0 -11221820 true
"Economic" 1.0 0 -2674135 true
BUTTON
67
10
256
44
simulate market-like evolution
build-no-regulated-scenarios
NIL
1
T
OBSERVER
T
NIL
SLIDER
4
47
179
80
ResourcesThreshold
ResourcesThreshold
0.1
0.9
0.5
0.1
1
NIL
SLIDER
348
47
462
80
NewTourists
NewTourists
10
50
20
10
1
NIL
BUTTON
257
10
462
44
simulate regulation
build-topdown-regulated-scenarios
NIL
1
T
OBSERVER
T
NIL
PLOT
465
660
670
784
Tourists
Iteration
Tourists
0.0
10.0
0.0
10.0
true
true
PENS
"Unsatisf" 1.0 0 -10899396 true
PLOT
245
332
465
495
Businesses Interactions
Iteration
Interaction
0.0
10.0
0.0
10.0
true
true
PENS
"conflict-G" 1.0 0 -2674135 true
"conflict-B" 1.0 0 -6459832 true
"conflict-R" 1.0 0 -16777216 true
"cooperate-R" 1.0 0 -10899396 true
"cooperate-B" 1.0 0 -13791810 true
"cooperate-G" 1.0 0 -8630108 true
PLOT
244
165
464
333
Controllers Interactions
Iteration
Interaction
0.0
10.0
0.0
10.0
true
true
PENS
"conflict-G" 1.0 0 -2674135 true
"conflict-B" 1.0 0 -6459832 true
"conflict-R" 1.0 0 -16777216 true
"cooperate-R" 1.0 0 -10899396 true
"cooperate-B" 1.0 0 -13791810 true
"cooperate-G" 1.0 0 -8630108 true
PLOT
245
495
465
660
Gatekeepers Interactions
Iteration
Interaction
0.0
10.0
0.0
10.0
true
true
PENS
"conflict-R" 1.0 0 -2674135 true
"conflict-B" 1.0 0 -6459832 true
"conflict-G" 1.0 0 -16777216 true
"cooperate-R" 1.0 0 -10899396 true
"cooperate-B" 1.0 0 -13791810 true
"cooperate-G" 1.0 0 -8630108 true
SLIDER
182
48
346
81
TouristsDensityEvolution
TouristsDensityEvolution
1
3
2.0
0.1
1
NIL
PLOT
969
545
1212
665
Scale (Lorenz Curve)
Actors %
Energy %
0.0
100.0
0.0
100.0
false
true
PENS
"gatekeepers" 1.0 0 -13791810 true
"controllers" 1.0 0 -16777216 true
"businesses" 1.0 0 -2674135 true
PLOT
970
665
1213
785
Scale (Gini Index)
Iteration
Gini
0.0
10.0
0.0
1.0
true
true
PENS
"gatekeepers" 1.0 0 -13791810 true
"controllers" 1.0 0 -16777216 true
"businesses" 1.0 0 -2674135 true
PLOT
465
539
670
661
Communities
Iteration
Communities
0.0
10.0
0.0
10.0
true
true
PENS
"Conflict" 1.0 0 -2674135 true
"Ccon" 1.0 0 -16777216 true
"Cfor" 1.0 0 -10899396 true
"Cneu" 1.0 0 -13345367 true
SWITCH
182
83
347
116
BottomUpRegulation?
BottomUpRegulation?
0
1
-1000
@#$#@#$#@
bzzzz
@#$#@#$#@
default
true
0
Polygon -7500403 true true 150 5 40 250 150 205 260 250
boy-shape
false
0
Circle -7500403 true true 107 15 84
Line -7500403 true 150 75 150 224
Line -7500403 true 150 150 74 135
Line -7500403 true 150 149 224 135
Line -7500403 true 150 224 195 284
Line -7500403 true 150 226 105 284
circle
true
0
Circle -7500403 true true 35 35 230
cow
false
0
Polygon -7500403 true true 57 141 134 122 209 122 245 140 228 170 168 190 106 186 62 179 49 166
Polygon -7500403 true true 71 178 53 266 68 271 82 176
Polygon -7500403 true true 76 194 81 267 96 265 85 178
Polygon -7500403 true true 196 177 178 262 193 262 208 170
Polygon -7500403 true true 204 183 212 257 227 254 213 166
Polygon -7500403 true true 231 134 243 111 214 100 202 123
Polygon -7500403 true true 213 100 274 123 285 97 260 84 252 65 232 56 212 56 205 68 207 92 225 101
Polygon -7500403 true true 56 139 30 188 51 161
line
true
0
Line -7500403 true 150 0 150 301
organisation-shape
false
14
Line -11221820 false 14 17 285 17
Line -11221820 false 13 16 13 286
Line -11221820 false 12 286 284 286
Line -11221820 false 284 17 284 287
person
false
0
Circle -7500403 true true 155 20 63
Rectangle -7500403 true true 158 79 217 164
Polygon -7500403 true true 158 81 110 129 131 143 158 109 165 110
Polygon -7500403 true true 216 83 267 123 248 143 215 107
Polygon -7500403 true true 167 163 145 234 183 234 183 163
Polygon -7500403 true true 195 163 195 233 227 233 206 159
@#$#@#$#@
NetLogo 3.0beta3
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@
;; SPRITE Regulation Model
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Variable and Breed declarations
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
globals [
country
region
event
a b c d
datafile
resfile0
resfileN
iteration
attempt
TTN ; total turtles number
TPNGat ; total gatekeepers
TPNRes ; total controllers
TPNBus ; total businesses
GiniIndex
MeanLevelOfResources
MeanLevelOfNaturalResources
MeanLevelOfCulturalResources
MeanLevelOfSocialResources
MeanLevelOfEconomicResources
MeanLevelOfTouristsDensity
MaxTouristsDensity
MeanLevelOfTPrefforNaturalResources
MeanLevelOfTPrefforCulturalResources
MeanLevelOfTPrefforSocialResources
MeanLevelOfTPrefforEconomicResources
MeanLevelOfRBGPrefforNaturalResources
MeanLevelOfRBGPrefforCulturalResources
MeanLevelOfRBGPrefforSocialResources
MeanLevelOfRBGPrefforEconomicResources
MeanLevelOfRBGPerceptOfPrefforNaturalResources
MeanLevelOfRBGPerceptOfPrefforCulturalResources
MeanLevelOfRBGPerceptOfPrefforSocialResources
MeanLevelOfRBGPerceptOfPrefforEconomicResources
blast-radius
listof-patches-with-underused-resources
listof-turtles-with-same-profile
collective-build-in-goal
numof-controlled-patches
numof-used-patches
numof-promoted-patches
numof-visited-patches
numof-controlled-patcheswith-natural-resources
numof-controlled-patcheswith-cultural-resources
numof-controlled-patcheswith-social-resources
numof-controlled-patcheswith-economic-resources
numof-used-patcheswith-natural-resources
numof-used-patcheswith-cultural-resources
numof-used-patcheswith-social-resources
numof-used-patcheswith-economic-resources
numof-promoted-patcheswith-natural-resources
numof-promoted-patcheswith-cultural-resources
numof-promoted-patcheswith-social-resources
numof-promoted-patcheswith-economic-resources
numof-visited-patcheswith-natural-resources
numof-visited-patcheswith-cultural-resources
numof-visited-patcheswith-social-resources
numof-visited-patcheswith-economic-resources
numof-visitorsof-patcheswith-natural-resources
numof-visitorsof-patcheswith-cultural-resources
numof-visitorsof-patcheswith-social-resources
numof-visitorsof-patcheswith-economic-resources
numof-unsatisfied-tourists
avenumof-unsatisfied-communities
;minnumof-unsatisfied-communities
;maxnumof-unsatisfied-communities
HostCommunitiesConflicts
;;;;;;;;;; for sitsim ;;;;;;;;;;;;;
BusinessesFor ;; number of white turtles
BusinessesAgainst ;; number of black turtles
Communitiesfor ;; number of white turtles
CommunitiesAgainst ;; number of black turtles
changed? ;; has any turtle changed its colour?
Rfor
Rneu
Rcon
Bfor
Bneu
Bcon
Gfor
Gneu
Gcon
Cfor
Cneu
Ccon
;;;;;;;;;; for iterated NPD ;;;;;;;;;;;;;
;num-turtles-controllers
num-cooperate
num-defect
num-tit-for-tat
num-unforgiving
num-suspicious-tft
num-trusting-ad
;;number of interactions by each strategy
num-cooperate-games
num-defect-games
num-tit-for-tat-games
num-unforgiving-games
num-suspicious-tft-games
num-trusting-ad-games
;;total score of all turtles playing each strategy
cooperate-score
defect-score
tit-for-tat-score
unforgiving-score
suspicious-tft-score
trusting-ad-score
;;;;;;;;;; base scenario ;;;;;;;;;;;;;
px
xpartners
xTp
numof-conflictsVn-between-controllers-and-controllers
numof-conflictsVn-between-controllers-and-businesses
numof-conflictsVn-between-controllers-and-gatekeepers
numof-conflictsVn-between-controllers-and-communities
numof-conflictsVn-between-controllers-and-institutions
numof-conflictsVn-between-businesses-and-controllers
numof-conflictsVn-between-businesses-and-businesses
numof-conflictsVn-between-businesses-and-gatekeepers
numof-conflictsVn-between-businesses-and-communities
numof-conflictsVn-between-businesses-and-institutions
numof-conflictsVn-between-gatekeepers-and-controllers
numof-conflictsVn-between-gatekeepers-and-businesses
numof-conflictsVn-between-gatekeepers-and-gatekeepers
numof-conflictsVn-between-gatekeepers-and-communities
numof-conflictsVn-between-gatekeepers-and-institutions
numof-conflictsVn-between-communities-and-controllers
numof-conflictsVn-between-communities-and-businesses
numof-conflictsVn-between-communities-and-gatekeepers
numof-conflictsVn-between-communities-and-communities
numof-conflictsVn-between-communities-and-institutions
numof-conflictsVn-between-institutions-and-controllers
numof-conflictsVn-between-institutions-and-businesses
numof-conflictsVn-between-institutions-and-gatekeepers
numof-conflictsVn-between-institutions-and-communities
numof-conflictsVn-between-institutions-and-institutions
numof-conflictsVc-between-controllers-and-controllers
numof-conflictsVc-between-controllers-and-businesses
numof-conflictsVc-between-controllers-and-gatekeepers
numof-conflictsVc-between-controllers-and-communities
numof-conflictsVc-between-controllers-and-institutions
numof-conflictsVc-between-businesses-and-controllers
numof-conflictsVc-between-businesses-and-businesses
numof-conflictsVc-between-businesses-and-gatekeepers
numof-conflictsVc-between-businesses-and-communities
numof-conflictsVc-between-businesses-and-institutions
numof-conflictsVc-between-gatekeepers-and-controllers
numof-conflictsVc-between-gatekeepers-and-businesses
numof-conflictsVc-between-gatekeepers-and-gatekeepers
numof-conflictsVc-between-gatekeepers-and-communities
numof-conflictsVc-between-gatekeepers-and-institutions
numof-conflictsVc-between-communities-and-controllers
numof-conflictsVc-between-communities-and-businesses
numof-conflictsVc-between-communities-and-gatekeepers
numof-conflictsVc-between-communities-and-communities
numof-conflictsVc-between-communities-and-institutions
numof-conflictsVc-between-institutions-and-controllers
numof-conflictsVc-between-institutions-and-businesses
numof-conflictsVc-between-institutions-and-gatekeepers
numof-conflictsVc-between-institutions-and-communities
numof-conflictsVc-between-institutions-and-institutions
numof-conflictsXi-between-controllers-and-controllers
numof-conflictsXi-between-controllers-and-businesses
numof-conflictsXi-between-controllers-and-gatekeepers
numof-conflictsXi-between-controllers-and-communities
numof-conflictsXi-between-controllers-and-institutions
numof-conflictsXi-between-businesses-and-controllers
numof-conflictsXi-between-businesses-and-businesses
numof-conflictsXi-between-businesses-and-gatekeepers
numof-conflictsXi-between-businesses-and-communities
numof-conflictsXi-between-businesses-and-institutions
numof-conflictsXi-between-gatekeepers-and-controllers
numof-conflictsXi-between-gatekeepers-and-businesses
numof-conflictsXi-between-gatekeepers-and-gatekeepers
numof-conflictsXi-between-gatekeepers-and-communities
numof-conflictsXi-between-gatekeepers-and-institutions
numof-conflictsXi-between-communities-and-controllers
numof-conflictsXi-between-communities-and-businesses
numof-conflictsXi-between-communities-and-gatekeepers
numof-conflictsXi-between-communities-and-communities
numof-conflictsXi-between-communities-and-institutions
numof-conflictsXi-between-institutions-and-controllers
numof-conflictsXi-between-institutions-and-businesses
numof-conflictsXi-between-institutions-and-gatekeepers
numof-conflictsXi-between-institutions-and-communities
numof-conflictsXi-between-institutions-and-institutions
numof-conflictsEi-between-controllers-and-controllers
numof-conflictsEi-between-controllers-and-businesses
numof-conflictsEi-between-controllers-and-gatekeepers
numof-conflictsEi-between-controllers-and-communities
numof-conflictsEi-between-controllers-and-institutions
numof-conflictsEi-between-businesses-and-controllers
numof-conflictsEi-between-businesses-and-businesses
numof-conflictsEi-between-businesses-and-gatekeepers
numof-conflictsEi-between-businesses-and-communities
numof-conflictsEi-between-businesses-and-institutions
numof-conflictsEi-between-gatekeepers-and-controllers
numof-conflictsei-between-gatekeepers-and-businesses
numof-conflictsEi-between-gatekeepers-and-gatekeepers
numof-conflictsEi-between-gatekeepers-and-communities
numof-conflictsEi-between-gatekeepers-and-institutions
numof-conflictsEi-between-communities-and-controllers
numof-conflictsEi-between-communities-and-businesses
numof-conflictsEi-between-communities-and-gatekeepers
numof-conflictsEi-between-communities-and-communities
numof-conflictsEi-between-communities-and-institutions
numof-conflictsEi-between-institutions-and-controllers
numof-conflictsEi-between-institutions-and-businesses
numof-conflictsEi-between-institutions-and-gatekeepers
numof-conflictsEi-between-institutions-and-communities
numof-conflictsEi-between-institutions-and-institutions
DefectGatekeepers
DefectControllers
DefectBusinesses
DefectCommunities
DefectInstitutions
CoopGatekeepers
CoopControllers
CoopBusinesses
TypeOfRegulation
Provision
Control
NewRegulation
Regulation
Supply
Promotion
Cooperation
KilledTourists
;;Sliders
;Iterations ;; determines the number of simulations to be done
;ResourcesDensity ; low medium high
;ResourcesThreshold ; 0.5 .. 0.9
;CollectiveObjective
;BottomUpRegulation
;UnderUsedResources
;NewTourists ; 0 .. 100
;TouristsDensityEvolution ; 1..5
]
;turtles
;[
;who ; 1 rank order number of each turtle: varies from 0 to ...
;color ; 2 turtle color: varies with breed
;heading ; 3 turtle orientation
;xcor ; 4 turtle x coordinate
;ycor ; 5 turtle y coordinate
;shape ; 6 turtle shape (default)
;pen-down? ; 7 false
;label ; 8 first letter of breed + rank order number in the database
;label-color ; 9 grey (9.9999)
;breed ;10 group (complete name of role)
;hidden? ;11 false
;size ;12 default or copy of energy
;]
turtles-own
[
;input data
energy ; Ri*Si;T occup ;13
Ri ;14
Gi ;15
Si ;16
Xi ;17
Ei ;18
Dij ;19
Nij ;20
preffor-natural-resources ;21
preffor-cultural-resources;22
preffor-social-resources ;23
preffor-economic-resources;24
preffor-accomodations ;25
preffor-catering ;26
preffor-leisures ;27
preffor-attractions ;28
preffor-foods ;29
preffor-landscape ;30
preffor-crafts ;31
tourist-freq ;32 from TQ3.2 1= first time, 2=decond time 3=third time & +
tourist-satisfaction ;33 from TQ4.3 1=Exceeded, 2=Matched, 3=Fallen below, 4=Other respons
tourist-plan ;34 from TQ4.8.3 1=yes, 2=no, 3=?
perceptionOfTpreffor-natural-resources ;35
perceptionOfTpreffor-cultural-resources ;36
perceptionOfTpreffor-social-resources ;37
perceptionOfTpreffor-economic-resources ;38
Qx3 ;39
Qx5 ;40
Q5113i ;41
Q5114i ;42
;intermediate variable
resources-preference
;preffor-underused-resources
tourists-perception
PositionInFaceOfCollectiveObjective
WillingnessToAcceptAccessToPatch
WillingnessToCirculateInformationOnPatch
;;;;;;;;; for sitsim ;;;;;;;;;;;;;;;;;;
strength ;; of influence, set at initialisation to a random value
;;;;;;;;; for iterated NPD ;;;;;;;;;;;
challenger ;; id number (who) of business that convinced a controller
challenged? ;; am I challenged by an other actor, i.e. have I been convinced by an other actor?
strategy
score ;;my current score
partnered? ;;am I partnered?
partner ;;the who of my partner
partner-defected? ;;did my partner defect last round?
partner-history ;;a list containing information about past interactions
;;with other turtles (indexed by WHO values)
defect-now? ;;what will I do this round?
cooperative-partners ;;list of my cooperative partners
defected-partners ;;list of my non cooperative partners
new-active-patches ;;list of patches newly controlled/used/promoted
previous-energy ;;energy at the end of the last iteration
gains ;;energy variation between two successive rounds
total-gains ;;sum of gains
conflict1 ;;actors that moved on the same patch for not doing the same thing
conflict2 ;;actors arround the influence area of one with diffrent objectives
cooperation1 ;;actors that moved on the same patch for doing the same thing
cooperation2 ;;actors arround the influence area of one with the same idea
conflict-with-R
conflict-with-B
conflict-with-C
conflict-with-G
conflict-with-I
conflictVn-with-R
conflictVn-with-B
conflictVn-with-C
conflictVn-with-G
conflictVn-with-I
conflictVc-with-R
conflictVc-with-B
conflictVc-with-C
conflictVc-with-G
conflictVc-with-I
conflictXi-with-R
conflictXi-with-B
conflictXi-with-C
conflictXi-with-G
conflictXi-with-I
conflictEi-with-R
conflictEi-with-B
conflictEi-with-C
conflictEi-with-G
conflictEi-with-I
cooperation-with-R
cooperation-with-B
cooperation-with-G
;ownedpatches ;;list of patches wher I have acted
]
;patches
;[
;pxcor ; 1 patch x coordinate: varies from -12 to +12
;pycor ; 2 patch y coordinate: varies from -12 to +12
;pcolor ; 3 patch color: varies with the amount of local resources
;plabel ; 4 nil
;plabel-color ; 5 9.9999
;]
patches-own
[
;intermediate variables computed as sum of input data preffor... of turtles on each patch
resources ; 6
natural-resources ; 7
cultural-resources ; 8
social-resources ; 9
economic-resources ;10
accomodations ;11
catering ;12
leisures ;13
attractions ;14
foods ;15
landscape ;16
crafts ;17
p ;18
cost ;19
benefit ;20
controlled-by ;21 list of labels the controllers of the resources on the patch
used-by ;22 list of labels the users of the resources on the patch
promoted-by ;23 list of labels the promoters of the resources on the patch
visited-by ;24 list of labels tourists on the patch
liked-by ;25 list of labels communities liking that is on the patch
supported-by ;26 list of labels institutions supporting that is on the patch
controlled-byw ;27 list of who the controllers of the resources on the patch
used-byw ;28 list of who the users of the resources on the patch
promoted-byw ;29 list of who the promoters of the resources on the patch
visited-byw ;30 list of who tourists on the patch
liked-byw ;31 list of who communities liking that is on the patch
supported-byw ;32 list of who institutions supporting that is on the patch
]
breeds
[
tourists
gatekeepers
controllers
businesses
communities
institutions
cooperative-actors
greedy-actors
nodes
edges
]
;;;;;;;;;;;;;;;;;;;;;
;; Setup Procedures ;;
;;;;;;;;;;;;;;;;;;;;;
to setup
locals [cou reg eve w x y z]
clear-all
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;selection of the simulation context
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
set a (user-choice "Please, select a country " [ "CZ" "IR" "UK" "SP" "GR" "FR"])
set country a
set cou a
set b (user-choice "Please, select a study region " [ "1" "2"])
set region b
set reg b
;set c (user-choice "Please, select an event \n(GS=General event; RSS=Region-specific event)" [ "-GS" "-RSS"])
set c "-GS";; regulation model is only to be ran under the general event
set event c
set eve c
set a word "SPRITE-" country
set b word a region
set c word b event
;set datafile word c "worldForRegulation-jpb-b.txt"
;set datafile word c "worldForRegulation.txt"
;;;;;;;;;;;; reusing or not of the model of the simulation contxt ;;;;;;;;;;
ifelse "Yes" = (user-choice "Would you like to use the built-in grid of resources?" [ "Yes" "No" ])
[;1open yes
set datafile word c "resultsOfRegulation0.csv"
print "Please, wait for a few moment..."
print "... I am loading the base scenario"
print datafile
import-world datafile
set country cou
set region reg
set event eve
;setup-user-input-parameters-1
setup-user-input-parameters-2
;;;;;;;;;;;;;; using or not of the current parameters ;;;;;;;;;;;;;;;;;;;;;;;
ifelse "Yes" = (user-choice "Do you agree with the values of these parameters?" [ "Yes" "No" ])
[;2yes
without-interruption
[
;store-initial-turtle-counts ;;record the number of turtles for each strategy
;setup-common-variables ;;sets the variables that all turtles share
;do-plotting
set TTN count turtles
set iteration 0
print-initial-situation
do-base-scenario
set a word "SPRITE-" cou
set b word a reg
set c word b eve
set d word c "resultsOfRegulation"
set w word d "-BaseS-"
set resfile0 word d iteration
export-world resfile0
print "Now, run the simulations"
]
];2
[;2no
print "Setup the parameters"
stop
];2
];1 close yes
[;1 open no
set datafile word c "worldForRegulation.txt"
print "Please, wait for a few moment..."
print "... I am loading the database"
print datafile
import-world datafile
;setup-shape-of-communities-and-institutions-and-gatekeepers
setup-resources-of-patches-from-random
set TTN count turtles
print "... I am distributing the controllers"
setup-preferences-of-controllers
if "No" = (user-choice "Do you agree with this distribution?" [ "Yes" "No" ])
[
print "Setup the data again"
stop
]
print "... I am distributing the businesses"
setup-preferences-of-businesses
if "No" = (user-choice "Do you agree with this distribution?" [ "Yes" "No" ])
[
print "Setup the data again"
stop
]
print "... I am distributing the gatekeepers preferences"
setup-preferences-of-gatekeepers
print "... I am distributing the communities preferences"
setup-preferences-of-communities
print "... I am distributing the institutions preferences"
setup-preferences-of-institutions
print "... I am distributing the tourists"
setup-preferences-of-tourists
setup-user-input-parameters-1
setup-user-input-parameters-2
print-initial-situation
ifelse "Yes" = (user-choice "Do you agree with the values of these parameters?" [ "Yes" "No" ])
[
set iteration 0
print "Please, wait for a few moment..."
print "... I am building the base scenario"
do-base-scenario
; set a word "SPRITE-" country
; set b word a region
; set c word b event
; set d word c "resultsOfRegulation"
; set resfile0 word d iteration
; export-world resfile0
set a word "SPRITE-" cou
set b word a reg
set c word b eve
set d word c "resultsOfRegulation"
set w word d "-BaseS-"
set resfile0 word d iteration
export-world resfile0
print "Now, run the simulations"
]
[
print "Setup the parameters"
stop
]
];close no
end
to setup-user-input-parameters-1
set Iterations 10
;set VisionRange 100
set BottomUpRegulation? true
set ResourcesDensity 1
set ResourcesThreshold 0.5
set UnderUsedResources "natural&cultural"
set TypeOfRegulation "market"
set CollectiveObjective "all together"
set NewTourists 20
set TouristsDensityEvolution 2
;print "Value of parameters:"
;type "NbOf Iterations " print Iterations
;type "VisionRange " print VisionRange
;type "BottomUpRegulation " print BottomUpRegulation?
;type "ResourcesDensity " print ResourcesDensity
;type "ResourcesThreshold " print ResourcesThreshold
;type "UnderUsedResources " print UnderUsedResources
;type "CollectiveObjective " print CollectiveObjective
;type "NewTourists " print NewTourists
;type "TouristsDensityEvolution " print TouristsDensityEvolution
;type "MaxTouristsDensity " print precision MaxTouristsDensity 2
end
to setup-user-input-parameters-2
print "Value of parameters:"
type "NbOf Iterations " print Iterations
;type "VisionRange " print VisionRange
type "BottomUpRegulation " print BottomUpRegulation?
type "ResourcesDensity " print ResourcesDensity
type "ResourcesThreshold " print ResourcesThreshold
type "UnderUsedResources " print UnderUsedResources
type "TypeOfRegulation" print TypeOfRegulation
type "CollectiveObjective " print CollectiveObjective
type "NewTourists " print NewTourists
type "TouristsDensityEvolution " print TouristsDensityEvolution
type "MaxTouristsDensity " print precision MaxTouristsDensity 2
if (CollectiveObjective = "more provision of resources") [set collective-build-in-goal 0]
if (CollectiveObjective = "more quality of resources") [set collective-build-in-goal 2]
;if (CollectiveObjective = "create new regulations") [set collective-build-in-goal 4]
;if (CollectiveObjective = "more application of current regulations") [set collective-build-in-goal 6]
if (CollectiveObjective = "more supply of tourism products & services") [set collective-build-in-goal 8]
if (CollectiveObjective = "more promotion of place and products") [set collective-build-in-goal 10]
;if (CollectiveObjective = "more cooperation") [set collective-build-in-goal 12]
if (CollectiveObjective = "all together") [set collective-build-in-goal 999]
ifelse CollectiveObjective = "all together"
[
ask turtles with [breed = controllers or breed = businesses or breed = gatekeepers or breed = communities]
[
without-interruption
[
ifelse (Ei = 0 or Ei = 2 or Ei = 8 or Ei = 10)
[set Q5113i 999]
[set Q5113i 0]
ifelse (Xi > 0 and Q5113i = 999)
[set PositionInFaceOfCollectiveObjective 1]
[set PositionInFaceOfCollectiveObjective 0]
]
]
]
[
ask turtles with [breed = controllers or breed = businesses or breed = gatekeepers or breed = communities]
[
without-interruption
[
ifelse (Xi > 0 and Ei = collective-build-in-goal)
[set PositionInFaceOfCollectiveObjective 1]
[set PositionInFaceOfCollectiveObjective 0]
]
]
]
end
to setup-shape-of-communities-and-institutions-and-gatekeepers
ask turtles
[
if (breed = communities or breed = institutions or breed = gatekeepers) [hideturtle];
]
end
to setup-resources-of-patches-from-random
locals [economic-products social-products max-economic-products max-social-products]
ask patches
[
without-interruption
[
set controlled-by []
set used-by []
set promoted-by []
set visited-by []
set liked-by []
set supported-by []
set controlled-byw []
set used-byw []
set promoted-byw []
set visited-byw []
set liked-byw []
set supported-byw []
set natural-resources precision (random-int-or-float 1.0) 1
set cultural-resources precision (random-int-or-float 1.0) 1
set social-resources precision (random-int-or-float 1.0) 1
set economic-resources precision (random-int-or-float 1.0) 1
set accomodations precision (random-int-or-float 1.0) 1
set catering precision (random-int-or-float 1.0) 1
set leisures precision (random-int-or-float 1.0) 1
set attractions precision (random-int-or-float 1.0) 1
set foods precision (random-int-or-float 1.0) 1
set landscape precision (random-int-or-float 1.0) 1
set crafts precision (random-int-or-float 1.0) 1
set economic-products []
set economic-products lput accomodations economic-products
set economic-products lput catering economic-products
set economic-products lput foods economic-products
set economic-products lput crafts economic-products
set max-economic-products max economic-products
set social-products []
set social-products lput accomodations social-products
set social-products lput catering social-products
set social-products lput attractions social-products
set max-social-products max social-products
if (natural-resources < landscape) [set natural-resources landscape ]
if (cultural-resources < attractions) [set cultural-resources attractions ]
if (social-resources < max social-products) [set social-resources max-social-products ]
if (economic-resources < max economic-products) [set economic-resources max-economic-products ]
set resources ((natural-resources + cultural-resources + social-resources + economic-resources) / 4)
set pcolor 59 - (resources * 8)
]
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;
; setup of controllers
;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-preferences-of-controllers
locals [tt tpn tpc tps tpe]
set tt count turtles with [breed = controllers]
set tpn count turtles with [breed = controllers and preffor-natural-resources = 1]
set tpc count turtles with [breed = controllers and preffor-cultural-resources = 1]
set tps count turtles with [breed = controllers and preffor-social-resources = 1]
set tpe count turtles with [breed = controllers and preffor-economic-resources = 1]
if ((tpn / tt) < (0.10 * ResourcesDensity))
[
print "controllers preferences for natural resources were randomly redefined"
ask turtles with [breed = controllers and preffor-natural-resources = 0 ]
[
without-interruption
[
set preffor-natural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpc / tt) < (0.10 * ResourcesDensity))
[
print "controllers preferences for cultural resources were randomly redefined"
ask turtles with [breed = controllers and preffor-cultural-resources = 0 ]
[
without-interruption
[
set preffor-cultural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tps / tt) < (0.10 * ResourcesDensity))
[
print "controllers preferences for social resources were randomly redefined"
ask turtles with [breed = controllers and preffor-social-resources = 0 ]
[
without-interruption
[
set preffor-social-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpe / tt) < (0.10 * ResourcesDensity))
[
print "controllers preferences for economic resources were randomly redefined"
ask turtles with [breed = controllers and preffor-economic-resources = 0 ]
[
without-interruption
[
set preffor-economic-resources precision (random-int-or-float 1.0) 1
]
]
]
ask turtles with [breed = controllers]
[
without-interruption
[
set attempt 0
set gains 0
set total-gains 0
set resources-preference ((preffor-natural-resources + preffor-cultural-resources + preffor-social-resources + preffor-economic-resources) / 4)
set WillingnessToAcceptAccessToPatch Xi
search-for-afree-place-for-controllers
]
]
type count patches with [count turtles-here with [breed = controllers] > 0] print " controllers located"
end
to search-for-afree-place-for-controllers
locals [TNp TNp8 OTNp8 MTNp8 MTNp8natural MTNp8cultural MTNp8social MTNp8economic X Y dis]
ifelse (attempt < 2000)
[
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
set TNp count turtles-here
ifelse (TNp > 1)
[;there are other turtles here
set attempt attempt + 1
search-for-afree-place-for-controllers ; search for an other place
]
[;there are no other turtles here
set TNp8 count turtles in-radius (ResourcesDensity * 4);8; number of turtles on the eight patches around the calling turtle or patch
ifelse (TNp8 < 2)
[;there are no other turtles around the asked turtle
expand-preferences-ofcontrollers
]
[; there are other turtles arround the asked turtle
set OTNp8 max-one-of turtles in-radius (ResourcesDensity * 4) [size]; who is the bigest neighbour
set dis distance OTNp8
ifelse (dis >= ((size-of OTNp8 * ResourcesDensity) + (2 * (size * ResourcesDensity))))
[
expand-preferences-ofcontrollers
]
[
;ifelse (resources-preference-of OTNp8 = resources-preference)
set MTNp8natural mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-natural-resources];
set MTNp8cultural mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-cultural-resources];
set MTNp8social mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-social-resources];
set MTNp8economic mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-economic-resources];
ifelse
(
MTNp8natural = preffor-natural-resources
and
MTNp8cultural = preffor-cultural-resources
and
MTNp8social = preffor-social-resources
and
MTNp8economic = preffor-economic-resources
)
[;my neighbours have the same view to me
;expand-preferences-ofcontrollers
set attempt attempt + 1
search-for-afree-place-for-controllers ; search for an other place
]
[;others dont have the same view
set attempt attempt + 1
search-for-afree-place-for-controllers ; search for an other place
];close else
];close else
];close else
];close else
];close if
[
; turtle remains here even if it is not its optimal position !
nonexpand-preferences
]
end
to expand-preferences-ofcontrollers ; optimal position !
locals [TNp TPnr TPcr TPsr TPer TPacc TPcat TPleis TPatt TPlan TPfoo TPcra
economic-products social-products max-economic-products max-social-products]
set TPnr preffor-natural-resources
set TPcr preffor-cultural-resources
set TPsr preffor-social-resources
set TPer preffor-economic-resources
set TPacc preffor-accomodations
set TPcat preffor-catering
set TPleis preffor-leisures
set TPatt preffor-attractions
set TPfoo preffor-foods
set TPlan preffor-landscape
set TPcra preffor-crafts
ask patches in-radius (ResourcesDensity * size)
[
without-interruption
[
set controlled-by lput label-of myself controlled-by
set controlled-byw lput myself controlled-byw
set plabel "."
;if who-of myself >= TTN [set plabel "r."]
set natural-resources TPnr
set cultural-resources TPcr
set social-resources TPsr
set economic-resources TPer
set accomodations TPacc
set catering TPcat
set leisures TPleis
set attractions TPatt
set foods TPfoo
set landscape TPlan
set crafts TPcra
set economic-products []
set economic-products lput accomodations economic-products
set economic-products lput catering economic-products
set economic-products lput foods economic-products
set economic-products lput crafts economic-products
set max-economic-products max economic-products
set social-products []
set social-products lput accomodations social-products
set social-products lput catering social-products
set social-products lput attractions social-products
set max-social-products max social-products
if (natural-resources < landscape) [set natural-resources landscape ]
if (cultural-resources < attractions) [set cultural-resources attractions ]
if (social-resources < max social-products) [set social-resources max-social-products ]
if (economic-resources < max economic-products) [set economic-resources max-economic-products ]
set resources ((natural-resources + cultural-resources + social-resources + economic-resources) / 4)
set pcolor 59 - (resources * 8)
;set pcolor violet
]
]
;set TNp count patches with [member? label-of myself controlled-by]
;type TNp type " patches could be controlled by " print label;-of myself
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; setup of businesses
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-preferences-of-businesses
locals [tt tpn tpc tps tpe]
set tt count turtles with [breed = businesses]
set tpn count turtles with [breed = businesses and preffor-natural-resources = 1]
set tpc count turtles with [breed = businesses and preffor-cultural-resources = 1]
set tps count turtles with [breed = businesses and preffor-social-resources = 1]
set tpe count turtles with [breed = businesses and preffor-economic-resources = 1]
if ((tpn / tt) < (0.10 * ResourcesDensity))
[
print "businesses preferences for natural resources were randomly redefined"
ask turtles with [breed = businesses and preffor-natural-resources = 0 ]
[
without-interruption
[
set preffor-natural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpc / tt) < (0.10 * ResourcesDensity))
[
print "businesses preferences for cultural resources were randomly redefined"
ask turtles with [breed = businesses and preffor-cultural-resources = 0 ]
[
without-interruption
[
set preffor-cultural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tps / tt) < (0.10 * ResourcesDensity))
[
print "businesses preferences for social resources were randomly redefined"
ask turtles with [breed = businesses and preffor-social-resources = 0 ]
[
without-interruption
[
set preffor-social-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpe / tt) < (0.10 * ResourcesDensity))
[
print "businesses preferences for economic resources were randomly redefined"
ask turtles with [breed = businesses and preffor-economic-resources = 0 ]
[
without-interruption
[
set preffor-economic-resources precision (random-int-or-float 1.0) 1
]
]
]
ask turtles with [breed = businesses]
[
without-interruption
[
set attempt 0
set gains 0
set total-gains 0
set resources-preference ((preffor-natural-resources + preffor-cultural-resources + preffor-social-resources + preffor-economic-resources) / 4)
search-for-afree-place-for-businesses
]
]
type count patches with [count turtles-here with [breed = businesses] > 0] print " businesses located"
end
to search-for-afree-place-for-businesses
locals [TNp TNp8 OTNp8 MTNp8 MTNp8natural MTNp8cultural MTNp8social MTNp8economic X Y dis]
ifelse (attempt < 2000)
[
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
set TNp count turtles-here
ifelse (TNp > 1)
[;there are other turtles here
set attempt attempt + 1
search-for-afree-place-for-businesses ; search for an other place
]
[;there are no other turtles here
set TNp8 count turtles in-radius (ResourcesDensity * 4);8; number of turtles on the eight patches around the calling turtle or patch
ifelse (TNp8 < 2)
[;there are no other turtles around the asked turtle
expand-preferences-ofbusinesses
]
[; there are other turtles arround the asked turtle
set blast-radius max values-from turtles in-radius (ResourcesDensity * 4) [size]; size of the bigest neighbour
set OTNp8 max-one-of turtles in-radius (ResourcesDensity * 4) [size]; who is the bigest neighbour
set dis distance OTNp8
ifelse (dis >= ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity * 4)))
[
expand-preferences-ofbusinesses
]
[
;ifelse (resources-preference-of OTNp8 = resources-preference)
set MTNp8natural mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-natural-resources];
set MTNp8cultural mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-cultural-resources];
set MTNp8social mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-social-resources];
set MTNp8economic mean values-from turtles in-radius (ResourcesDensity * 4) [preffor-economic-resources];
ifelse
(
MTNp8natural = preffor-natural-resources
and
MTNp8cultural = preffor-cultural-resources
and
MTNp8social = preffor-social-resources
and
MTNp8economic = preffor-economic-resources
)
[;my neighbours have the same view to me
expand-preferences-ofbusinesses
]
[;others dont have the same view
set attempt attempt + 1
search-for-afree-place-for-businesses ; search for an other place
];close else
];close else
];close else
];close else
];close if
[
; turtle remains here even if it is not its optimal position !
nonexpand-preferences
]
end
to expand-preferences-ofbusinesses ; optimal position !
locals [TNp TPnr TPcr TPsr TPer TPacc TPcat TPleis TPatt TPlan TPfoo TPcra
economic-products social-products max-economic-products max-social-products]
set TPnr preffor-natural-resources
set TPcr preffor-cultural-resources
set TPsr preffor-social-resources
set TPer preffor-economic-resources
set TPacc preffor-accomodations
set TPcat preffor-catering
set TPleis preffor-leisures
set TPatt preffor-attractions
set TPfoo preffor-foods
set TPlan preffor-landscape
set TPcra preffor-crafts
ask patches in-radius (ResourcesDensity * size)
[
without-interruption
[
set used-by lput label-of myself used-by
set used-byw lput myself used-byw
set plabel "+"
;if who-of myself >= TTN [set plabel "b+"]
set natural-resources TPnr
set cultural-resources TPcr
set social-resources TPsr
set economic-resources TPer
set accomodations TPacc
set catering TPcat
set leisures TPleis
set attractions TPatt
set foods TPfoo
set landscape TPlan
set crafts TPcra
set economic-products []
set economic-products lput accomodations economic-products
set economic-products lput catering economic-products
set economic-products lput foods economic-products
set economic-products lput crafts economic-products
set max-economic-products max economic-products
set social-products []
set social-products lput accomodations social-products
set social-products lput catering social-products
set social-products lput attractions social-products
set max-social-products max social-products
if (natural-resources < landscape) [set natural-resources landscape ]
if (cultural-resources < attractions) [set cultural-resources attractions ]
if (social-resources < max social-products) [set social-resources max-social-products ]
if (economic-resources < max economic-products) [set economic-resources max-economic-products ]
set resources ((natural-resources + cultural-resources + social-resources + economic-resources) / 4)
set pcolor 59 - (resources * 8)
;set pcolor violet
]
]
;set TNp count patches with [member? label-of myself used-by]
;type TNp type " patches could be used by " print label;-of myself
end
to nonexpand-preferences ; non optimal position !
locals [TPnr TPcr TPsr TPer TPacc TPcat TPleis TPatt TPlan TPfoo TPcra
economic-products social-products max-economic-products max-social-products]
type label show " has a sub optimal position"
;set TTN TTN + 1
set TPnr preffor-natural-resources
set TPcr preffor-cultural-resources
set TPsr preffor-social-resources
set TPer preffor-economic-resources
set TPacc preffor-accomodations
set TPcat preffor-catering
set TPleis preffor-leisures
set TPatt preffor-attractions
set TPfoo preffor-foods
set TPlan preffor-landscape
set TPcra preffor-crafts
ask patch-here ;in-radius 1; size
[
without-interruption
[
if (breed-of myself = controllers) [set controlled-by lput label-of myself controlled-by]
if (breed-of myself = businesses) [set used-by lput label-of myself used-by]
if (breed-of myself = gatekeepers) [set promoted-by lput label-of myself promoted-by]
if (breed-of myself = tourists) [set visited-by lput label-of myself visited-by]
if (breed-of myself = controllers) [set controlled-byw lput myself controlled-byw]
if (breed-of myself = businesses) [set used-byw lput myself used-byw]
if (breed-of myself = gatekeepers) [set promoted-byw lput myself promoted-byw]
if (breed-of myself = tourists) [set visited-byw lput myself visited-byw]
set natural-resources TPnr
set cultural-resources TPcr
set social-resources TPsr
set economic-resources TPer
set accomodations TPacc
set catering TPcat
set leisures TPleis
set attractions TPatt
set foods TPfoo
set landscape TPlan
set crafts TPcra
set economic-products []
set economic-products lput accomodations economic-products
set economic-products lput catering economic-products
set economic-products lput foods economic-products
set economic-products lput crafts economic-products
set max-economic-products max economic-products
set social-products []
set social-products lput accomodations social-products
set social-products lput catering social-products
set social-products lput attractions social-products
set max-social-products max social-products
if (natural-resources < landscape) [set natural-resources landscape ]
if (cultural-resources < attractions) [set cultural-resources attractions ]
if (social-resources < max social-products) [set social-resources max-social-products ]
if (economic-resources < max economic-products) [set economic-resources max-economic-products ]
set resources ((natural-resources + cultural-resources + social-resources + economic-resources) / 4)
set pcolor 59 - (resources * 8)
;set pcolor violet
]
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; setup of gatekeepers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-preferences-of-gatekeepers
locals [tt tpn tpc tps tpe]
set tt count turtles with [breed = gatekeepers]
set tpn count turtles with [breed = gatekeepers and preffor-natural-resources = 1]
set tpc count turtles with [breed = gatekeepers and preffor-cultural-resources = 1]
set tps count turtles with [breed = gatekeepers and preffor-social-resources = 1]
set tpe count turtles with [breed = gatekeepers and preffor-economic-resources = 1]
if ((tpn / tt) < (0.10 * ResourcesDensity))
[
print "gatekeepers preferences for natural resources were randomly redefined"
ask turtles with [breed = gatekeepers and preffor-natural-resources = 0 ]
[
without-interruption
[
set preffor-natural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpc / tt) < (0.10 * ResourcesDensity))
[
print "gatekeepers preferences for cultural resources were randomly redefined"
ask turtles with [breed = gatekeepers and preffor-cultural-resources = 0 ]
[
without-interruption
[
set preffor-cultural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tps / tt) < (0.10 * ResourcesDensity))
[
print "gatekeepers preferences for social resources were randomly redefined"
ask turtles with [breed = gatekeepers and preffor-social-resources = 0 ]
[
without-interruption
[
set preffor-social-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpe / tt) < (0.10 * ResourcesDensity))
[
print "gatekeepers preferences for economic resources were randomly redefined"
ask turtles with [breed = gatekeepers and preffor-economic-resources = 0 ]
[
without-interruption
[
set preffor-economic-resources precision (random-int-or-float 1.0) 1
]
]
]
ask turtles with [breed = gatekeepers]
[
without-interruption
[
set attempt 0
set gains 0
set total-gains 0
set resources-preference
((preffor-natural-resources
+ preffor-cultural-resources
+ preffor-social-resources
+ preffor-economic-resources) / 4)
set WillingnessToCirculateInformationOnPatch Xi
;search-for-afree-place-for-gatekeepers
expand-preferences-ofgatekeepers
]
]
type count turtles with [breed = gatekeepers] print " gatekeepers patched"
end
to expand-preferences-ofgatekeepers ; optimal position !
locals [TNp]
ask patches with
[
resources > 0
and
( controlled-by != []
or used-by != []
)
]
[
ifelse(
( natural-resources >= (preffor-natural-resources-of myself * ResourcesThreshold)
or cultural-resources >= (preffor-cultural-resources-of myself * ResourcesThreshold)
)
and
( social-resources >= (preffor-social-resources-of myself * ResourcesThreshold)
or economic-resources >= (preffor-economic-resources-of myself * ResourcesThreshold)
)
and
( accomodations >= (preffor-accomodations-of myself * ResourcesThreshold)
or catering >= (preffor-catering-of myself * ResourcesThreshold)
)
and
( leisures >= (preffor-leisures-of myself * ResourcesThreshold)
or attractions >= (preffor-attractions-of myself * ResourcesThreshold)
or foods >= (preffor-foods-of myself * ResourcesThreshold)
or landscape >= (preffor-landscape-of myself * ResourcesThreshold)
or crafts >= (preffor-crafts-of myself * ResourcesThreshold)
)
)
[
set promoted-by lput label-of myself promoted-by
set promoted-byw lput myself promoted-byw
set plabel "*"
;if who-of myself >= TTN [set plabel "g*"]
]
[];type label-of myself print " is not located"
]
;set TNp count patches with [member? label-of myself promoted-by]
;type TNp type " patches could be promoted by " print label;-of myself
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; setup communities
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-preferences-of-communities
locals [tt tpn tpc tps tpe]
set tt count turtles with [breed = communities]
set tpn count turtles with [breed = communities and preffor-natural-resources = 1]
set tpc count turtles with [breed = communities and preffor-cultural-resources = 1]
set tps count turtles with [breed = communities and preffor-social-resources = 1]
set tpe count turtles with [breed = communities and preffor-economic-resources = 1]
if ((tpn / tt) < (0.10 * ResourcesDensity))
[
print "communities preferences for natural resources were randomly redefined"
ask turtles with [breed = communities and preffor-natural-resources = 0 ]
[
without-interruption
[
set preffor-natural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpc / tt) < (0.10 * ResourcesDensity))
[
print "communities preferences for cultural resources were randomly redefined"
ask turtles with [breed = communities and preffor-cultural-resources = 0 ]
[
without-interruption
[
set preffor-cultural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tps / tt) < (0.10 * ResourcesDensity))
[
print "communities preferences for social resources were randomly redefined"
ask turtles with [breed = communities and preffor-social-resources = 0 ]
[
without-interruption
[
set preffor-social-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpe / tt) < (0.10 * ResourcesDensity))
[
print "communities preferences for economic resources were randomly redefined"
ask turtles with [breed = communities and preffor-economic-resources = 0 ]
[
without-interruption
[
set preffor-economic-resources precision (random-int-or-float 1.0) 1
]
]
]
ask turtles with [breed = communities]
[
without-interruption
[
;set attempt 0
set previous-energy energy
set gains 0
set total-gains 0
set resources-preference
(
(perceptionoftpreffor-natural-resources
+ perceptionoftpreffor-cultural-resources
+ perceptionoftpreffor-social-resources
+ perceptionoftpreffor-economic-resources
)
/ 4)
expand-preferences-ofcommunities
]
]
type count turtles with [breed = communities] print " communities patched"
end
to expand-preferences-ofcommunities ; optimal position !
locals [TNp]
ask patches with [resources > 0]
[
ifelse(
( natural-resources >= (perceptionoftpreffor-natural-resources-of myself * ResourcesThreshold)
and cultural-resources >= (perceptionoftpreffor-cultural-resources-of myself * ResourcesThreshold)
)
and
( social-resources >= (perceptionoftpreffor-social-resources-of myself * ResourcesThreshold)
or economic-resources >= (perceptionoftpreffor-economic-resources-of myself * ResourcesThreshold)
)
)
[
set liked-by lput label-of myself liked-by
set liked-byw lput myself liked-byw
]
[];type label-of myself print " is not located"
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; setup institutions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-preferences-of-institutions
locals [tt tpn tpc tps tpe]
set tt count turtles with [breed = institutions]
set tpn count turtles with [breed = institutions and preffor-natural-resources = 1]
set tpc count turtles with [breed = institutions and preffor-cultural-resources = 1]
set tps count turtles with [breed = institutions and preffor-social-resources = 1]
set tpe count turtles with [breed = institutions and preffor-economic-resources = 1]
if ((tpn / tt) < (0.10 * ResourcesDensity))
[
print "institutions preferences for natural resources were randomly redefined"
ask turtles with [breed = institutions and preffor-natural-resources = 0 ]
[
without-interruption
[
set preffor-natural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpc / tt) < (0.10 * ResourcesDensity))
[
print "institutions preferences for cultural resources were randomly redefined"
ask turtles with [breed = institutions and preffor-cultural-resources = 0 ]
[
without-interruption
[
set preffor-cultural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tps / tt) < (0.10 * ResourcesDensity))
[
print "institutions preferences for social resources were randomly redefined"
ask turtles with [breed = institutions and preffor-social-resources = 0 ]
[
without-interruption
[
set preffor-social-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpe / tt) < (0.10 * ResourcesDensity))
[
print "institutions preferences for economic resources were randomly redefined"
ask turtles with [breed = institutions and preffor-economic-resources = 0 ]
[
without-interruption
[
set preffor-economic-resources precision (random-int-or-float 1.0) 1
]
]
]
ask turtles with [breed = institutions]
[
without-interruption
[
;set attempt 0
set previous-energy energy
set gains 0
set total-gains 0
set resources-preference
(
(perceptionoftpreffor-natural-resources
+ perceptionoftpreffor-cultural-resources
+ perceptionoftpreffor-social-resources
+ perceptionoftpreffor-economic-resources
)
/ 4)
expand-preferences-ofinstitutions
]
]
type count turtles with [breed = institutions] print " institution patched"
end
to expand-preferences-ofinstitutions ; optimal position !
locals [TNp]
ask patches with [resources > 0]
[
ifelse(
( natural-resources >= (perceptionoftpreffor-natural-resources-of myself * ResourcesThreshold)
and cultural-resources >= (perceptionoftpreffor-cultural-resources-of myself * ResourcesThreshold)
)
and
( social-resources >= (perceptionoftpreffor-social-resources-of myself * ResourcesThreshold)
or economic-resources >= (perceptionoftpreffor-economic-resources-of myself * ResourcesThreshold)
)
)
[
set supported-by lput label-of myself supported-by
set supported-byw lput myself supported-byw
]
[];type label-of myself print " is not located"
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; setup tourists
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-preferences-of-tourists
locals [tt tpn tpc tps tpe]
set tt count turtles with [breed = tourists]
set tpn count turtles with [breed = tourists and preffor-natural-resources = 1]
set tpc count turtles with [breed = tourists and preffor-cultural-resources = 1]
set tps count turtles with [breed = tourists and preffor-social-resources = 1]
set tpe count turtles with [breed = tourists and preffor-economic-resources = 1]
if ((tpn / tt) < (0.10 * ResourcesDensity))
[
print "tourists preferences for natural resources were randomly redefined"
ask turtles with [breed = tourists and preffor-natural-resources = 0 ]
[
without-interruption
[
set preffor-natural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpc / tt) < (0.10 * ResourcesDensity))
[
print "tourists preferences for cultural resources were randomly redefined"
ask turtles with [breed = tourists and preffor-cultural-resources = 0 ]
[
without-interruption
[
set preffor-cultural-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tps / tt) < (0.10 * ResourcesDensity))
[
print "tourists preferences for social resources were randomly redefined"
ask turtles with [breed = tourists and preffor-social-resources = 0 ]
[
without-interruption
[
set preffor-social-resources precision (random-int-or-float 1.0) 1
]
]
]
if ((tpe / tt) < (0.10 * ResourcesDensity))
[
print "tourists preferences for economic resources were randomly redefined"
ask turtles with [breed = tourists and preffor-economic-resources = 0 ]
[
without-interruption
[
set preffor-economic-resources precision (random-int-or-float 1.0) 1
]
]
]
ask turtles with [breed = tourists]
[
without-interruption
[
set previous-energy energy
set gains 0
set total-gains 0
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (tourist-satisfaction > 2) ;33 from TQ4.3 1=Exceeded, 2=Matched, 3=Fallen below, 4=Other respons
[
;do nothing = Ti remains here, with some differences between the patch features and his preferences
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
;type "No expected match for " type label
;print-preferences-satisfaction
]
[
set attempt 0
move-to-upper-preferences
];close else
];close without
];close ask
type count turtles with [breed = tourists] print " tourists located"
set numof-unsatisfied-tourists count turtles with [breed = tourists and tourist-satisfaction > 2]
type numof-unsatisfied-tourists print " unsatisfied tourists"
end
to move-to-upper-preferences ;; turtle proceduere
ifelse (attempt < 3000)
[;1 less 3000
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse ((promoted-by-of patch-here != []) and (used-by-of patch-here != []))
[;2patch OK
ifelse
(
value-from (patch-here) [natural-resources ] >= (preffor-natural-resources * ResourcesThreshold)
And value-from (patch-here) [cultural-resources ] >= (preffor-cultural-resources * ResourcesThreshold)
And value-from (patch-here) [social-resources ] >= (preffor-social-resources * ResourcesThreshold)
And value-from (patch-here) [economic-resources ] >= (preffor-economic-resources * ResourcesThreshold)
)
[;3 matching
ifelse (substring label 0 1 = "T" )
[;this is an initial tourist
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
set tourist-satisfaction 1
;type "Upper pref of " type label
;print-preferences-satisfaction
]
[;this is a new tourist: it must respect the values of other actors involved on the patch
communities-positions-analysis
]
]
[;3 not matching
set attempt attempt + 1
move-to-upper-preferences
];3
];2
[;2 patch not OK
set attempt attempt + 1
move-to-upper-preferences
]
]
[;more 3000
ifelse (substring label 0 1 = "T" )
[;this is a current tourist
ifelse (count other-turtles-here = 0)
[; there are no other turtles here: he stays here and the patch features are replaced with his preferences
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
nonexpand-preferences
set tourist-satisfaction 2
]
[; there are other turtles here: he move to 0 0
setxy 0 0
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
set tourist-satisfaction 3
type label print " didn't found a patch that matches its preferences, but he stayed here"
]
]
[;this is a new tourist: it must die
; type label print " didn't found a patch that matched its preferences: he didn't stay on the place"
set KilledTourists (KilledTourists + 1)
die
]
];1
end
to communities-positions-analysis
locals [TNp CNp WOp U V LL aa tt]
set TNp length visited-by-of patch-here ;; number of tourists already on the patches
ifelse (TNp >= MaxTouristsDensity)
[;open if1 ;; from green tourists point of view there are too many tourists:tourist doesn't stay here
set attempt attempt + 1
move-to-upper-preferences
;show label
];clos if1
[;open else1;;from green tourists point of view there are not too many tourists
ifelse (BottomUpRegulation? = false)
[;open if 2;; staying doesn't depend on communities positions: tourist stays here
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
set tourist-satisfaction 1
set CNp length liked-by-of patch-here ;; nb of communities supporting the resources on the patch
if (CNp > 0)
[;open isolated if;;there are communities supporting the resources of the patch
set V 0
set WOp liked-byw-of patch-here ; list of who of communities
foreach WOp
[
without-interruption
[
set U Xi-of ? ; position of each community in the face of the event
set V (V + U)
if (U < 1) [ask self [set score (score + 1)]]
]
]
];close isolated if
];close if2
[;open else2;;staying depends on communities positions
set CNp length liked-by-of patch-here ;; nb of communities supporting the resources on the patch
ifelse (CNp > 0)
[;open if3;;there are communities supporting the resources of the patch
set V 0
set WOp liked-byw-of patch-here ; list of who of communities
foreach WOp
[
without-interruption
[
set U Xi-of ? ; position of each community in the face of the event
set V (V + U)
]
]
ifelse (V > 0)
[;open if4;; communities as opponant of T dev. are not majority: tourist stays here
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
set tourist-satisfaction 1
;but conflicts with opponants
foreach WOp
[
without-interruption
[
set U Xi-of ? ; position of each community in the face of the event
if (U < 1) [ask self [set score (score + 1)]]
]
]
;if (BottomUpRegulation? = true)
; [
; set aa count turtles with [breed = communities and who < TTN and Xi = 0]
; if aa > 0
; [
; set tt turtles with [breed = communities and who < TTN and Xi = 0]
; ask random-one-of tt
; [;one communities shift from 'neutral' to 'con' T development
; without-interruption [set Xi -1]
; ]
; ]
; ]
];close if4
[;open else 4;; opponants are majority:tourist doesn't stay here
set attempt attempt + 1
move-to-upper-preferences
];close else 4
];close if3
[;open else3;;there are no communities supporting the patch: tourist stays here
ask patch-here
[
without-interruption
[
set visited-by lput label-of myself visited-by
set visited-byw lput myself visited-byw
]
]
set tourist-satisfaction 1
];close else3
];close else2
];close else1
end
to setup-newtourists-preferences
locals [Wi Nts NewTs OTs RTS]
; ;remove current unsatisfied green tourists
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; set OTs count turtles with
; [
; breed = tourists
; and tourist-satisfaction > 2
; and (substring label 0 1 = "T" ); who < TTN ; only "actual" tourists
; and
; (
; preffor-natural-resources = 0
; or preffor-cultural-resources = 0
; )
; ];close with
;
; if (OTs > 0)
; [;there are unstatisfied tourists
; ifelse OTs >= NewTs
; [set RTs round ((NewTs / 4) + 1)]
; [set RTs round ((OTs / 4) + 1)]
;
; ask random-n-of RTs turtles with
; [;kill them
; breed = tourists
; and tourist-satisfaction > 2
; and (substring label 0 1 = "T" ); who < TTN ; only "actual" tourists
; and
; (
; preffor-natural-resources = 0
; or preffor-cultural-resources = 0
; )
; ];close with
; [
; ;show label
;; type label print " didn't found a patch that matched his preferences: he didn't stay on the place"
; set KilledTourists (KilledTourists + 1)
; die
; ];close ask
; ];close if
; set numof-unsatisfied-tourists (count turtles with [breed = tourists and tourist-satisfaction > 2] + KilledTourists)
; type numof-unsatisfied-tourists print " unsatisfied tourists"
;; search for green tourists among the current tourists
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
without-interruption
[
ask patches with [visited-by != []]
[
set visited-byw []
foreach visited-by
[
set Wi ?
if (substring Wi 0 1 = "n" ) [set visited-by remove Wi visited-by]
]
]
]
without-interruption
[
ask turtles with [breed = tourists and who >= TTN] [die]
]
set NewTs (NewTourists * iteration)
set NTs count turtles with
[
breed = tourists
and
(
preffor-natural-resources = 1 ; with high preference for natural resources
or preffor-cultural-resources = 1 ; with high preference for cultural resources
)
];close with
ifelse (NTs > 0)
[; there are green tourists
repeat NewTs
[
ask random-one-of turtles with
[
breed = tourists
and who < TTN
and
(
preffor-natural-resources = 1 ; with high preference for natural resources
or preffor-cultural-resources = 1 ; with high preference for cultural resources
)
];close with
[; open ask create new green tourists with other features of the current satisfied green tourists
hatch 1
[
set shape "default"
set label word "nt" who; -of myself
set preffor-natural-resources 1
set preffor-cultural-resources 1
set tourist-freq 1
];close hatch
];close ask
];close repeat
type NewTs
print " 'new' tourists come on the place with high preference for natural and cultural resources"
print " and other expectations (randomly) like the current 'green' tourists"
];close if else 1
[;there are no current green tourists
repeat NewTs
[
ask random-one-of turtles with
[
breed = tourists
and who < TTN
and tourist-satisfaction < 3
];close with
[; open ask create new green tourists with other features of the current satisfied green tourists
hatch 1
[
set shape "default"
set label word "nt" who; -of myself
set preffor-natural-resources 1
set preffor-cultural-resources 1
set preffor-social-resources precision (random-int-or-float 1.0) 1;(MeanLevelOfSocialResources * ResourcesThreshold)
set preffor-economic-resources precision (random-int-or-float 1.0) 1;(MeanLevelOfEconomicResources * ResourcesThreshold)
set tourist-freq 1
];close hatch
];close ask
];close repeat
type NewTs
print " 'new' tourists come on the place with high preference for natural and cultural resources"
print " and other expectations (randomly) like the current tourists"
];close else
type "total number of tourists = " print count turtles with [breed = tourists]
end
to print-preferences-satisfaction
type "; pnr: " type precision (value-from (patch-here) [natural-resources ]) 1 type " tnr: "type precision (preffor-natural-resources) 1
type " pcr: " type precision (value-from (patch-here) [cultural-resources ]) 1 type " tcr: " type precision (preffor-cultural-resources) 1
type " psr: " type precision (value-from (patch-here) [social-resources ]) 1 type " tsr: " type precision (preffor-social-resources) 1
type " per: " type precision (value-from (patch-here) [economic-resources ]) 1 type " ter: " print precision (preffor-economic-resources) 1
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;to simulate mimetism in collective behaviours
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to simulate-dynamicsof-positions
setup-communities-positions
setup-controllers-positions
setup-businesses-positions
setup-gatekeepers-positions
set Rcon count turtles with [(breed = controllers) and who < TTN and Xi < 0 ]; print " controllers 'con' T development"
set Rneu count turtles with [(breed = controllers) and who < TTN and Xi = 0 ]; print " controllers 'for' T maintaining"
set Rfor count turtles with [(breed = controllers) and who < TTN and Xi > 0 ]; print " controllers 'for' T development"
set Bcon count turtles with [(breed = businesses) and who < TTN and Xi < 0 ]; print " businesses 'con' T development"
set Bneu count turtles with [(breed = businesses) and who < TTN and Xi = 0 ]; print " businesses 'for' T maintaining"
set Bfor count turtles with [(breed = businesses) and who < TTN and Xi > 0 ]; print " businesses 'for' T development"
set Gcon count turtles with [(breed = gatekeepers) and who < TTN and Xi < 0 ]; print " gatekeepers 'con' T development"
set Gneu count turtles with [(breed = gatekeepers) and who < TTN and Xi = 0 ]; print " gatekeepers 'for' T maintaining"
set Gfor count turtles with [(breed = gatekeepers) and who < TTN and Xi > 0 ]; print " gatekeepers 'for' T development"
set Ccon count turtles with [(breed = communities) and who < TTN and Xi < 0 ]; print " communities 'con' T development"
set Cneu count turtles with [(breed = communities) and who < TTN and Xi = 0 ]; print " communities 'for' T maintaining"
set Cfor count turtles with [(breed = communities) and who < TTN and Xi > 0 ]; print " communities 'for' T development"
end
to setup-communities-positions
locals [aa InitMeanLevelOfTouristsDensity InitCommunitiesFor InitCommunitiesNeutral InitCommunitiesAgainst]
set InitCommunitiesAgainst count turtles with [breed = communities and who < TTN and Xi < 0]
set InitCommunitiesNeutral count turtles with [breed = communities and who < TTN and Xi = 0]
set InitCommunitiesFor count turtles with [breed = communities and who < TTN and Xi > 0]
set InitMeanLevelOfTouristsDensity MeanLevelOfTouristsDensity
set MeanLevelOfTouristsDensity (mean values-from patches with [visited-by != []] [length visited-by])
set aa round (InitCommunitiesNeutral * 0.5)
if (aa >= 5)
[;there are communities for maintaining T
ifelse ((MeanLevelOfTouristsDensity - InitMeanLevelOfTouristsDensity) / InitMeanLevelOfTouristsDensity) > 0.2
[;tourist density increased
type aa print " communities shift from 'neutral' to 'con' T dev."
ask random-one-of turtles with [breed = communities and who < TTN and Xi = 0 ]
[;one communities shift from 'neutral' to 'con' T development
without-interruption [set Xi -1]
]
]
[;tourists density decreased
type aa print " communities shift from 'neutral' to 'pro' T dev."
ask random-one-of turtles with [breed = communities and who < TTN and Xi = 0 ]
[;one communities shift from 'neutral' to 'con' T development
without-interruption [set Xi 1]
]
]
]
if (aa > 0 and aa < 5)
[;there are communities for maintaining T
ifelse ((MeanLevelOfTouristsDensity - InitMeanLevelOfTouristsDensity) / InitMeanLevelOfTouristsDensity) > 0.2
[;tourist density increased
type aa print " communities shift from 'neutral' to 'con' T dev."
ask random-one-of turtles with [breed = communities and who < TTN and Xi = 0 ]
[;one communities shift from 'neutral' to 'con' T development
without-interruption [set Xi -1]
]
]
[;tourists density decreased
type aa print " communities shift from 'neutral' to 'pro' T dev."
ask random-one-of turtles with [breed = communities and who < TTN and Xi = 0 ]
[;one communities shift from 'neutral' to 'con' T development
without-interruption [set Xi 1]
]
]
]
end
to setup-controllers-positions ; simulte influence of gains on controllers position about T dev. (Xi)
locals [aa InitcontrollersFor InitcontrollersAgainst FinalcontrollersFor FinalcontrollersAgainst]
set InitcontrollersFor count turtles with [breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 1] ;white
set InitcontrollersAgainst count turtles with [breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 0] ;black
set changed? false ;; assume that no turtle will change its colour
ask turtles with [breed = controllers and who < TTN]
[
without-interruption
[
ifelse (Gains > 0 )
[set strength ((size * Si) + ln Gains)]
[set strength (size * Si)]
]
]
ask random-n-of 5 turtles with [breed = controllers and who < TTN]
[
without-interruption
[
ControllersBeInfluenced
]
]
set FinalcontrollersFor count turtles with [breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 1] ;white
set FinalcontrollersAgainst count turtles with [breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 0] ;black
ifelse (not changed?)
[stop] ;; stop if no turtle has changed its colour
[type (FinalcontrollersFor - InitcontrollersFor) print " more/less controllers support this T development"]
end
to ControllersBeInfluenced ;; turtle procedure
;; find the impact of supporters and opposers and change my colour
;; if the opposers' impact is greater than the supporters'
locals [impactFromWhite impactFromBlack]
set impactFromWhite sum values-from turtles with
[breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 1]
[impact myself] ;white
ifelse (impactFromWhite > 0)
[set impactFromWhite mean values-from turtles with
[breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 1]
[impact myself] ;white
;type label type ":"print impactFromWhite
]
[set impactFromWhite 0
]
set impactFromBlack sum values-from turtles with
[breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 0]
[impact myself] ;black
;type label type ":"print impactFromBlack
ifelse (impactFromBlack > 0)
[
set impactFromBlack mean values-from turtles with
[breed = controllers and who < TTN and PositionInFaceOfCollectiveObjective = 0]
[impact myself] ;black
;type label type ":"print impactFromBlack
]
[set impactFromBlack 0
]
ifelse (impactFromWhite > impactFromBlack) ;; if the impact from whites is greater than that
;; from blacks, change the turtle's colour to
;; white, and vice versa
[
if (PositionInFaceOfCollectiveObjective = 0) [set changed? true]
set PositionInFaceOfCollectiveObjective 1
ifelse (CollectiveObjective = "all together")
[set Xi 1 set Q5113i 999]
[set Xi 1 set Ei collective-build-in-goal]
]
[
if (PositionInFaceOfCollectiveObjective = 1) [set changed? true]
set PositionInFaceOfCollectiveObjective 0
set Xi -1
]
end
to setup-businesses-positions ; simulte influence of gains on businesses position about T dev. (Xi)
locals [InitBusinessesFor InitBusinessesAgainst FinalBusinessesFor FinalBusinessesAgainst]
set InitBusinessesFor count turtles with [breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 1] ;white
set InitBusinessesAgainst count turtles with [breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 0] ;black
set changed? false ;; assume that no turtle will change its colour
ask turtles with [breed = businesses and who < TTN]
[
without-interruption
[
ifelse (Gains > 0 )
[set strength ((size * Si) + ln Gains)]
[set strength (size * Si)]
]
]
ask random-n-of 10 turtles with [breed = businesses and who < TTN]
[
without-interruption
[
BusinessesBeInfluenced
]
]
set FinalBusinessesFor count turtles with [breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 1] ;white
set FinalBusinessesAgainst count turtles with [breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 0] ;black
ifelse (not changed?)
[stop] ;; stop if no turtle has changed its colour
[type (FinalBusinessesFor - InitBusinessesFor) print " businesses more/less support this T development" ]
end
to BusinessesBeInfluenced ;; turtle procedure
;; find the impact of supporters and opposers and change my colour
;; if the opposers' impact is greater than the supporters'
locals [impactFromWhite impactFromBlack]
set impactFromWhite sum values-from turtles with
[breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 1]
[impact myself] ;white
ifelse (impactFromWhite > 0)
[set impactFromWhite mean values-from turtles with
[breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 1]
[impact myself] ;white
;type label type ":"print impactFromWhite
]
[set impactFromWhite 0
]
set impactFromBlack sum values-from turtles with
[breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 0]
[impact myself] ;black
;type label type ":"print impactFromBlack
ifelse (impactFromBlack > 0)
[
set impactFromBlack mean values-from turtles with
[breed = businesses and who < TTN and PositionInFaceOfCollectiveObjective = 0]
[impact myself] ;black
;type label type ":"print impactFromBlack
]
[set impactFromBlack 0
]
ifelse (impactFromWhite > impactFromBlack) ;; if the impact from whites is greater than that
;; from blacks, change the turtle's colour to
;; white, and vice versa
[
if (PositionInFaceOfCollectiveObjective = 0) [set changed? true]
set PositionInFaceOfCollectiveObjective 1
ifelse (CollectiveObjective = "all together")
[set Xi 1 set Q5113i 999]
[set Xi 1 set Ei collective-build-in-goal]
]
[
if (PositionInFaceOfCollectiveObjective = 1) [set changed? true]
set PositionInFaceOfCollectiveObjective 0
set Xi -1
]
end
to setup-gatekeepers-positions ; simulte influence of gains on gatekeepers position about T dev. (Xi)
locals [InitgatekeepersFor InitgatekeepersAgainst FinalgatekeepersFor FinalgatekeepersAgainst]
set InitgatekeepersFor count turtles with [breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 1] ;white
set InitgatekeepersAgainst count turtles with [breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 0] ;black
set changed? false ;; assume that no turtle will change its colour
ask turtles with [breed = gatekeepers and who < TTN]
[
without-interruption
[
ifelse (Gains > 0 )
[set strength ((size * Si) + ln Gains)]
[set strength (size * Si)]
]
]
ask random-n-of 5 turtles with [breed = gatekeepers and who < TTN]
[
without-interruption
[
gatekeepersBeInfluenced
]
]
set FinalgatekeepersFor count turtles with [breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 1] ;white
set FinalgatekeepersAgainst count turtles with [breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 0] ;black
ifelse (not changed?)
[stop] ;; stop if no turtle has changed its colour
[type (FinalgatekeepersFor - InitgatekeepersFor) print " gatekeepers more/less support this T development" ]
end
to gatekeepersBeInfluenced ;; turtle procedure
;; find the impact of supporters and opposers and change my colour
;; if the opposers' impact is greater than the supporters'
locals [impactFromWhite impactFromBlack]
set impactFromWhite sum values-from turtles with
[breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 1]
[impact myself] ;white
ifelse (impactFromWhite > 0)
[set impactFromWhite mean values-from turtles with
[breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 1]
[impact myself] ;white
;type label type ":"print impactFromWhite
]
[set impactFromWhite 0
]
set impactFromBlack sum values-from turtles with
[breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 0]
[impact myself] ;black
;type label type ":"print impactFromBlack
ifelse (impactFromBlack > 0)
[
set impactFromBlack mean values-from turtles with
[breed = gatekeepers and who < TTN and PositionInFaceOfCollectiveObjective = 0]
[impact myself] ;black
;type label type ":"print impactFromBlack
]
[set impactFromBlack 0
]
ifelse (impactFromWhite > impactFromBlack) ;; if the impact from whites is greater than that
;; from blacks, change the turtle's colour to
;; white, and vice versa
[
if (PositionInFaceOfCollectiveObjective = 0) [set changed? true]
set PositionInFaceOfCollectiveObjective 1
ifelse (CollectiveObjective = "all together")
[set Xi 1 set Q5113i 999]
[set Xi 1 set Ei collective-build-in-goal]
]
[
if (PositionInFaceOfCollectiveObjective = 1) [set changed? true]
set PositionInFaceOfCollectiveObjective 0
set Xi -1
]
end
to-report impact [otherTurtle] ;; turtle procedure
;; report the impact of otherTurtle on myself
locals [dis q]
;set dis distance otherTurtle
set dis 0
ifelse (Xi = Xi-of otherTurtle) ; objectives of i and j are similar (diagonale)
[
set dis dis + 1
]
[
if (Xi + Xi-of otherTurtle = 1) [set dis dis + 2 ] ;i or j is for maintaining and the other for increasing
if (Xi + Xi-of otherTurtle = -1)[set dis dis + 2 ] ;i or j is for maintaining and the other for decreasing
if (Xi != 0 and (Xi + Xi-of otherTurtle = 0)) [set dis dis + 5 ] ;i and j are opposite (extrema position in triangle)
if (Xi-of otherTurtle != 0 and (Xi + Xi-of otherTurtle = 0)) [set dis dis + 5 ] ;i and j are opposite (extrema position in triangle)
]
ifelse (Ei = Ei-of otherTurtle) ; preference of i and j are similar
[set dis dis + 0]
[set dis dis + 1]
if (dis = 0) [set dis 1 ] ; 1 = self-distance
;show dis
;; (exp ((ln dis) * exponent)) calculates d to the power 'exponent'
set q square (strength / (exp ((ln dis) * 2))) ; 2 = exponent
;show q
report q
end
to-report square [x]
report x * x
end
to do-bookkeeping-initial-patch-counts
store-initial-patch-counts
set-current-plot "Provisioned Resources"
do-plotting-controls
set-current-plot "Used Resources"
do-plotting-uses
set-current-plot "Promoted Resources"
do-plotting-promotions
set-current-plot "Visited Resources"
do-plotting-visits
set-current-plot "Tourists Density"
do-plotting-visitors
set-current-plot "Tourists"
do-plotting-unsatisfactions
set-current-plot "Communities"
do-plotting-conflicts
end
to store-initial-patch-counts
locals [aa ]
set numof-controlled-patcheswith-natural-resources count patches with [natural-resources > 0.5 and controlled-by != []]
set numof-controlled-patcheswith-cultural-resources count patches with [cultural-resources > 0.5 and controlled-by != []]
set numof-controlled-patcheswith-social-resources count patches with [social-resources > 0.5 and controlled-by != []]
set numof-controlled-patcheswith-economic-resources count patches with [economic-resources > 0.5 and controlled-by != []]
set numof-used-patcheswith-natural-resources count patches with [natural-resources > 0.5 and used-by != []]
set numof-used-patcheswith-cultural-resources count patches with [cultural-resources > 0.5 and used-by != []]
set numof-used-patcheswith-social-resources count patches with [social-resources > 0.5 and used-by != []]
set numof-used-patcheswith-economic-resources count patches with [economic-resources > 0.5 and used-by != []]
set numof-promoted-patcheswith-natural-resources count patches with [natural-resources > 0.5 and promoted-by != []]
set numof-promoted-patcheswith-cultural-resources count patches with [cultural-resources > 0.5 and promoted-by != []]
set numof-promoted-patcheswith-social-resources count patches with [social-resources > 0.5 and promoted-by != []]
set numof-promoted-patcheswith-economic-resources count patches with [economic-resources > 0.5 and promoted-by != []]
set numof-visited-patcheswith-natural-resources count patches with [natural-resources > 0.5 and visited-by != []]
set numof-visited-patcheswith-cultural-resources count patches with [cultural-resources > 0.5 and visited-by != []]
set numof-visited-patcheswith-social-resources count patches with [social-resources > 0.5 and visited-by != []]
set numof-visited-patcheswith-economic-resources count patches with [economic-resources > 0.5 and visited-by != []]
set numof-visitorsof-patcheswith-natural-resources
(sum values-from patches with [natural-resources > 0.5 and visited-by != []][length visited-by ]
/ (numof-visited-patcheswith-natural-resources + 1))
set numof-visitorsof-patcheswith-cultural-resources
(sum values-from patches with [cultural-resources > 0.5 and visited-by != []][length visited-by ]
/ (numof-visited-patcheswith-cultural-resources + 1))
set numof-visitorsof-patcheswith-social-resources
(sum values-from patches with [social-resources > 0.5 and visited-by != []][length visited-by ]
/ (numof-visited-patcheswith-social-resources + 1))
set numof-visitorsof-patcheswith-economic-resources
(sum values-from patches with [economic-resources > 0.5 and visited-by != []][length visited-by ]
/ (numof-visited-patcheswith-economic-resources + 1))
set Rcon count turtles with [(breed = controllers) and who < TTN and Xi < 0 ]; print " controllers 'con' T development"
set Rneu count turtles with [(breed = controllers) and who < TTN and Xi = 0 ]; print " controllers 'for' T maintaining"
set Rfor count turtles with [(breed = controllers) and who < TTN and Xi > 0 ]; print " controllers 'for' T development"
set Bcon count turtles with [(breed = businesses) and who < TTN and Xi < 0 ]; print " businesses 'con' T development"
set Bneu count turtles with [(breed = businesses) and who < TTN and Xi = 0 ]; print " businesses 'for' T maintaining"
set Bfor count turtles with [(breed = businesses) and who < TTN and Xi > 0 ]; print " businesses 'for' T development"
set Gcon count turtles with [(breed = gatekeepers) and who < TTN and Xi < 0 ]; print " gatekeepers 'con' T development"
set Gneu count turtles with [(breed = gatekeepers) and who < TTN and Xi = 0 ]; print " gatekeepers 'for' T maintaining"
set Gfor count turtles with [(breed = gatekeepers) and who < TTN and Xi > 0 ]; print " gatekeepers 'for' T development"
set Ccon count turtles with [(breed = communities) and who < TTN and Xi < 0 ]; print " communities 'con' T development"
set Cneu count turtles with [(breed = communities) and who < TTN and Xi = 0 ]; print " communities 'for' T maintaining"
set Cfor count turtles with [(breed = communities) and who < TTN and Xi > 0 ]; print " communities 'for' T development"
set numof-unsatisfied-tourists (count turtles with [breed = tourists and tourist-satisfaction > 2] + KilledTourists)
;set numof-unsatisfied-communities HostCommunitiesConflicts
set aa count turtles with [breed = tourists and who >= TTN and score > 0]
ifelse (aa > 0) [
set avenumof-unsatisfied-communities precision (mean values-from turtles with [breed = tourists and who >= TTN][score]) 2
;set minnumof-unsatisfied-communities precision (min values-from turtles with [breed = tourists and who >= TTN][score]) 2
;set maxnumof-unsatisfied-communities precision (max values-from turtles with [breed = tourists and who >= TTN][score]) 2
]
[
set avenumof-unsatisfied-communities 0
;set minnumof-unsatisfied-communities 0
;set maxnumof-unsatisfied-communities 0
]
end
to print-initial-situation
locals [ nn kk ss ee rr bb pp vv tp]
; set tp count patches
; set nn count patches with [natural-resources > 0.5]
; set kk count patches with [cultural-resources > 0.5]
; set ss count patches with [social-resources > 0.5]
; set ee count patches with [economic-resources > 0.5]
; set rr count patches with [controlled-by != []]
; set bb count patches with [used-by != []]
; set pp count patches with [promoted-by != []]
; set vv count patches with [visited-by != []]
set MeanLevelOfResources (mean values-from patches with [plabel != "§"] [resources])
set MeanLevelOfNaturalResources (mean values-from patches with [plabel != "§"] [natural-resources])
set MeanLevelOfCulturalResources (mean values-from patches with [plabel != "§"] [cultural-resources])
set MeanLevelOfSocialResources (mean values-from patches with [plabel != "§"] [social-resources])
set MeanLevelOfEconomicResources (mean values-from patches with [plabel != "§"] [economic-resources])
set MeanLevelOfResources (mean values-from patches with [plabel != "§"] [resources])
set MeanLevelOfNaturalResources (mean values-from patches with [plabel != "§"] [natural-resources])
set MeanLevelOfCulturalResources (mean values-from patches with [plabel != "§"] [cultural-resources])
set MeanLevelOfSocialResources (mean values-from patches with [plabel != "§"] [social-resources])
set MeanLevelOfEconomicResources (mean values-from patches with [plabel != "§"] [economic-resources])
set MeanLevelOfTouristsDensity (mean values-from patches with [visited-by != []] [length visited-by])
set MaxTouristsDensity (MeanLevelOfTouristsDensity * TouristsDensityEvolution)
set MeanLevelOfTPrefforNaturalResources (mean values-from turtles with [breed = tourists] [preffor-natural-resources])
set MeanLevelOfTPrefforCulturalResources (mean values-from turtles with [breed = tourists] [preffor-cultural-resources])
set MeanLevelOfTPrefforSocialResources (mean values-from turtles with [breed = tourists] [preffor-social-resources])
set MeanLevelOfTPrefforEconomicResources (mean values-from turtles with [breed = tourists] [preffor-economic-resources])
set MeanLevelOfRBGPrefforNaturalResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [preffor-natural-resources])
set MeanLevelOfRBGPrefforCulturalResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [preffor-cultural-resources])
set MeanLevelOfRBGPrefforSocialResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [preffor-social-resources])
set MeanLevelOfRBGPrefforEconomicResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [preffor-economic-resources])
set MeanLevelOfRBGPerceptOfPrefforNaturalResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [perceptionoftpreffor-natural-resources])
set MeanLevelOfRBGPerceptOfPrefforCulturalResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [perceptionoftpreffor-cultural-resources])
set MeanLevelOfRBGPerceptOfPrefforSocialResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [perceptionoftpreffor-social-resources])
set MeanLevelOfRBGPerceptOfPrefforEconomicResources (mean values-from turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN] [perceptionoftpreffor-economic-resources])
print "Current situation"
type count turtles with [breed = controllers and who < TTN] print " controllers"
type count turtles with [breed = businesses and who < TTN] print " businesses"
type count turtles with [breed = gatekeepers and who < TTN] print " gatkeepers"
type count turtles with [breed = communities and who < TTN] print " communities"
type count turtles with [breed = institutions and who < TTN] print " institutions"
type count turtles with [breed = tourists and who < TTN] print " tourists"
set Rcon count turtles with [(breed = controllers) and who < TTN and Xi < 0 ]; print " controllers 'con' T development"
set Rneu count turtles with [(breed = controllers) and who < TTN and Xi = 0 ]; print " controllers 'for' T maintaining"
set Rfor count turtles with [(breed = controllers) and who < TTN and Xi > 0 ]; print " controllers 'for' T development"
set Bcon count turtles with [(breed = businesses) and who < TTN and Xi < 0 ]; print " businesses 'con' T development"
set Bneu count turtles with [(breed = businesses) and who < TTN and Xi = 0 ]; print " businesses 'for' T maintaining"
set Bfor count turtles with [(breed = businesses) and who < TTN and Xi > 0 ]; print " businesses 'for' T development"
set Gcon count turtles with [(breed = gatekeepers) and who < TTN and Xi < 0 ]; print " gatekeepers 'con' T development"
set Gneu count turtles with [(breed = gatekeepers) and who < TTN and Xi = 0 ]; print " gatekeepers 'for' T maintaining"
set Gfor count turtles with [(breed = gatekeepers) and who < TTN and Xi > 0 ]; print " gatekeepers 'for' T development"
set Ccon count turtles with [(breed = communities) and who < TTN and Xi < 0 ]; print " communities 'con' T development"
set Cneu count turtles with [(breed = communities) and who < TTN and Xi = 0 ]; print " communities 'for' T maintaining"
set Cfor count turtles with [(breed = communities) and who < TTN and Xi > 0 ]; print " communities 'for' T development"
type Rcon print " controllers 'con' T development"
type Rneu print " controllers 'for' T maintaining"
type Rfor print " controllers 'for' T development"
type Bcon print " businesses 'con' T development"
type Bneu print " businesses 'for' T maintaining"
type Bfor print " businesses 'for' T development"
type Gcon print " gatekeepers 'con' T development"
type Gneu print " gatekeepers 'for' T maintaining"
type Gfor print " gatekeepers 'for' T development"
type Ccon print " communities 'con' T development"
type Cneu print " communities 'for' T maintaining"
type Cfor print " communities 'for' T development"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 0] print " RBG supporters of T dev. via more provision"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 2] print " RBG supporters of T dev. via more control"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 4] print " RBG supporters of T dev. via new regulation"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 6] print " RBG supporters of T dev. via more appl.of cur.reg."
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 8] print " RBG supporters of T dev. via more supply"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 10] print " RBG supporters of T dev. via more promotion"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and Ei = 12] print " RBG supporters of T dev. via more cooperation"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and (member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5)] print " RBG supporters of T dev. as cooperators"
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and (preffor-natural-resources = 1 or preffor-natural-resources = 1)] print " RBG supporters of T dev. focusing on na. or cult. res."
type count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN and Xi = 1 and (perceptionofTpreffor-natural-resources = 1 or perceptionofTpreffor-natural-resources = 1)] print " RBG supp.of T dev.believing pos.impact of nat. or cult.res."
type "MeanLevelOfTouristsDensity " print precision MeanLevelOfTouristsDensity 2
;type "MaxTouristsDensity " print precision MaxTouristsDensity 2
type "MeanLevelOfResources " print precision MeanLevelOfResources 2
type "MeanLevelOfNaturalResources " print precision MeanLevelOfNaturalResources 2
type "MeanLevelOfCulturalResources " print precision MeanLevelOfCulturalResources 2
type "MeanLevelOfSocialResources " print precision MeanLevelOfSocialResources 2
type "MeanLevelOfEconomicResources " print precision MeanLevelOfEconomicResources 2
type "MeanLevelOfTPrefforNaturalResources " print precision MeanLevelOfTPrefforNaturalResources 2
type "MeanLevelOfTPrefforCulturalResources " print precision MeanLevelOfTPrefforCulturalResources 2
type "MeanLevelOfTPrefforSocialResources " print precision MeanLevelOfTPrefforSocialResources 2
type "MeanLevelOfTPrefforEconomicResources " print precision MeanLevelOfTPrefforEconomicResources 2
type "MeanLevelOfRBGPrefforNaturalResources " print precision MeanLevelOfRBGPrefforNaturalResources 2
type "MeanLevelOfRBGPrefforCulturalResources " print precision MeanLevelOfRBGPrefforCulturalResources 2
type "MeanLevelOfRBGPrefforSocialResources " print precision MeanLevelOfRBGPrefforSocialResources 2
type "MeanLevelOfRBGPrefforEconomicResources " print precision MeanLevelOfRBGPrefforEconomicResources 2
type "MeanLevelOfRBGPerceptOfPrefforNaturalResources " print precision MeanLevelOfRBGPerceptOfPrefforNaturalResources 2
type "MeanLevelOfRBGPerceptOfPrefforCulturalResources " print precision MeanLevelOfRBGPerceptOfPrefforCulturalResources 2
type "MeanLevelOfRBGPerceptOfPrefforSocialResources " print precision MeanLevelOfRBGPerceptOfPrefforSocialResources 2
type "MeanLevelOfRBGPerceptOfPrefforEconomicResources " print precision MeanLevelOfRBGPerceptOfPrefforEconomicResources 2
end
to print-initial-patch-counts2
locals [aa]
set numof-controlled-patches count patches with [controlled-by != []]
set numof-used-patches count patches with [used-by != []]
set numof-promoted-patches count patches with [promoted-by != []]
set numof-visited-patches count patches with [visited-by != []]
set numof-unsatisfied-tourists (count turtles with [breed = tourists and tourist-satisfaction > 2] + KilledTourists)
;set numof-unsatisfied-communities HostCommunitiesConflicts
set aa count turtles with [breed = tourists and who >= TTN and score > 0]
ifelse (aa > 0) [
set avenumof-unsatisfied-communities round (mean values-from turtles with [breed = tourists and who >= TTN][score])
;set minnumof-unsatisfied-communities round (min values-from turtles with [breed = tourists and who >= TTN][score])
;set maxnumof-unsatisfied-communities round (max values-from turtles with [breed = tourists and who >= TTN][score])
]
[
set avenumof-unsatisfied-communities 0
;set minnumof-unsatisfied-communities 0
;set maxnumof-unsatisfied-communities 0
]
type "numof-controlled-patches: " print numof-controlled-patches
type "numof-used-patches: " print numof-used-patches
type "numof-promoted-patches: " print numof-promoted-patches
type "numof-visited-patches: " print numof-visited-patches
type "numof-unsatisfied-tourists: " print numof-unsatisfied-tourists
type "meannumof-conflicts-with-communities /new tourist: " print avenumof-unsatisfied-communities
end
to print-initial-patch-counts1
type "numof-controlled-patcheswith-natural-resources: " print numof-controlled-patcheswith-natural-resources
type "numof-controlled-patcheswith-cultural-resources: " print numof-controlled-patcheswith-cultural-resources
type "numof-controlled-patcheswith-social-resources: " print numof-controlled-patcheswith-social-resources
type "numof-controlled-patcheswith-economic-resources: " print numof-controlled-patcheswith-economic-resources
type "numof-used-patcheswith-natural-resources: " print numof-used-patcheswith-natural-resources
type "numof-used-patcheswith-cultural-resources: " print numof-used-patcheswith-cultural-resources
type "numof-used-patcheswith-social-resources: " print numof-used-patcheswith-social-resources
type "numof-used-patcheswith-economic-resources: " print numof-used-patcheswith-economic-resources
type "numof-promoted-patcheswith-natural-resources: " print numof-promoted-patcheswith-natural-resources
type "numof-promoted-patcheswith-cultural-resources: " print numof-promoted-patcheswith-cultural-resources
type "numof-promoted-patcheswith-social-resources: " print numof-promoted-patcheswith-social-resources
type "numof-promoted-patcheswith-economic-resources: " print numof-promoted-patcheswith-economic-resources
type "numof-visited-patcheswith-natural-resources: " print numof-visited-patcheswith-natural-resources
type "numof-visited-patcheswith-cultural-resources: " print numof-visited-patcheswith-cultural-resources
type "numof-visited-patcheswith-social-resources: " print numof-visited-patcheswith-social-resources
type "numof-visited-patcheswith-economic-resources: " print numof-visited-patcheswith-economic-resources
type "numof-visitorsof-patcheswith-natural-resources: " print precision numof-visitorsof-patcheswith-natural-resources 4
type "numof-visitorsof-patcheswith-cultural-resources: " print precision numof-visitorsof-patcheswith-cultural-resources 4
type "numof-visitorsof-patcheswith-social-resources: " print precision numof-visitorsof-patcheswith-social-resources 4
type "numof-visitorsof-patcheswith-economic-resources: " print precision numof-visitorsof-patcheswith-economic-resources 4
end
to do-plotting-behaviours-reg
set-current-plot "Controllers Behaviours"
set-current-plot-pen "defect"
plot Rcon
set-current-plot-pen "cooperate"
plot Rfor
set-current-plot-pen "tit-for-tat"
plot Rneu
set-current-plot "Businesses Behaviours"
set-current-plot-pen "defect"
plot Bcon
set-current-plot-pen "cooperate"
plot Bfor
set-current-plot-pen "tit-for-tat"
plot Bneu
set-current-plot "Gatekeepers Behaviours"
set-current-plot-pen "defect"
plot Gcon
set-current-plot-pen "cooperate"
plot Gfor
set-current-plot-pen "tit-for-tat"
plot Gneu
set-current-plot "Communities"
set-current-plot-pen "Ccon"
plot Ccon
set-current-plot-pen "Cfor"
plot Cfor
set-current-plot-pen "Cneu"
plot Cneu
end
to do-plotting-controls
set-current-plot-pen "Natural"
plot numof-controlled-patcheswith-natural-resources
set-current-plot-pen "Cultural"
plot numof-controlled-patcheswith-cultural-resources
set-current-plot-pen "Social"
plot numof-controlled-patcheswith-social-resources
set-current-plot-pen "Economic"
plot numof-controlled-patcheswith-economic-resources
end
to do-plotting-uses
set-current-plot-pen "Natural"
plot numof-used-patcheswith-natural-resources
set-current-plot-pen "Cultural"
plot numof-used-patcheswith-cultural-resources
set-current-plot-pen "Social"
plot numof-used-patcheswith-social-resources
set-current-plot-pen "Economic"
plot numof-used-patcheswith-economic-resources
end
to do-plotting-promotions
set-current-plot-pen "Natural"
plot numof-promoted-patcheswith-natural-resources
set-current-plot-pen "Cultural"
plot numof-promoted-patcheswith-cultural-resources
set-current-plot-pen "Social"
plot numof-promoted-patcheswith-social-resources
set-current-plot-pen "Economic"
plot numof-promoted-patcheswith-economic-resources
end
to do-plotting-visits
set-current-plot-pen "Natural"
plot numof-visited-patcheswith-natural-resources
set-current-plot-pen "Cultural"
plot numof-visited-patcheswith-cultural-resources
set-current-plot-pen "Social"
plot numof-visited-patcheswith-social-resources
set-current-plot-pen "Economic"
plot numof-visited-patcheswith-economic-resources
end
to do-plotting-visitors
set-current-plot-pen "Natural"
plot numof-visitorsof-patcheswith-natural-resources
set-current-plot-pen "Cultural"
plot numof-visitorsof-patcheswith-cultural-resources
set-current-plot-pen "Social"
plot numof-visitorsof-patcheswith-social-resources
set-current-plot-pen "Economic"
plot numof-visitorsof-patcheswith-economic-resources
end
to do-plotting-conflicts-and-cooperations-RBGC
set-current-plot "Controllers Interactions"
set-current-plot-pen "conflict-R"
plot ((sum values-from turtles with [breed = controllers][conflict-with-R]) / count turtles with [breed = controllers and who < TTN])
set-current-plot-pen "conflict-B"
plot ((sum values-from turtles with [breed = controllers][conflict-with-B]) / count turtles with [breed = controllers and who < TTN])
set-current-plot-pen "conflict-G"
plot ((sum values-from turtles with [breed = controllers][conflict-with-G]) / count turtles with [breed = controllers and who < TTN])
set-current-plot-pen "cooperate-R"
plot ((sum values-from turtles with [breed = controllers][cooperation-with-R]) / count turtles with [breed = controllers and who < TTN])
set-current-plot-pen "cooperate-B"
plot ((sum values-from turtles with [breed = controllers][cooperation-with-B]) / count turtles with [breed = controllers and who < TTN])
set-current-plot-pen "cooperate-G"
plot ((sum values-from turtles with [breed = controllers][cooperation-with-G]) / count turtles with [breed = controllers and who < TTN])
set-current-plot "Businesses Interactions"
set-current-plot-pen "conflict-B"
plot ((sum values-from turtles with [breed = businesses][conflict-with-B]) / count turtles with [breed = businesses and who < TTN])
set-current-plot-pen "conflict-R"
plot ((sum values-from turtles with [breed = businesses][conflict-with-R]) / count turtles with [breed = businesses and who < TTN])
set-current-plot-pen "conflict-G"
plot ((sum values-from turtles with [breed = businesses][conflict-with-G]) / count turtles with [breed = businesses and who < TTN])
set-current-plot-pen "cooperate-B"
plot ((sum values-from turtles with [breed = businesses][cooperation-with-B]) / count turtles with [breed = businesses and who < TTN])
set-current-plot-pen "cooperate-R"
plot ((sum values-from turtles with [breed = businesses][cooperation-with-R]) / count turtles with [breed = businesses and who < TTN])
set-current-plot-pen "cooperate-G"
plot ((sum values-from turtles with [breed = businesses][cooperation-with-G]) / count turtles with [breed = businesses and who < TTN])
set-current-plot "Gatekeepers Interactions"
set-current-plot-pen "conflict-B"
plot ((sum values-from turtles with [breed = gatekeepers][conflict-with-B]) / count turtles with [breed = gatekeepers and who < TTN])
set-current-plot-pen "conflict-R"
plot ((sum values-from turtles with [breed = gatekeepers][conflict-with-R]) / count turtles with [breed = gatekeepers and who < TTN])
set-current-plot-pen "conflict-G"
plot ((sum values-from turtles with [breed = gatekeepers][conflict-with-G]) / count turtles with [breed = gatekeepers and who < TTN])
set-current-plot-pen "cooperate-B"
plot ((sum values-from turtles with [breed = gatekeepers][cooperation-with-B]) / count turtles with [breed = gatekeepers and who < TTN])
set-current-plot-pen "cooperate-R"
plot ((sum values-from turtles with [breed = gatekeepers][cooperation-with-R]) / count turtles with [breed = gatekeepers and who < TTN])
set-current-plot-pen "cooperate-G"
plot ((sum values-from turtles with [breed = gatekeepers][cooperation-with-G]) / count turtles with [breed = gatekeepers and who < TTN])
end
to do-plotting-conflicts-and-cooperations-RBG
set-current-plot "Controllers Interactions"
set-current-plot-pen "conflict-R"
plot sum values-from turtles with [breed = controllers][conflict-with-R]; / count turtles with [breed = controllers and who < TTN]
set-current-plot-pen "conflict-B"
plot sum values-from turtles with [breed = controllers][conflict-with-B]; / count turtles with [breed = controllers and who < TTN]
set-current-plot-pen "conflict-G"
plot sum values-from turtles with [breed = controllers][conflict-with-G]; / count turtles with [breed = controllers and who < TTN]
set-current-plot-pen "cooperate-R"
plot sum values-from turtles with [breed = controllers][cooperation-with-R]
set-current-plot-pen "cooperate-B"
plot sum values-from turtles with [breed = controllers][cooperation-with-B]
set-current-plot-pen "cooperate-G"
plot sum values-from turtles with [breed = controllers][cooperation-with-G]
if (iteration = Iterations)
[
type "conflict-RR: " print sum values-from turtles with [breed = controllers][conflict-with-R]
type "conflict-RB: " print sum values-from turtles with [breed = controllers][conflict-with-B]
type "conflict-RG: " print sum values-from turtles with [breed = controllers][conflict-with-G]
type "cooperate-RR: " print sum values-from turtles with [breed = controllers][cooperation-with-R]
type "cooperate-RB: " print sum values-from turtles with [breed = controllers][cooperation-with-B]
type "cooperate-RG: " print sum values-from turtles with [breed = controllers][cooperation-with-G]
]
set-current-plot "Businesses Interactions"
set-current-plot-pen "conflict-B"
plot sum values-from turtles with [breed = businesses][conflict-with-B]; / count turtles with [breed = businesses and who < TTN]
set-current-plot-pen "conflict-R"
plot sum values-from turtles with [breed = businesses][conflict-with-R]; / count turtles with [breed = businesses and who < TTN]
set-current-plot-pen "conflict-G"
plot sum values-from turtles with [breed = businesses][conflict-with-G]; / count turtles with [breed = businesses and who < TTN]
set-current-plot-pen "cooperate-B"
plot sum values-from turtles with [breed = businesses][cooperation-with-B]
set-current-plot-pen "cooperate-R"
plot sum values-from turtles with [breed = businesses][cooperation-with-R]
set-current-plot-pen "cooperate-G"
plot sum values-from turtles with [breed = businesses][cooperation-with-G]
if (iteration = Iterations)
[
type "conflict-BR: " print sum values-from turtles with [breed = businesses][conflict-with-R]
type "conflict-BB: " print sum values-from turtles with [breed = businesses][conflict-with-B]
type "conflict-BG: " print sum values-from turtles with [breed = businesses][conflict-with-G]
type "cooperate-BR: " print sum values-from turtles with [breed = businesses][cooperation-with-R]
type "cooperate-BB: " print sum values-from turtles with [breed = businesses][cooperation-with-B]
type "cooperate-BG: " print sum values-from turtles with [breed = businesses][cooperation-with-G]
]
set-current-plot "Gatekeepers Interactions"
set-current-plot-pen "conflict-B"
plot sum values-from turtles with [breed = gatekeepers][conflict-with-B]; / count turtles with [breed = gatekeepers and who < TTN]
set-current-plot-pen "conflict-R"
plot sum values-from turtles with [breed = gatekeepers][conflict-with-R]; / count turtles with [breed = gatekeepers and who < TTN]
set-current-plot-pen "conflict-G"
plot sum values-from turtles with [breed = gatekeepers][conflict-with-G]; / count turtles with [breed = gatekeepers and who < TTN]
set-current-plot-pen "cooperate-B"
plot sum values-from turtles with [breed = gatekeepers][cooperation-with-B]
set-current-plot-pen "cooperate-R"
plot sum values-from turtles with [breed = gatekeepers][cooperation-with-R]
set-current-plot-pen "cooperate-G"
plot sum values-from turtles with [breed = gatekeepers][cooperation-with-G]
if (iteration = Iterations)
[
type "conflict-GR: " print sum values-from turtles with [breed = gatekeepers][conflict-with-R]
type "conflict-GB: " print sum values-from turtles with [breed = gatekeepers][conflict-with-B]
type "conflict-GG: " print sum values-from turtles with [breed = gatekeepers][conflict-with-G]
type "cooperate-GR: " print sum values-from turtles with [breed = gatekeepers][cooperation-with-R]
type "cooperate-GB: " print sum values-from turtles with [breed = gatekeepers][cooperation-with-B]
type "cooperate-GG: " print sum values-from turtles with [breed = gatekeepers][cooperation-with-G]
]
end
to do-plotting-unsatisfactions
set-current-plot "Tourists"
set-current-plot-pen "Unsatisf"
plot numof-unsatisfied-tourists
end
to do-plotting-conflicts
set-current-plot "Communities"
set-current-plot-pen "Conflict"
plot avenumof-unsatisfied-communities
;set-current-plot-pen "MinConf"
;plot minnumof-unsatisfied-communities
;set-current-plot-pen "MaxConf"
;plot maxnumof-unsatisfied-communities
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; base scenario: possible conflicts about Xi Ei and role of resources
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-base-scenario
without-interruption
[
setup-controllers-energy
setup-businesses-energy
setup-gatekeepers-energy
update-lorenz-and-gini-plots
controllers-views-and-others
businesses-views-and-others
gatekeepers-views-and-others
communities-views-and-others
institutions-views-and-others
; print "Possible future conflicts generated by the actors expectations (ref Q2)"
count-conflictsXi-amongRBGCI
; print-conflictsXi-amongRBGCI
; print "Possible future conflicts generated by the actors strategies -- preferred actions (ref Q4)"
count-conflictsEi-amongRBGCI
; print-conflictsEi-amongRBGCI
; print "Possible future conflicts generated by the actors perceptions of natural resources"
count-conflictsVn-amongRBGCI
; print-conflictsVn-amongRBGCI
; print "Possible future conflicts generated by the actors perceptions of cultural resources"
count-conflictsVc-amongRBGCI
; print-conflictsVc-amongRBGCI
]
end
to setup-controllers-energy
locals [NT]
ask turtles with [breed = controllers and who < TTN]
[
without-interruption
[
set previous-energy energy
set NT sum values-from patches with [(visited-by != []) and (controlled-by != []) and (member? label-of myself controlled-by)][length visited-by]
ifelse (NT > 0)
[set energy (size + NT)]
[set energy size]
ifelse (iteration > 0)
[set gains (energy - previous-energy) set total-gains (total-gains + gains)]
[set gains (energy - size) set total-gains gains]
]
];end ask turtles
end
to setup-businesses-energy
locals [NT]
ask turtles with [breed = businesses and who < TTN]
[
without-interruption
[
set previous-energy energy
set NT sum values-from patches with [(visited-by != []) and (used-by != []) and (member? label-of myself used-by)][length visited-by]
ifelse (NT > 0)
[set energy (size + NT)]
[set energy size]
ifelse (iteration > 0)
[set gains (energy - previous-energy) set total-gains (total-gains + gains)]
[set gains (energy - size) set total-gains gains]
]
];end ask turtles
end
to setup-gatekeepers-energy
locals [NT]
ask turtles with [breed = gatekeepers and who < TTN]
[
without-interruption
[
set previous-energy energy
set NT sum values-from patches with [(visited-by != []) and (promoted-by != []) and (member? label-of myself promoted-by)][length visited-by]
ifelse (NT > 0)
[set energy (size + NT)]
[set energy size]
ifelse (iteration > 0)
[set gains (energy - previous-energy) set total-gains (total-gains + gains)]
[set gains (energy - size) set total-gains gains]
]
];end ask turtles
end
to update-lorenz-and-gini-plots
locals [WTPNG LTPNG ETPNG WTPNR LTPNR ETPNR WTPNB LTPNB ETPNB En total-wealth sorted-wealths wealth-sum-so-far index gini-index-reserve ]
; WTPN; list of lwho of turtles of production arena
; ETPN; list of energy of ...
; TPN ; number of turtles of ... (excluding phantoms)
set-current-plot "Scale (Lorenz Curve)"
clear-plot
;; draw a straight line from lower left to upper right
;set-current-plot-pen "equal"
;plot 100
;plot 0
;;;;;;;;;;;;;;;;;;;;;;
;gatekeepers
;;;;;;;;;;;;;;;;;;;;;;
set WTPNG values-from turtles with [breed = gatekeepers and who < TTN][who]
set TPNGat count turtles with [breed = gatekeepers and who < TTN]
set ETPNG []
without-interruption
[
foreach WTPNG; LTPN
[
;set En sum values-from turtles with [label = ?][energy]
set En energy-of turtle(?)
set ETPNG lput En ETPNG
];end foreach
];end without
set-current-plot "Scale (Lorenz Curve)"
set-current-plot-pen "gatekeepers"
set-plot-pen-interval (100 / TPNGat); num-people
plot 0
set sorted-wealths sort ETPNG
set total-wealth sum sorted-wealths
set wealth-sum-so-far 0
set index 0
set gini-index-reserve 0
;; now actually plot the Lorenz curve -- along the way, we also
;; calculate the Gini index
repeat TPNGat
[
without-interruption
[
set wealth-sum-so-far (wealth-sum-so-far + item index sorted-wealths)
plot (wealth-sum-so-far / total-wealth) * 100
set index (index + 1)
set gini-index-reserve
gini-index-reserve +
(index / TPNGat ) -
(wealth-sum-so-far / total-wealth)
]
]
;; plot Gini Index
set-current-plot "Scale (Gini Index)"
set-current-plot-pen "gatekeepers"
plot (gini-index-reserve / TPNGat) / area-of-equality-triangleG
set GiniIndex (gini-index-reserve / TPNGat) / area-of-equality-triangleG
if (iteration = 0 or iteration = Iteration) [type "gatekeepers's Gini Index: " print precision GiniIndex 2]
;;;;;;;;;;;;;;;;;;;;;;
;controllers
;;;;;;;;;;;;;;;;;;;;;;
set WTPNR values-from turtles with [breed = controllers and who < TTN][who]
set TPNRes count turtles with [breed = controllers and who < TTN]
set ETPNR []
without-interruption
[
foreach WTPNR; LTPN
[
;set En sum values-from turtles with [label = ?][energy]
set En energy-of turtle(?)
set ETPNR lput En ETPNR
];end foreach
];end without
set-current-plot "Scale (Lorenz Curve)"
set-current-plot-pen "controllers"
set-plot-pen-interval (100 / TPNRes); num-people
plot 0
set sorted-wealths sort ETPNR
set total-wealth sum sorted-wealths
set wealth-sum-so-far 0
set index 0
set gini-index-reserve 0
;; now actually plot the Lorenz curve -- along the way, we also
;; calculate the Gini index
repeat TPNRes
[
without-interruption
[
set wealth-sum-so-far (wealth-sum-so-far + item index sorted-wealths)
plot (wealth-sum-so-far / total-wealth) * 100
set index (index + 1)
set gini-index-reserve
gini-index-reserve +
(index / TPNRes ) -
(wealth-sum-so-far / total-wealth)
]
]
;; plot Gini Index
set-current-plot "Scale (Gini Index)"
set-current-plot-pen "controllers"
plot (gini-index-reserve / TPNRes) / area-of-equality-triangleR
set GiniIndex (gini-index-reserve / TPNRes) / area-of-equality-triangleR
if (iteration = 0 or iteration = Iteration) [type "controllers's Gini Index: " print precision GiniIndex 2]
;;;;;;;;;;;;;;;;;;;;;;
;businesses
;;;;;;;;;;;;;;;;;;;;;;
set WTPNB values-from turtles with [breed = businesses and who < TTN][who]
set TPNBus count turtles with [breed = businesses and who < TTN]
set ETPNB []
without-interruption
[
foreach WTPNB; LTPN
[
;set En sum values-from turtles with [label = ?][energy]
set En energy-of turtle(?)
set ETPNB lput En ETPNB
];end foreach
];end without
set-current-plot "Scale (Lorenz Curve)"
set-current-plot-pen "businesses"
set-plot-pen-interval (100 / TPNBus); num-people
plot 0
set sorted-wealths sort ETPNB
set total-wealth sum sorted-wealths
set wealth-sum-so-far 0
set index 0
set gini-index-reserve 0
;; now actually plot the Lorenz curve -- along the way, we also
;; calculate the Gini index
repeat TPNBus
[
without-interruption
[
set wealth-sum-so-far (wealth-sum-so-far + item index sorted-wealths)
plot (wealth-sum-so-far / total-wealth) * 100
set index (index + 1)
set gini-index-reserve
gini-index-reserve +
(index / TPNBus ) -
(wealth-sum-so-far / total-wealth)
]
]
;; plot Gini Index
set-current-plot "Scale (Gini Index)"
set-current-plot-pen "businesses"
plot (gini-index-reserve / TPNBus) / area-of-equality-triangleB
set GiniIndex (gini-index-reserve / TPNBus) / area-of-equality-triangleG
if (iteration = 0 or iteration = Iteration) [type "businesses's Gini Index: " print precision GiniIndex 2]
end
to-report area-of-equality-triangleG
;; not really necessary to compute this when num-people is large;
;; if num-people is large, could just use estimate of 0.5
report (TPNGat * (TPNGat - 1) / 2) / (TPNGat ^ 2)
end
to-report area-of-equality-triangleR
;; not really necessary to compute this when num-people is large;
;; if num-people is large, could just use estimate of 0.5
report (TPNRes * (TPNRes - 1) / 2) / (TPNRes ^ 2)
end
to-report area-of-equality-triangleB
;; not really necessary to compute this when num-people is large;
;; if num-people is large, could just use estimate of 0.5
report (TPNBus * (TPNBus - 1) / 2) / (TPNBus ^ 2)
end
to controllers-views-and-others
ask turtles with [breed = controllers]
[;open ask1
without-interruption
[;open without
set px Xi
count-conflicts-for-Xi
set px Ei
count-conflicts-for-Ei
set px perceptionOftpreffor-natural-resources
count-conflicts-for-Vn
set px perceptionOftpreffor-cultural-resources
count-conflicts-for-Vc
];close without
];close ask 1
end
to businesses-views-and-others
ask turtles with [breed = businesses]
[;open ask1
without-interruption
[;open without
set px Xi
count-conflicts-for-Xi
set px Ei
count-conflicts-for-Ei
set px perceptionOftpreffor-natural-resources
count-conflicts-for-Vn
set px perceptionOftpreffor-cultural-resources
count-conflicts-for-Vc
];close without
];close ask 1
end
to gatekeepers-views-and-others
ask turtles with [breed = gatekeepers]
[;open ask1
without-interruption
[;open without
set px Xi
count-conflicts-for-Xi
set px Ei
count-conflicts-for-Ei
set px perceptionOftpreffor-natural-resources
count-conflicts-for-Vn
set px perceptionOftpreffor-cultural-resources
count-conflicts-for-Vc
];close without
];close ask 1
end
to communities-views-and-others
ask turtles with [breed = communities]
[;open ask1
without-interruption
[;open without
set px Xi
count-conflicts-for-Xi
set px Ei
count-conflicts-for-Ei
set px perceptionOftpreffor-natural-resources
count-conflicts-for-Vn
set px perceptionOftpreffor-cultural-resources
count-conflicts-for-Vc
];close without
];close ask 1
end
to institutions-views-and-others
ask turtles with [breed = institutions]
[;open ask1
without-interruption
[;open without
set px Xi
count-conflicts-for-Xi
set px Ei
count-conflicts-for-Ei
set px perceptionOftpreffor-natural-resources
count-conflicts-for-Vn
set px perceptionOftpreffor-cultural-resources
count-conflicts-for-Vc
];close without
];close ask 1
end
to count-conflicts-for-Xi
set xpartners turtles with [breed = controllers and self != myself and Xi != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictXi-with-R xTp
];close if
set xpartners turtles with [breed = businesses and self != myself and Xi != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictXi-with-B xTp
];close if
set xpartners turtles with [breed = communities and self != myself and Xi != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictXi-with-C xTp
];close if
set xpartners turtles with [breed = gatekeepers and self != myself and Xi != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictXi-with-G xTp
];close if
set xpartners turtles with [breed = institutions and self != myself and Xi != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictXi-with-I xTp
];close if
end
to count-conflicts-for-Ei
set xpartners turtles with [breed = controllers and self != myself and Ei != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictEi-with-R xTp
];close if
set xpartners turtles with [breed = businesses and self != myself and Ei != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictEi-with-B xTp
];close if
set xpartners turtles with [breed = communities and self != myself and Ei != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictEi-with-C xTp
];close if
set xpartners turtles with [breed = gatekeepers and self != myself and Ei != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictEi-with-G xTp
];close if
set xpartners turtles with [breed = institutions and self != myself and Ei != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictEi-with-I xTp
];close if
end
to count-conflicts-for-Vn
set xpartners turtles with [breed = controllers and self != myself and perceptionOftpreffor-natural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVn-with-R xTp
];close if
set xpartners turtles with [breed = businesses and self != myself and perceptionOftpreffor-natural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVn-with-B xTp
];close if
set xpartners turtles with [breed = communities and self != myself and perceptionOftpreffor-natural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVn-with-C xTp
];close if
set xpartners turtles with [breed = gatekeepers and self != myself and perceptionOftpreffor-natural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVn-with-G xTp
];close if
set xpartners turtles with [breed = institutions and self != myself and perceptionOftpreffor-natural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVn-with-I xTp
];close if
end
to count-conflicts-for-Vc
set xpartners turtles with [breed = controllers and self != myself and perceptionOftpreffor-cultural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVc-with-R xTp
];close if
set xpartners turtles with [breed = businesses and self != myself and perceptionOftpreffor-cultural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVc-with-B xTp
];close if
set xpartners turtles with [breed = communities and self != myself and perceptionOftpreffor-cultural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVc-with-C xTp
];close if
set xpartners turtles with [breed = gatekeepers and self != myself and perceptionOftpreffor-cultural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVc-with-G xTp
];close if
set xpartners turtles with [breed = institutions and self != myself and perceptionOftpreffor-cultural-resources != px]
set xTp count xpartners
;if xpartners != []
if (xTp > 0)
[
set conflictVc-with-I xTp
];close if
end
to count-conflictsXi-amongRBGCI
set numof-conflictsXi-between-controllers-and-controllers
((sum values-from turtles with [breed = controllers][conflictXi-with-R]) / count turtles with [breed = controllers])
set numof-conflictsXi-between-controllers-and-businesses
((sum values-from turtles with [breed = controllers][conflictXi-with-B]) / count turtles with [breed = controllers])
set numof-conflictsXi-between-controllers-and-gatekeepers
((sum values-from turtles with [breed = controllers][conflictXi-with-G]) / count turtles with [breed = controllers])
set numof-conflictsXi-between-controllers-and-communities
((sum values-from turtles with [breed = controllers][conflictXi-with-C]) / count turtles with [breed = controllers])
set numof-conflictsXi-between-controllers-and-institutions
((sum values-from turtles with [breed = controllers][conflictXi-with-I]) / count turtles with [breed = controllers])
set numof-conflictsXi-between-businesses-and-controllers
((sum values-from turtles with [breed = businesses][conflictXi-with-R]) / count turtles with [breed = businesses])
set numof-conflictsXi-between-businesses-and-businesses
((sum values-from turtles with [breed = businesses][conflictXi-with-B]) / count turtles with [breed = businesses])
set numof-conflictsXi-between-businesses-and-gatekeepers
((sum values-from turtles with [breed = businesses][conflictXi-with-G]) / count turtles with [breed = businesses])
set numof-conflictsXi-between-businesses-and-communities
((sum values-from turtles with [breed = businesses][conflictXi-with-C]) / count turtles with [breed = businesses])
set numof-conflictsXi-between-businesses-and-institutions
((sum values-from turtles with [breed = businesses][conflictXi-with-I]) / count turtles with [breed = businesses])
set numof-conflictsXi-between-gatekeepers-and-controllers
((sum values-from turtles with [breed = gatekeepers][conflictXi-with-R]) / count turtles with [breed = gatekeepers])
set numof-conflictsXi-between-gatekeepers-and-businesses
((sum values-from turtles with [breed = gatekeepers][conflictXi-with-B]) / count turtles with [breed = gatekeepers])
set numof-conflictsXi-between-gatekeepers-and-gatekeepers
((sum values-from turtles with [breed = gatekeepers][conflictXi-with-G]) / count turtles with [breed = gatekeepers])
set numof-conflictsXi-between-gatekeepers-and-communities
((sum values-from turtles with [breed = gatekeepers][conflictXi-with-C]) / count turtles with [breed = gatekeepers])
set numof-conflictsXi-between-gatekeepers-and-institutions
((sum values-from turtles with [breed = gatekeepers][conflictXi-with-I]) / count turtles with [breed = gatekeepers])
set numof-conflictsXi-between-communities-and-controllers
((sum values-from turtles with [breed = communities][conflictXi-with-R]) / count turtles with [breed = communities])
set numof-conflictsXi-between-communities-and-businesses
((sum values-from turtles with [breed = communities][conflictXi-with-B]) / count turtles with [breed = communities])
set numof-conflictsXi-between-communities-and-gatekeepers
((sum values-from turtles with [breed = communities][conflictXi-with-G]) / count turtles with [breed = communities])
set numof-conflictsXi-between-communities-and-communities
((sum values-from turtles with [breed = communities][conflictXi-with-C]) / count turtles with [breed = communities])
set numof-conflictsXi-between-communities-and-institutions
((sum values-from turtles with [breed = communities][conflictXi-with-I]) / count turtles with [breed = communities])
set numof-conflictsXi-between-institutions-and-controllers
((sum values-from turtles with [breed = institutions][conflictXi-with-R]) / count turtles with [breed = institutions])
set numof-conflictsXi-between-institutions-and-businesses
((sum values-from turtles with [breed = institutions][conflictXi-with-B]) / count turtles with [breed = institutions])
set numof-conflictsXi-between-institutions-and-gatekeepers
((sum values-from turtles with [breed = institutions][conflictXi-with-G]) / count turtles with [breed = institutions])
set numof-conflictsXi-between-institutions-and-communities
((sum values-from turtles with [breed = institutions][conflictXi-with-C]) / count turtles with [breed = institutions])
set numof-conflictsXi-between-institutions-and-institutions
((sum values-from turtles with [breed = institutions][conflictXi-with-I]) / count turtles with [breed = institutions])
end
to print-conflictsXi-amongRBGCI
type "numof-conflictsXi-between-controllers-and-controllers: " print precision numof-conflictsXi-between-controllers-and-controllers 2
type "numof-conflictsXi-between-controllers-and-businesses: " print precision numof-conflictsXi-between-controllers-and-businesses 2
type "numof-conflictsXi-between-controllers-and-gatekeepers: " print precision numof-conflictsXi-between-controllers-and-gatekeepers 2
type "numof-conflictsXi-between-controllers-and-communities: " print precision numof-conflictsXi-between-controllers-and-communities 2
type "numof-conflictsXi-between-controllers-and-institutions: " print precision numof-conflictsXi-between-controllers-and-institutions 2
type "numof-conflictsXi-between-businesses-and-controllers: " print precision numof-conflictsXi-between-businesses-and-controllers 2
type "numof-conflictsXi-between-businesses-and-businesses: " print precision numof-conflictsXi-between-businesses-and-businesses 2
type "numof-conflictsXi-between-businesses-and-gatekeepers: " print precision numof-conflictsXi-between-businesses-and-gatekeepers 2
type "numof-conflictsXi-between-businesses-and-communities: " print precision numof-conflictsXi-between-businesses-and-communities 2
type "numof-conflictsXi-between-businesses-and-institutions: " print precision numof-conflictsXi-between-businesses-and-institutions 2
type "numof-conflictsXi-between-gatekeepers-and-controllers: " print precision numof-conflictsXi-between-gatekeepers-and-controllers 2
type "numof-conflictsXi-between-gatekeepers-and-businesses: " print precision numof-conflictsXi-between-gatekeepers-and-businesses 2
type "numof-conflictsXi-between-gatekeepers-and-gatekeepers: " print precision numof-conflictsXi-between-gatekeepers-and-gatekeepers 2
type "numof-conflictsXi-between-gatekeepers-and-communities: " print precision numof-conflictsXi-between-gatekeepers-and-communities 2
type "numof-conflictsXi-between-gatekeepers-and-institutions: " print precision numof-conflictsXi-between-gatekeepers-and-institutions 2
type "numof-conflictsXi-between-communities-and-controllers: " print precision numof-conflictsXi-between-communities-and-controllers 2
type "numof-conflictsXi-between-communities-and-businesses: " print precision numof-conflictsXi-between-communities-and-businesses 2
type "numof-conflictsXi-between-communities-and-gatekeepers: " print precision numof-conflictsXi-between-communities-and-gatekeepers 2
type "numof-conflictsXi-between-communities-and-communities: " print precision numof-conflictsXi-between-communities-and-communities 2
type "numof-conflictsXi-between-communities-and-institutions: " print precision numof-conflictsXi-between-communities-and-institutions 2
type "numof-conflictsXi-between-institutions-and-controllers: " print precision numof-conflictsXi-between-institutions-and-controllers 2
type "numof-conflictsXi-between-institutions-and-businesses: " print precision numof-conflictsXi-between-institutions-and-businesses 2
type "numof-conflictsXi-between-institutions-and-gatekeepers: " print precision numof-conflictsXi-between-institutions-and-gatekeepers 2
type "numof-conflictsXi-between-institutions-and-communities: " print precision numof-conflictsXi-between-institutions-and-communities 2
type "numof-conflictsXi-between-institutions-and-institutions: " print precision numof-conflictsXi-between-institutions-and-institutions 2
end
to count-conflictsEi-amongRBGCI
set numof-conflictsEi-between-controllers-and-controllers
((sum values-from turtles with [breed = controllers][conflictEi-with-R]) / count turtles with [breed = controllers])
set numof-conflictsEi-between-controllers-and-businesses
((sum values-from turtles with [breed = controllers][conflictEi-with-B]) / count turtles with [breed = controllers])
set numof-conflictsEi-between-controllers-and-gatekeepers
((sum values-from turtles with [breed = controllers][conflictEi-with-G]) / count turtles with [breed = controllers])
set numof-conflictsEi-between-controllers-and-communities
((sum values-from turtles with [breed = controllers][conflictEi-with-C]) / count turtles with [breed = controllers])
set numof-conflictsEi-between-controllers-and-institutions
((sum values-from turtles with [breed = controllers][conflictEi-with-I]) / count turtles with [breed = controllers])
set numof-conflictsEi-between-businesses-and-controllers
((sum values-from turtles with [breed = businesses][conflictEi-with-R]) / count turtles with [breed = businesses])
set numof-conflictsEi-between-businesses-and-businesses
((sum values-from turtles with [breed = businesses][conflictEi-with-B]) / count turtles with [breed = businesses])
set numof-conflictsEi-between-businesses-and-gatekeepers
((sum values-from turtles with [breed = businesses][conflictEi-with-G]) / count turtles with [breed = businesses])
set numof-conflictsEi-between-businesses-and-communities
((sum values-from turtles with [breed = businesses][conflictEi-with-C]) / count turtles with [breed = businesses])
set numof-conflictsEi-between-businesses-and-institutions
((sum values-from turtles with [breed = businesses][conflictEi-with-I]) / count turtles with [breed = businesses])
set numof-conflictsEi-between-gatekeepers-and-controllers
((sum values-from turtles with [breed = gatekeepers][conflictEi-with-R]) / count turtles with [breed = gatekeepers])
set numof-conflictsEi-between-gatekeepers-and-businesses
((sum values-from turtles with [breed = gatekeepers][conflictEi-with-B]) / count turtles with [breed = gatekeepers])
set numof-conflictsEi-between-gatekeepers-and-gatekeepers
((sum values-from turtles with [breed = gatekeepers][conflictEi-with-G]) / count turtles with [breed = gatekeepers])
set numof-conflictsEi-between-gatekeepers-and-communities
((sum values-from turtles with [breed = gatekeepers][conflictEi-with-C]) / count turtles with [breed = gatekeepers])
set numof-conflictsEi-between-gatekeepers-and-institutions
((sum values-from turtles with [breed = gatekeepers][conflictEi-with-I]) / count turtles with [breed = gatekeepers])
set numof-conflictsEi-between-communities-and-controllers
((sum values-from turtles with [breed = communities][conflictEi-with-R]) / count turtles with [breed = communities])
set numof-conflictsEi-between-communities-and-businesses
((sum values-from turtles with [breed = communities][conflictEi-with-B]) / count turtles with [breed = communities])
set numof-conflictsEi-between-communities-and-gatekeepers
((sum values-from turtles with [breed = communities][conflictEi-with-G]) / count turtles with [breed = communities])
set numof-conflictsEi-between-communities-and-communities
((sum values-from turtles with [breed = communities][conflictEi-with-C]) / count turtles with [breed = communities])
set numof-conflictsEi-between-communities-and-institutions
((sum values-from turtles with [breed = communities][conflictEi-with-I]) / count turtles with [breed = communities])
set numof-conflictsEi-between-institutions-and-controllers
((sum values-from turtles with [breed = institutions][conflictEi-with-R]) / count turtles with [breed = institutions])
set numof-conflictsEi-between-institutions-and-businesses
((sum values-from turtles with [breed = institutions][conflictEi-with-B]) / count turtles with [breed = institutions])
set numof-conflictsEi-between-institutions-and-gatekeepers
((sum values-from turtles with [breed = institutions][conflictEi-with-G]) / count turtles with [breed = institutions])
set numof-conflictsEi-between-institutions-and-communities
((sum values-from turtles with [breed = institutions][conflictEi-with-C]) / count turtles with [breed = institutions])
set numof-conflictsEi-between-institutions-and-institutions
((sum values-from turtles with [breed = institutions][conflictEi-with-I]) / count turtles with [breed = institutions])
end
to print-conflictsEi-amongRBGCI
type "numof-conflictsEi-between-controllers-and-controllers: " print precision numof-conflictsEi-between-controllers-and-controllers 2
type "numof-conflictsEi-between-controllers-and-businesses: " print precision numof-conflictsEi-between-controllers-and-businesses 2
type "numof-conflictsEi-between-controllers-and-gatekeepers: " print precision numof-conflictsEi-between-controllers-and-gatekeepers 2
type "numof-conflictsEi-between-controllers-and-communities: " print precision numof-conflictsEi-between-controllers-and-communities 2
type "numof-conflictsEi-between-controllers-and-institutions: " print precision numof-conflictsEi-between-controllers-and-institutions 2
type "numof-conflictsEi-between-businesses-and-controllers: " print precision numof-conflictsEi-between-businesses-and-controllers 2
type "numof-conflictsEi-between-businesses-and-businesses: " print precision numof-conflictsEi-between-businesses-and-businesses 2
type "numof-conflictsEi-between-businesses-and-gatekeepers: " print precision numof-conflictsEi-between-businesses-and-gatekeepers 2
type "numof-conflictsEi-between-businesses-and-communities: " print precision numof-conflictsEi-between-businesses-and-communities 2
type "numof-conflictsEi-between-businesses-and-institutions: " print precision numof-conflictsEi-between-businesses-and-institutions 2
type "numof-conflictsEi-between-gatekeepers-and-controllers: " print precision numof-conflictsEi-between-gatekeepers-and-controllers 2
type "numof-conflictsEi-between-gatekeepers-and-businesses: " print precision numof-conflictsEi-between-gatekeepers-and-businesses 2
type "numof-conflictsEi-between-gatekeepers-and-gatekeepers: " print precision numof-conflictsEi-between-gatekeepers-and-gatekeepers 2
type "numof-conflictsEi-between-gatekeepers-and-communities: " print precision numof-conflictsEi-between-gatekeepers-and-communities 2
type "numof-conflictsEi-between-gatekeepers-and-institutions: " print precision numof-conflictsEi-between-gatekeepers-and-institutions 2
type "numof-conflictsEi-between-communities-and-controllers: " print precision numof-conflictsEi-between-communities-and-controllers 2
type "numof-conflictsEi-between-communities-and-businesses: " print precision numof-conflictsEi-between-communities-and-businesses 2
type "numof-conflictsEi-between-communities-and-gatekeepers: " print precision numof-conflictsEi-between-communities-and-gatekeepers 2
type "numof-conflictsEi-between-communities-and-communities: " print precision numof-conflictsEi-between-communities-and-communities 2
type "numof-conflictsEi-between-communities-and-institutions: " print precision numof-conflictsEi-between-communities-and-institutions 2
type "numof-conflictsEi-between-institutions-and-controllers: " print precision numof-conflictsEi-between-institutions-and-controllers 2
type "numof-conflictsEi-between-institutions-and-businesses: " print precision numof-conflictsEi-between-institutions-and-businesses 2
type "numof-conflictsEi-between-institutions-and-gatekeepers: " print precision numof-conflictsEi-between-institutions-and-gatekeepers 2
type "numof-conflictsEi-between-institutions-and-communities: " print precision numof-conflictsEi-between-institutions-and-communities 2
type "numof-conflictsEi-between-institutions-and-institutions: " print precision numof-conflictsEi-between-institutions-and-institutions 2
end
to count-conflictsVn-amongRBGCI
set numof-conflictsVn-between-controllers-and-controllers
((sum values-from turtles with [breed = controllers][conflictVn-with-R]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVn-between-controllers-and-businesses
((sum values-from turtles with [breed = controllers][conflictVn-with-B]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVn-between-controllers-and-gatekeepers
((sum values-from turtles with [breed = controllers][conflictVn-with-G]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVn-between-controllers-and-communities
((sum values-from turtles with [breed = controllers][conflictVn-with-C]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVn-between-controllers-and-institutions
((sum values-from turtles with [breed = controllers][conflictVn-with-I]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVn-between-businesses-and-controllers
((sum values-from turtles with [breed = businesses][conflictVn-with-R]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVn-between-businesses-and-businesses
((sum values-from turtles with [breed = businesses][conflictVn-with-B]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVn-between-businesses-and-gatekeepers
((sum values-from turtles with [breed = businesses][conflictVn-with-G]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVn-between-businesses-and-communities
((sum values-from turtles with [breed = businesses][conflictVn-with-C]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVn-between-businesses-and-institutions
((sum values-from turtles with [breed = businesses][conflictVn-with-I]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVn-between-gatekeepers-and-controllers
((sum values-from turtles with [breed = gatekeepers][conflictVn-with-R]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVn-between-gatekeepers-and-businesses
((sum values-from turtles with [breed = gatekeepers][conflictVn-with-B]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVn-between-gatekeepers-and-gatekeepers
((sum values-from turtles with [breed = gatekeepers][conflictVn-with-G]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVn-between-gatekeepers-and-communities
((sum values-from turtles with [breed = gatekeepers][conflictVn-with-C]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVn-between-gatekeepers-and-institutions
((sum values-from turtles with [breed = gatekeepers][conflictVn-with-I]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVn-between-communities-and-controllers
((sum values-from turtles with [breed = communities][conflictVn-with-R]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVn-between-communities-and-businesses
((sum values-from turtles with [breed = communities][conflictVn-with-B]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVn-between-communities-and-gatekeepers
((sum values-from turtles with [breed = communities][conflictVn-with-G]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVn-between-communities-and-communities
((sum values-from turtles with [breed = communities][conflictVn-with-C]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVn-between-communities-and-institutions
((sum values-from turtles with [breed = communities][conflictVn-with-I]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVn-between-institutions-and-controllers
((sum values-from turtles with [breed = institutions][conflictVn-with-R]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVn-between-institutions-and-businesses
((sum values-from turtles with [breed = institutions][conflictVn-with-B]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVn-between-institutions-and-gatekeepers
((sum values-from turtles with [breed = institutions][conflictVn-with-G]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVn-between-institutions-and-communities
((sum values-from turtles with [breed = institutions][conflictVn-with-C]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVn-between-institutions-and-institutions
((sum values-from turtles with [breed = institutions][conflictVn-with-I]) / count turtles with [breed = institutions and who < TTN])
end
to print-conflictsVn-amongRBGCI
type "numof-conflictsVn-between-controllers-and-controllers: " print precision numof-conflictsVn-between-controllers-and-controllers 2
type "numof-conflictsVn-between-controllers-and-businesses: " print precision numof-conflictsVn-between-controllers-and-businesses 2
type "numof-conflictsVn-between-controllers-and-gatekeepers: " print precision numof-conflictsVn-between-controllers-and-gatekeepers 2
type "numof-conflictsVn-between-controllers-and-communities: " print precision numof-conflictsVn-between-controllers-and-communities 2
type "numof-conflictsVn-between-controllers-and-institutions: " print precision numof-conflictsVn-between-controllers-and-institutions 2
type "numof-conflictsVn-between-businesses-and-controllers: " print precision numof-conflictsVn-between-businesses-and-controllers 2
type "numof-conflictsVn-between-businesses-and-businesses: " print precision numof-conflictsVn-between-businesses-and-businesses 2
type "numof-conflictsVn-between-businesses-and-gatekeepers: " print precision numof-conflictsVn-between-businesses-and-gatekeepers 2
type "numof-conflictsVn-between-businesses-and-communities: " print precision numof-conflictsVn-between-businesses-and-communities 2
type "numof-conflictsVn-between-businesses-and-institutions: " print precision numof-conflictsVn-between-businesses-and-institutions 2
type "numof-conflictsVn-between-gatekeepers-and-controllers: " print precision numof-conflictsVn-between-gatekeepers-and-controllers 2
type "numof-conflictsVn-between-gatekeepers-and-businesses: " print precision numof-conflictsVn-between-gatekeepers-and-businesses 2
type "numof-conflictsVn-between-gatekeepers-and-gatekeepers: " print precision numof-conflictsVn-between-gatekeepers-and-gatekeepers 2
type "numof-conflictsVn-between-gatekeepers-and-communities: " print precision numof-conflictsVn-between-gatekeepers-and-communities 2
type "numof-conflictsVn-between-gatekeepers-and-institutions: " print precision numof-conflictsVn-between-gatekeepers-and-institutions 2
type "numof-conflictsVn-between-communities-and-controllers: " print precision numof-conflictsVn-between-communities-and-controllers 2
type "numof-conflictsVn-between-communities-and-businesses: " print precision numof-conflictsVn-between-communities-and-businesses 2
type "numof-conflictsVn-between-communities-and-gatekeepers: " print precision numof-conflictsVn-between-communities-and-gatekeepers 2
type "numof-conflictsVn-between-communities-and-communities: " print precision numof-conflictsVn-between-communities-and-communities 2
type "numof-conflictsVn-between-communities-and-institutions: " print precision numof-conflictsVn-between-communities-and-institutions 2
type "numof-conflictsVn-between-institutions-and-controllers: " print precision numof-conflictsVn-between-institutions-and-controllers 2
type "numof-conflictsVn-between-institutions-and-businesses: " print precision numof-conflictsVn-between-institutions-and-businesses 2
type "numof-conflictsVn-between-institutions-and-gatekeepers: " print precision numof-conflictsVn-between-institutions-and-gatekeepers 2
type "numof-conflictsVn-between-institutions-and-communities: " print precision numof-conflictsVn-between-institutions-and-communities 2
type "numof-conflictsVn-between-institutions-and-institutions: " print precision numof-conflictsVn-between-institutions-and-institutions 2
end
to count-conflictsVc-amongRBGCI
set numof-conflictsVc-between-controllers-and-controllers
((sum values-from turtles with [breed = controllers][conflictVc-with-R]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVc-between-controllers-and-businesses
((sum values-from turtles with [breed = controllers][conflictVc-with-B]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVc-between-controllers-and-gatekeepers
((sum values-from turtles with [breed = controllers][conflictVc-with-G]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVc-between-controllers-and-communities
((sum values-from turtles with [breed = controllers][conflictVc-with-C]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVc-between-controllers-and-institutions
((sum values-from turtles with [breed = controllers][conflictVc-with-I]) / count turtles with [breed = controllers and who < TTN])
set numof-conflictsVc-between-businesses-and-controllers
((sum values-from turtles with [breed = businesses][conflictVc-with-R]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVc-between-businesses-and-businesses
((sum values-from turtles with [breed = businesses][conflictVc-with-B]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVc-between-businesses-and-gatekeepers
((sum values-from turtles with [breed = businesses][conflictVc-with-G]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVc-between-businesses-and-communities
((sum values-from turtles with [breed = businesses][conflictVc-with-C]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVc-between-businesses-and-institutions
((sum values-from turtles with [breed = businesses][conflictVc-with-I]) / count turtles with [breed = businesses and who < TTN])
set numof-conflictsVc-between-gatekeepers-and-controllers
((sum values-from turtles with [breed = gatekeepers][conflictVc-with-R]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVc-between-gatekeepers-and-businesses
((sum values-from turtles with [breed = gatekeepers][conflictVc-with-B]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVc-between-gatekeepers-and-gatekeepers
((sum values-from turtles with [breed = gatekeepers][conflictVc-with-G]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVc-between-gatekeepers-and-communities
((sum values-from turtles with [breed = gatekeepers][conflictVc-with-C]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVc-between-gatekeepers-and-institutions
((sum values-from turtles with [breed = gatekeepers][conflictVc-with-I]) / count turtles with [breed = gatekeepers and who < TTN])
set numof-conflictsVc-between-communities-and-controllers
((sum values-from turtles with [breed = communities][conflictVc-with-R]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVc-between-communities-and-businesses
((sum values-from turtles with [breed = communities][conflictVc-with-B]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVc-between-communities-and-gatekeepers
((sum values-from turtles with [breed = communities][conflictVc-with-G]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVc-between-communities-and-communities
((sum values-from turtles with [breed = communities][conflictVc-with-C]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVc-between-communities-and-institutions
((sum values-from turtles with [breed = communities][conflictVc-with-I]) / count turtles with [breed = communities and who < TTN])
set numof-conflictsVc-between-institutions-and-controllers
((sum values-from turtles with [breed = institutions][conflictVc-with-R]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVc-between-institutions-and-businesses
((sum values-from turtles with [breed = institutions][conflictVc-with-B]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVc-between-institutions-and-gatekeepers
((sum values-from turtles with [breed = institutions][conflictVc-with-G]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVc-between-institutions-and-communities
((sum values-from turtles with [breed = institutions][conflictVc-with-C]) / count turtles with [breed = institutions and who < TTN])
set numof-conflictsVc-between-institutions-and-institutions
((sum values-from turtles with [breed = institutions][conflictVc-with-I]) / count turtles with [breed = institutions and who < TTN])
end
to print-conflictsVc-amongRBGCI
type "numof-conflictsVc-between-controllers-and-controllers: " print precision numof-conflictsVc-between-controllers-and-controllers 2
type "numof-conflictsVc-between-controllers-and-businesses: " print precision numof-conflictsVc-between-controllers-and-businesses 2
type "numof-conflictsVc-between-controllers-and-gatekeepers: " print precision numof-conflictsVc-between-controllers-and-gatekeepers 2
type "numof-conflictsVc-between-controllers-and-communities: " print precision numof-conflictsVc-between-controllers-and-communities 2
type "numof-conflictsVc-between-controllers-and-institutions: " print precision numof-conflictsVc-between-controllers-and-institutions 2
type "numof-conflictsVc-between-businesses-and-controllers: " print precision numof-conflictsVc-between-businesses-and-controllers 2
type "numof-conflictsVc-between-businesses-and-businesses: " print precision numof-conflictsVc-between-businesses-and-businesses 2
type "numof-conflictsVc-between-businesses-and-gatekeepers: " print precision numof-conflictsVc-between-businesses-and-gatekeepers 2
type "numof-conflictsVc-between-businesses-and-communities: " print precision numof-conflictsVc-between-businesses-and-communities 2
type "numof-conflictsVc-between-businesses-and-institutions: " print precision numof-conflictsVc-between-businesses-and-institutions 2
type "numof-conflictsVc-between-gatekeepers-and-controllers: " print precision numof-conflictsVc-between-gatekeepers-and-controllers 2
type "numof-conflictsVc-between-gatekeepers-and-businesses: " print precision numof-conflictsVc-between-gatekeepers-and-businesses 2
type "numof-conflictsVc-between-gatekeepers-and-gatekeepers: " print precision numof-conflictsVc-between-gatekeepers-and-gatekeepers 2
type "numof-conflictsVc-between-gatekeepers-and-communities: " print precision numof-conflictsVc-between-gatekeepers-and-communities 2
type "numof-conflictsVc-between-gatekeepers-and-institutions: " print precision numof-conflictsVc-between-gatekeepers-and-institutions 2
type "numof-conflictsVc-between-communities-and-controllers: " print precision numof-conflictsVc-between-communities-and-controllers 2
type "numof-conflictsVc-between-communities-and-businesses: " print precision numof-conflictsVc-between-communities-and-businesses 2
type "numof-conflictsVc-between-communities-and-gatekeepers: " print precision numof-conflictsVc-between-communities-and-gatekeepers 2
type "numof-conflictsVc-between-communities-and-communities: " print precision numof-conflictsVc-between-communities-and-communities 2
type "numof-conflictsVc-between-communities-and-institutions: " print precision numof-conflictsVc-between-communities-and-institutions 2
type "numof-conflictsVc-between-institutions-and-controllers: " print precision numof-conflictsVc-between-institutions-and-controllers 2
type "numof-conflictsVc-between-institutions-and-businesses: " print precision numof-conflictsVc-between-institutions-and-businesses 2
type "numof-conflictsVc-between-institutions-and-gatekeepers: " print precision numof-conflictsVc-between-institutions-and-gatekeepers 2
type "numof-conflictsVc-between-institutions-and-communities: " print precision numof-conflictsVc-between-institutions-and-communities 2
type "numof-conflictsVc-between-institutions-and-institutions: " print precision numof-conflictsVc-between-institutions-and-institutions 2
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Runtime Procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; TO BUILD NO REGULATED SCENARIOS
;; by simulating controllers, businesses and gatekeepers, acting as they said in Q4 and Qx5 + something else ..
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to build-no-regulated-scenarios
locals [w x y z]
;setup-user-input-parameters-1
if iteration = 0
[
set-current-plot "Controllers Behaviours"
clear-plot
set-current-plot "Businesses Behaviours"
clear-plot
set-current-plot "Gatekeepers Behaviours"
clear-plot
set-current-plot "Controllers Interactions"
clear-plot
set-current-plot "Businesses Interactions"
clear-plot
set-current-plot "Gatekeepers Interactions"
clear-plot
set-current-plot "Provisioned Resources"
clear-plot
set-current-plot "Used Resources"
clear-plot
set-current-plot "Promoted Resources"
clear-plot
set-current-plot "Visited Resources"
clear-plot
set-current-plot "Tourists Density"
clear-plot
set-current-plot "Tourists"
clear-plot
set-current-plot "Communities"
clear-plot
set TypeOfRegulation " market"
setup-user-input-parameters-2
reset-phantoms
]
set TTN count turtles
setup-conflicts-and-cooperations-to-zero
do-plotting-conflicts-and-cooperations-RBG
do-bookkeeping-initial-patch-counts
print-initial-patch-counts2
do-plotting-behaviours-reg
while [iteration < Iterations] ; true
[
without-interruption
[
set iteration iteration + 1
type "No Regualtion scenario, iter " print iteration
remove-duplicates-controls-uses-promotions
do-NO-REGULATION
do-bookkeeping-initial-patch-counts
print-initial-patch-counts2
do-plotting-conflicts-and-cooperations-RBG
do-plotting-behaviours-reg
set numof-unsatisfied-tourists 0
set avenumof-unsatisfied-communities 0
;set minnumof-unsatisfied-communities 0
;set maxnumof-unsatisfied-communities 0
set KilledTourists 0
type "End of iteration " print iteration
];without
];while
print-initial-situation
count-conflictsVn-amongRBGCI
; print-conflictsVn-amongRBGCI
count-conflictsVc-amongRBGCI
; print-conflictsVc-amongRBGCI
; reset-phantoms
; set a word "SPRITE-" country
; set b word a region
; set c word b event
; set d word c "resultsOfRegulation"
; set resfileN word d iteration
; export-world resfileN
set w word d "-AltNoRegS-R-"
set x word w UnderUsedResources
; set y word x CollectiveObjective
; set z word y CollectiveObjective
set resfileN word x iteration
export-world resfileN
print "End of the simulations"
print "Save & Clear the Command Center"
end
to do-NO-REGULATION
without-interruption
[
controllers-attemptto-control-underused-resources-NO-REGULATION
businesses-attemptto-use-underused-resources-NO-REGULATION
gatekeepers-attemptto-promote-underused-resources-NO-REGULATION
tourists-attemptto-visit-underused-resources-NO-REGULATION
setup-controllers-energy
setup-businesses-energy
setup-gatekeepers-energy
update-lorenz-and-gini-plots
if (BottomUpRegulation? = true) [simulate-dynamicsof-positions]
]
end
to controllers-attemptto-control-underused-resources-NO-REGULATION
type "Controllers are attempting to make more available the " type UnderUsedResources print "resources"
if (UnderUsedResources = "natural") [controllers-explore-natural-resources-NO-REGULATION]
if (UnderUsedResources = "cultural") [controllers-explore-cultural-resources-NO-REGULATION]
if (UnderUsedResources = "natural&cultural") [controllers-explore-undefined-resources-NO-REGULATION]
end
to controllers-explore-undefined-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
(natural-resources >= ResourcesThreshold or cultural-resources >= ResourcesThreshold) ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by = []
and used-by = []
]
;show listof-patches-with-underused-resources
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
;show label
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
controllers-moves-to-underused-resources-NO-REGULATION
]
]
end
to controllers-explore-natural-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by = []
and used-by = []
]
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and preffor-natural-resources >= ResourcesThreshold ; with high preference for natural resources
and perceptionoftpreffor-natural-resources >= ResourcesThreshold
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
controllers-moves-to-underused-resources-NO-REGULATION
]
]
end
to controllers-explore-cultural-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
cultural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by = []
and used-by = []
]
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and preffor-cultural-resources >= ResourcesThreshold ; with high preference for natural resources
and perceptionoftpreffor-cultural-resources >= ResourcesThreshold
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
controllers-moves-to-underused-resources-NO-REGULATION
]
]
end
to controllers-moves-to-underused-resources-NO-REGULATION ;; turtle proceduere
locals [Wp Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
set Tp count other-turtles-here with [breed = controllers and who >= TTN]
ifelse (Tp > 0)
[; one other phantom controllers is candidate to control the same patch
controllers-internal-conflicts-analysis-NO-REGULATION ; --> partners 1
ifelse (partners != [])
[;there are partners 1
;search for the bigest controllers
set bigest max-one-of turtles-here with [breed = controllers and who >= TTN][energy];[size]
ifelse (who-of bigest = who-of myself)
[;i am the winer of conflict
;set Wp values-from other-turtles-here with [breed = controllers and who >= TTN] [label]
;ask turtles with [Wp] [die]
ask other-turtles-here with [breed = controllers and who >= TTN]
[
without-interruption
[
if (member? label controlled-by-of patch-here)
[set controlled-by-of patch-here (remove label controlled-by-of patch-here)]
die
]
]
print-shiftsin-controls
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4)
ifelse (TNp8 > 1)
[; there are other actual controllers or businesses arround the asked turtle: test their objectives
controllers-external-conflicts-analysis-NO-REGULATION ; --> partners 2
]
[; no other turtles arround
;expand-preferences-ofcontrollers
print-expand-shiftsin-controls
]
]
[;i am the loser of all possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-NO-REGULATION]
]
]
[;no partners
]
]
[;no other phantom turtle is candidate to use this patch
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4);
ifelse (TNp8 > 1)
[; there are other controllers or businesses arround the asked turtle: test their objectives
controllers-external-conflicts-analysis-NO-REGULATION ; --> partners 2
]
[; no other turtles arround
;expand-preferences-ofcontrollers
print-expand-shiftsin-controls
]
]
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-NO-REGULATION]
]
end
to controllers-internal-conflicts-analysis-NO-REGULATION; to get other phantom controllers on the patch
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
set Tp count other-turtles-here with [breed = controllers and who >= TTN and Xi < 1 ]
set partners other-turtles-here with [breed = controllers and who >= TTN and Xi < 1 ]
;if partners != []
if (Tp > 0)
[; other phantom controllers would not develop tourism
type label ; type " (" type who type ")"
type " conflicts with "
type values-from partners [label]; defected-partners 1
type " to control " print patch-here
set conflict1 Tp;(conflict1 + Tp); defected-partners 1
set conflict-with-R (conflict-with-R + Tp)
if (UnderUsedResources = "natural") [set conflictVn-with-R (conflictVn-with-R + Tp)]
if (UnderUsedResources = "cultural") [set conflictVc-with-R (conflictVc-with-R + Tp)]
ask partners
[
without-interruption
[
set defected-partners lput label-of myself defected-partners
set defected-partners remove-duplicates defected-partners
]
]
]
end
to controllers-external-conflicts-analysis-NO-REGULATION; for other actual turtle around the patch
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi < 1
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi < 1
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
;if partners != [] ; partners 2
if (Tp > 0)
[;others arround would not develop tourism
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi < 1 and who < TTN]
in-radius (ResourcesDensity * 4)[energy]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible conflicts
type label ; type " (" type who type ")"
type " conflicts with "
type values-from partners [label]; defected-partners
type " to control " print patch-here
set conflict2 Tp; (conflict2 + Tp)
set conflict-with-R (conflict-with-R + count partners with [breed = controllers])
set conflict-with-B (conflict-with-B + count partners with [breed = businesses])
set conflict-with-G (conflict-with-G + count partners with [breed = gatekeepers])
if (UnderUsedResources = "natural")
[
set conflictVn-with-R (conflictVn-with-R + count partners with [breed = controllers])
set conflictVn-with-B (conflictVn-with-B + count partners with [breed = businesses])
set conflictVn-with-G (conflictVn-with-G + count partners with [breed = gatekeepers])
]
if (UnderUsedResources = "cultural")
[
set conflictVc-with-R (conflictVc-with-R + count partners with [breed = controllers])
set conflictVc-with-B (conflictVc-with-B + count partners with [breed = businesses])
set conflictVc-with-G (conflictVc-with-G + count partners with [breed = gatekeepers])
]
ask partners
[
without-interruption
[
set defected-partners lput label-of myself defected-partners
set defected-partners remove-duplicates defected-partners
]
]
;expand-preferences-ofcontrollers
set bigest max-one-of partners [energy]; [size]
ifelse (energy-of myself > energy-of bigest); I am the winner: I impose my view
[
print-shiftsin-controls
]
[
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-NO-REGULATION]
]
]
[;no conflict
;expand-preferences-ofcontrollers
print-expand-shiftsin-controls
]
]
if (member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5)
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
;if partners != []
ifelse (Tp > 0)
[;others have the same objective
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN]
in-radius (ResourcesDensity * 4) [size]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible alliances
type label ; type " (" type who type ")"
type " cooperates with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation2 Tp;(cooperation2 + Tp)
set cooperation-with-R (cooperation-with-R + count partners with [breed = controllers])
set cooperation-with-B (cooperation-with-B + count partners with [breed = businesses])
set cooperation-with-G (cooperation-with-G + count partners with [breed = gatekeepers])
ask partners
[
without-interruption
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
]
;expand-preferences-ofcontrollers
print-shiftsin-controls
]
[;no possibles alliances
]
]
[;possible conflict
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-NO-REGULATION]
]
]
end
to businesses-attemptto-use-underused-resources-NO-REGULATION
type "Businesses are attempting to make more integrated the " print UnderUsedResources
if (UnderUsedResources = "natural") [businesses-explore-natural-resources-NO-REGULATION]
if (UnderUsedResources = "cultural") [businesses-explore-cultural-resources-NO-REGULATION]
if (UnderUsedResources = "natural&cultural") [businesses-explore-undefined-resources-NO-REGULATION]
end
to businesses-explore-undefined-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
(natural-resources >= ResourcesThreshold or cultural-resources >= ResourcesThreshold) ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by = []
]
;show listof-patches-with-underused-resources
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" businesses
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
;show label
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
businesses-moves-to-underused-resources-NO-REGULATION
]
]
end
to businesses-explore-natural-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by = []
]
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" businesses
and gains > 0
and preffor-natural-resources >= ResourcesThreshold ; with high preference for natural resources
and perceptionoftpreffor-natural-resources >= ResourcesThreshold
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
businesses-moves-to-underused-resources-NO-REGULATION
]
]
end
to businesses-explore-cultural-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
cultural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by = []
]
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" businesses
and gains > 0
and preffor-cultural-resources >= ResourcesThreshold ; with high preference for natural resources
and perceptionoftpreffor-cultural-resources >= ResourcesThreshold
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
businesses-moves-to-underused-resources-NO-REGULATION
]
]
end
to businesses-moves-to-underused-resources-NO-REGULATION ;; turtle proceduere
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
set Tp count other-turtles-here with [breed = businesses and who >= TTN]
ifelse (Tp > 0)
[; one other phantom businesses is candidate to control the same patch
;type Tp print " other phantom businesse(s) on the patch"
businesses-internal-conflicts-analysis-NO-REGULATION ; --> partners
ifelse (partners != [])
[;there are partners
;search for the bigest businesses
set bigest max-one-of turtles-here with [breed = businesses and who >= TTN][energy];[size]
ifelse (who-of bigest = who-of myself)
[;i am the winer of all possible conflicts
ask other-turtles-here with [breed = businesses and who >= TTN]
[
without-interruption
[
if (member? label used-by-of patch-here)
[set used-by-of patch-here (remove label used-by-of patch-here)]
die
]
]
print-shiftsin-uses
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4); and who >= TTN
ifelse (TNp8 > 1)
[; there are other actual businesses arround the asked turtle
businesses-external-conflicts-analysis-NO-REGULATION
]
[; no other turtles arround
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
]
[;i am the loser of all possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-NO-REGULATION]
]
]
[;no partners
]
]
[;no other phantom turtle is candidate to use this patch
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4)
ifelse (TNp8 > 1)
[; there are other businesses arround the asked turtle
businesses-external-conflicts-analysis-NO-REGULATION
]
[; no other turtles arround
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
]
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-NO-REGULATION]
]
end
to businesses-internal-conflicts-analysis-NO-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
set Tp count other-turtles-here with [breed = businesses and Xi < 1 and who >= TTN]
set partners other-turtles-here with [breed = businesses and Xi < 1 and who >= TTN]
;if partners != []
if (Tp > 0)
[; other phantom businesses would not develop tourism
type Tp print " other phantom business(es) with different view on the patch"
type label ; type " (" type who type ")"
type " conflicts with "
type values-from partners [label]; defected-partners
type " to use " print patch-here
set conflict1 Tp;(conflict1 + Tp)
set conflict-with-B (conflict-with-B + Tp)
if (UnderUsedResources = "natural") [set conflictVn-with-B (conflictVn-with-B + Tp)]
if (UnderUsedResources = "cultural")[set conflictVc-with-B (conflictVc-with-B + Tp)]
ask partners
[
set defected-partners lput label-of myself defected-partners
set defected-partners remove-duplicates defected-partners
]
]
end
to businesses-external-conflicts-analysis-NO-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
set Tp count turtles with [(breed = businesses or breed = controllers or breed = gatekeepers)
and Xi < 1
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = businesses or breed = controllers or breed = gatekeepers)
and Xi < 1
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
;if partners != []
if (Tp > 0)
[;others arround would not develop tourism
set OTNp8 max-one-of turtles with [(breed = businesses or breed = controllers) and Xi < 1 and who < TTN]
in-radius (ResourcesDensity * 4)[energy]; [size]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible conflicts
type label ; type " (" type who type ")"
type " conflicts with "
type values-from partners [label]; defected-partners
type " to use " print patch-here
set conflict2 Tp; (conflict2 + Tp)
set conflict-with-R (conflict-with-R + count partners with [breed = controllers])
set conflict-with-B (conflict-with-B + count partners with [breed = businesses])
set conflict-with-G (conflict-with-G + count partners with [breed = gatekeepers])
if (UnderUsedResources = "natural")
[
set conflictVn-with-R (conflictVn-with-R + count partners with [breed = controllers])
set conflictVn-with-B (conflictVn-with-B + count partners with [breed = businesses])
set conflictVn-with-G (conflictVn-with-G + count partners with [breed = gatekeepers])
]
if (UnderUsedResources = "cultural")
[
set conflictVc-with-R (conflictVc-with-R + count partners with [breed = controllers])
set conflictVc-with-B (conflictVc-with-B + count partners with [breed = businesses])
set conflictVc-with-G (conflictVc-with-G + count partners with [breed = gatekeepers])
]
ask partners
[
set defected-partners lput label-of myself defected-partners
set defected-partners remove-duplicates defected-partners
]
;expand-preferences-ofbusinesses
set bigest max-one-of partners [energy];[size]
ifelse (energy-of myself > energy-of bigest)
[
print-shiftsin-uses
]
[
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-NO-REGULATION]
]
]
[;no conflict
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
]
if (member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5)
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
;if partners != []
ifelse (Tp > 0)
[;others have the same objective
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN]
in-radius (ResourcesDensity * 4) [energy]; [size]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible alliances
type label ; type " (" type who type ")"
type " cooperates with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation2 Tp;(cooperation2 + Tp)
set cooperation-with-R (cooperation-with-R + count partners with [breed = controllers])
set cooperation-with-B (cooperation-with-B + count partners with [breed = businesses])
set cooperation-with-G (cooperation-with-G + count partners with [breed = gatekeepers])
ask partners
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
[;no possible alliances
]
]
[;possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-NO-REGULATION]
]
]
end
to gatekeepers-attemptto-promote-underused-resources-NO-REGULATION
type "Gatekeepers are attempting to make more promoted the " print UnderUsedResources
if (UnderUsedResources = "natural") [gatekeepers-explore-natural-resources-NO-REGULATION]
if (UnderUsedResources = "cultural") [gatekeepers-explore-cultural-resources-NO-REGULATION]
if (UnderUsedResources = "natural&cultural") [gatekeepers-explore-undefined-resources-NO-REGULATION]
end
to gatekeepers-explore-undefined-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
(natural-resources >= ResourcesThreshold or cultural-resources >= ResourcesThreshold) ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and promoted-by = []
and (controlled-by != [] or used-by != [])
]
;show listof-patches-with-underused-resources
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" gatekeepers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
;show label
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
gatekeepers-moves-to-underused-resources-NO-REGULATION
]
]
end
to gatekeepers-explore-natural-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and promoted-by = []
and (controlled-by != [] or used-by != [])
]
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" gatekeepers
and gains > 0
and preffor-natural-resources >= ResourcesThreshold ; with high preference for natural resources
and perceptionoftpreffor-natural-resources >= ResourcesThreshold
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
gatekeepers-moves-to-underused-resources-NO-REGULATION
]
]
end
to gatekeepers-explore-cultural-resources-NO-REGULATION
set listof-patches-with-underused-resources patches with
[
cultural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and promoted-by = []
and (controlled-by != [] or used-by != [])
]
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" gatekeepers
and gains > 0
and preffor-cultural-resources >= ResourcesThreshold ; with high preference for natural resources
and perceptionoftpreffor-cultural-resources >= ResourcesThreshold
and Xi = 1 ; for an increasing of the number of tourists
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
gatekeepers-moves-to-underused-resources-NO-REGULATION
]
]
end
to gatekeepers-moves-to-underused-resources-NO-REGULATION-old ;; turtle proceduere
locals [bigest TNp8 OTNp8 dis]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
;expand-preferences-ofgatekeepers
print-shiftsin-promotions
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-NO-REGULATION ]
]
end
to gatekeepers-moves-to-underused-resources-NO-REGULATION ;; turtle proceduere
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
set Tp count other-turtles-here with [breed = gatekeepers and who >= TTN]
ifelse (Tp > 0)
[; one other phantom gatekeepers is candidate to control the same patch
;type Tp print " other phantom businesse(s) on the patch"
gatekeepers-internal-conflicts-analysis-NO-REGULATION ; --> partners
ifelse (partners != [])
[;there are partners
;search for the bigest businesses
set bigest max-one-of turtles-here with [breed = gatekeepers and who >= TTN][size]
ifelse (who-of bigest = who-of myself)
[;i am the winer of all possible conflicts
ask other-turtles-here with [breed = gatekeepers and who >= TTN]
[
without-interruption
[
if (member? label promoted-by-of patch-here)
[set promoted-by-of patch-here (remove label promoted-by-of patch-here)]
die
]
]
print-shiftsin-promotions
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4); and who >= TTN
ifelse (TNp8 > 1)
[; there are other actual turtles arround the asked turtle
gatekeepers-external-conflicts-analysis-NO-REGULATION
]
[; no other turtles arround
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
]
[;i am the loser of all possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-NO-REGULATION]
]
]
[;no partners
]
]
[;no other phantom turtle is candidate to use this patch
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4)
ifelse (TNp8 > 1)
[; there are other gatekeepers arround the asked turtle
gatekeepers-external-conflicts-analysis-NO-REGULATION
]
[; no other turtles arround
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
]
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-NO-REGULATION]
]
end
to gatekeepers-internal-conflicts-analysis-NO-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
set Tp count other-turtles-here with [breed = gatekeepers and Xi < 1 and who >= TTN]
set partners other-turtles-here with [breed = gatekeepers and Xi < 1 and who >= TTN]
;if partners != []
if (Tp > 0)
[; other phantom gatekeepers would not develop tourism
type Tp print " other phantom gatekeepers(es) with different view on the patch"
type label ; type " (" type who type ")"
type " conflicts with "
type values-from partners [label]; defected-partners
type " to use " print patch-here
set conflict1 Tp;(conflict1 + Tp)
set conflict-with-G (conflict-with-G + Tp)
if (UnderUsedResources = "natural") [set conflictVn-with-G (conflictVn-with-G + Tp)]
if (UnderUsedResources = "cultural") [set conflictVc-with-G (conflictVc-with-G + Tp)]
ask partners
[
set defected-partners lput label-of myself defected-partners
set defected-partners remove-duplicates defected-partners
]
]
end
to gatekeepers-external-conflicts-analysis-NO-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
set Tp count turtles with [(breed = businesses or breed = controllers or breed = gatekeepers)
and Xi < 1
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = businesses or breed = controllers or breed = gatekeepers)
and Xi < 1
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
;if partners != []
if (Tp > 0)
[;others arround would not develop tourism
set OTNp8 max-one-of turtles with [(breed = businesses or breed = controllers or breed = gatekeepers) and Xi < 1 and who < TTN]
in-radius (ResourcesDensity * 4) [size]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible conflicts
type label ; type " (" type who type ")"
type " conflicts with "
type values-from partners [label]; defected-partners
type " to use " print patch-here
set conflict2 Tp; (conflict2 + Tp)
set conflict-with-R (conflict-with-R + count partners with [breed = controllers])
set conflict-with-B (conflict-with-B + count partners with [breed = businesses])
set conflict-with-G (conflict-with-G + count partners with [breed = gatekeepers])
if (UnderUsedResources = "natural")
[
set conflictVn-with-R (conflictVn-with-R + count partners with [breed = controllers])
set conflictVn-with-B (conflictVn-with-B + count partners with [breed = businesses])
set conflictVn-with-G (conflictVn-with-G + count partners with [breed = gatekeepers])
]
if (UnderUsedResources = "cultural")
[
set conflictVc-with-R (conflictVc-with-R + count partners with [breed = controllers])
set conflictVc-with-B (conflictVc-with-B + count partners with [breed = businesses])
set conflictVc-with-G (conflictVc-with-G + count partners with [breed = gatekeepers])
]
ask partners
[
set defected-partners lput label-of myself defected-partners
set defected-partners remove-duplicates defected-partners
]
;expand-preferences-ofgatekeepers
set bigest max-one-of partners [size]
ifelse (size-of myself > size-of bigest)
[
print-shiftsin-promotions
]
[
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-NO-REGULATION]
]
]
[;no conflict
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
]
if (member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5)
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and gains > 0
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
;if partners != []
ifelse (Tp > 0)
[;others have the same objective
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Ei = Ei-of self and (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [size]
ifelse OTNp8 != nobody [set dis distance OTNp8] [set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible alliances
type label ; type " (" type who type ")"
type " could cooperate 2 with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation2 Tp;(cooperation2 + Tp)
set cooperation-with-R (cooperation-with-R + count partners with [breed = controllers])
set cooperation-with-B (cooperation-with-B + count partners with [breed = businesses])
set cooperation-with-G (cooperation-with-G + count partners with [breed = gatekeepers])
ask partners
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
[;no possibles alliances
]
]
[;possible conflict
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-NO-REGULATION]
]
]
end
to tourists-attemptto-visit-underused-resources-NO-REGULATION
locals [ta tb tc]
print "New tourists are attempting to find patches that match their expectations "
;set NTs count turtles with [breed = tourists and who >= TTN]
;set OTs count turtles with [breed = tourists and who < TTN]
set numof-unsatisfied-tourists 0
set KilledTourists 0
set HostCommunitiesConflicts 0
set avenumof-unsatisfied-communities 0
;set minnumof-unsatisfied-communities 0
;set maxnumof-unsatisfied-communities 0
;set ta count turtles with [breed = communities and who < TTN and Xi < 0]
setup-newtourists-preferences
ask turtles with [breed = tourists and who >= TTN]
[
without-interruption
[
set attempt 0
set score 0
move-to-upper-preferences
];close without
];close ask
set tb count turtles with [breed = tourists and who >= TTN and score > 0]
ifelse (tb > 0) [
set avenumof-unsatisfied-communities round (mean values-from turtles with [breed = tourists and who >= TTN][score])
;set minnumof-unsatisfied-communities round (min values-from turtles with [breed = tourists and who >= TTN][score])
;set maxnumof-unsatisfied-communities round (max values-from turtles with [breed = tourists and who >= TTN][score])
]
[
set avenumof-unsatisfied-communities 0
;set minnumof-unsatisfied-communities 0
;set maxnumof-unsatisfied-communities 0
]
;set tc count turtles with [breed = communities and who < TTN and Xi < 0]
;type (tc - ta) print " communities shift from 'neutral' to 'against' T evolution"
end
to setup-conflicts-and-cooperations-to-zero
set numof-conflictsVn-between-controllers-and-controllers 0
set numof-conflictsVn-between-controllers-and-businesses 0
set numof-conflictsVn-between-controllers-and-gatekeepers 0
set numof-conflictsVn-between-controllers-and-communities 0
set numof-conflictsVn-between-controllers-and-institutions 0
set numof-conflictsVn-between-businesses-and-controllers 0
set numof-conflictsVn-between-businesses-and-businesses 0
set numof-conflictsVn-between-businesses-and-gatekeepers 0
set numof-conflictsVn-between-businesses-and-communities 0
set numof-conflictsVn-between-businesses-and-institutions 0
set numof-conflictsVc-between-controllers-and-controllers 0
set numof-conflictsVC-between-controllers-and-businesses 0
set numof-conflictsVc-between-controllers-and-gatekeepers 0
set numof-conflictsVc-between-controllers-and-communities 0
set numof-conflictsVc-between-controllers-and-institutions 0
set numof-conflictsVc-between-businesses-and-controllers 0
set numof-conflictsVc-between-businesses-and-businesses 0
set numof-conflictsVc-between-businesses-and-gatekeepers 0
set numof-conflictsVc-between-businesses-and-communities 0
set numof-conflictsVc-between-businesses-and-institutions 0
ask turtles
[
without-interruption
[
set defected-partners []
set cooperative-partners []
set conflict1 0
set conflict2 0
set cooperation1 0
set cooperation2 0
set conflict-with-R 0
set conflict-with-B 0
set conflict-with-G 0
set cooperation-with-R 0
set cooperation-with-B 0
set cooperation-with-G 0
];without
];ask
end
to remove-duplicates-controls-uses-promotions
ask patches
[
without-interruption
[
set controlled-by remove-duplicates controlled-by
set used-by remove-duplicates used-by
set promoted-by remove-duplicates promoted-by
set visited-by remove-duplicates visited-by
set liked-by remove-duplicates liked-by
set supported-by remove-duplicates supported-by
set controlled-byw remove-duplicates controlled-byw
set used-byw remove-duplicates used-byw
set promoted-byw remove-duplicates promoted-byw
set visited-byw remove-duplicates visited-byw
set liked-byw remove-duplicates liked-byw
set supported-byw remove-duplicates supported-byw
]
]
end
to print-shiftsin-controls
locals [PNi PNf PNv]
set PNi count patches with [member? label-of myself controlled-by]
;ask patches in-radius (ResourcesDensity * size)
ask patch-here
[
without-interruption
[
set controlled-by lput label-of myself controlled-by
set controlled-byw lput myself controlled-byw
if who-of myself >= TTN [set plabel "r."]
]
]
set PNf count patches with [member? label-of myself controlled-by]
set new-active-patches PNf
set PNv (PNf - PNi)
if PNv > 0 [type label type " controls " type PNv type " patches more (" type PNf print ")"]
end
to print-shiftsin-uses
locals [PNi PNf PNv]
set PNi count patches with [member? label-of myself used-by]
;ifelse (resources-of patch-here < resources-preference);-of myself)
; [
; expand-preferences-ofbusinesses
; ]
; [
;ask patches in-radius (ResourcesDensity * size)
ask patch-here
[
without-interruption
[
set used-by lput label-of myself used-by
set used-byw lput myself used-byw
if who-of myself >= TTN [set plabel "b+"]
]
]
; ]
set PNf count patches with [member? label-of myself used-by]
set new-active-patches PNf
set PNv (PNf - PNi)
if PNv > 0 [type label type " uses " type PNv type " patches more (" type PNf print ")"]
end
to print-shiftsin-promotions
locals [PNi PNf PNv]
set PNi count patches with [member? label-of myself promoted-by]
;ask patches in-radius (ResourcesDensity * size)
ask patch-here
[
without-interruption
[
set promoted-by lput label-of myself promoted-by
set promoted-byw lput myself promoted-byw
if who-of myself >= TTN [set plabel "g*"]
]
]
set PNf count patches with [member? label-of myself promoted-by]
set new-active-patches PNf
set PNv (PNf - PNi)
if PNv > 0 [type label type " promotes " type PNv type " patches more (" type PNf print ")"]
end
to print-expand-shiftsin-controls
locals [PNi PNf PNv]
set PNi count patches with [member? label-of myself controlled-by]
ask patches in-radius (ResourcesDensity * size)
[
without-interruption
[
set controlled-by lput label-of myself controlled-by
set controlled-byw lput myself controlled-byw
if who-of myself >= TTN [set plabel "r."]
]
]
set PNf count patches with [member? label-of myself controlled-by]
set new-active-patches PNf
set PNv (PNf - PNi)
if PNv > 0 [type label type " controls " type PNv type " patches more (" type PNf print ")"]
end
to print-expand-shiftsin-uses
locals [PNi PNf PNv]
set PNi count patches with [member? label-of myself used-by]
;ifelse (resources-of patch-here < resources-preference);-of myself)
; [
; expand-preferences-ofbusinesses
; ]
; [
ask patches in-radius (ResourcesDensity * size)
[
without-interruption
[
set used-by lput label-of myself used-by
set used-byw lput myself used-byw
if who-of myself >= TTN [set plabel "b+"]
]
]
; ]
set PNf count patches with [member? label-of myself used-by]
set new-active-patches PNf
set PNv (PNf - PNi)
if PNv > 0 [type label type " uses " type PNv type " patches more (" type PNf print ")"]
end
to print-expand-shiftsin-promotions
locals [PNi PNf PNv]
set PNi count patches with [member? label-of myself promoted-by]
ask patches in-radius (ResourcesDensity * size)
[
without-interruption
[
set promoted-by lput label-of myself promoted-by
set promoted-byw lput myself promoted-byw
if who-of myself >= TTN [set plabel "g*"]
]
]
set PNf count patches with [member? label-of myself promoted-by]
set new-active-patches PNf
set PNv (PNf - PNi)
if PNv > 0 [type label type " promotes " type PNv type " patches more (" type PNf print ")"]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; TO BUILD INSTITUTIONS LEADED SCENARIOS (TOP DOWN REGULATION)
;; simulate controllers, businesses, and gatekeepers acting as institutions and them would like to see done (charter)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to build-topdown-regulated-scenarios
locals [w x y z]
;setup-user-input-parameters-1
if iteration = 0
[
set-current-plot "Controllers Behaviours"
clear-plot
set-current-plot "Businesses Behaviours"
clear-plot
set-current-plot "Gatekeepers Behaviours"
clear-plot
set-current-plot "Controllers Interactions"
clear-plot
set-current-plot "Businesses Interactions"
clear-plot
set-current-plot "Gatekeepers Interactions"
clear-plot
set-current-plot "Provisioned Resources"
clear-plot
set-current-plot "Used Resources"
clear-plot
set-current-plot "Promoted Resources"
clear-plot
set-current-plot "Visited Resources"
clear-plot
set-current-plot "Tourists Density"
clear-plot
set-current-plot "Tourists"
clear-plot
set-current-plot "Communities"
clear-plot
reset-phantoms
set TypeOfRegulation " policy"
setup-user-input-parameters-2
]
set TTN count turtles
setup-conflicts-and-cooperations-to-zero
do-plotting-conflicts-and-cooperations-RBG
do-bookkeeping-initial-patch-counts
print-initial-patch-counts2
do-plotting-behaviours-reg
while [iteration < Iterations] ; true
[
without-interruption
[
set iteration iteration + 1
type "No Regualtion scenario, iter " print iteration
remove-duplicates-controls-uses-promotions
do-TOPDOWN-REGULATION
do-bookkeeping-initial-patch-counts
print-initial-patch-counts2
do-plotting-conflicts-and-cooperations-RBG
do-plotting-behaviours-reg
set numof-unsatisfied-tourists 0
set avenumof-unsatisfied-communities 0
;set minnumof-unsatisfied-communities 0
;set maxnumof-unsatisfied-communities 0
set KilledTourists 0
type "End of iteration " print iteration
];without
];while
print-initial-situation
count-conflictsVn-amongRBGCI
; print-conflictsVn-amongRBGCI
count-conflictsVc-amongRBGCI
; print-conflictsVc-amongRBGCI
; reset-phantoms
; set a word "SPRITE-" country
; set b word a region
; set c word b event
; set d word c "resultsOfRegulation"
; set resfileN word d iteration
; export-world resfileN
set w word d "-AltRegS-R-"
set x word w UnderUsedResources
set y word x CollectiveObjective
; set z word y CollectiveObjective
set resfileN word y iteration
export-world resfileN
print "End of the simulations"
print "Save & Clear the Command Center"
end
to do-TOPDOWN-REGULATION
without-interruption
[
controllers-attemptto-control-underused-resources-TOPDOWN-REGULATION
businesses-attemptto-use-underused-resources-TOPDOWN-REGULATION
gatekeepers-attemptto-promote-underused-resources-TOPDOWN-REGULATION
tourists-attemptto-visit-underused-resources-TOPDOWN-REGULATION
setup-controllers-energy
setup-businesses-energy
setup-gatekeepers-energy
update-lorenz-and-gini-plots
if (BottomUpRegulation? = true) [simulate-dynamicsof-positions]
]
end
to controllers-attemptto-control-underused-resources-TOPDOWN-REGULATION
type "Controllers are attempting to make more available the " print UnderUsedResources
if (UnderUsedResources = "natural") [controllers-explore-natural-resources-TOPDOWN-REGULATION]
if (UnderUsedResources = "cultural") [controllers-explore-cultural-resources-TOPDOWN-REGULATION]
if (UnderUsedResources = "natural&cultural") [controllers-explore-undefined-resources-TOPDOWN-REGULATION]
end
to controllers-explore-undefined-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
(natural-resources >= ResourcesThreshold or cultural-resources >= ResourcesThreshold) ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by = []
and used-by = []
]
;show listof-patches-with-underused-resources
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
controllers-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to controllers-explore-natural-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by != []
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
controllers-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to controllers-explore-cultural-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by != []
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = controllers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
controllers-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to controllers-moves-to-underused-resources-TOPDOWN-REGULATION ;; turtle proceduere
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
set Tp count other-turtles-here with [breed = controllers and who >= TTN]
ifelse (Tp > 0)
[; one other phantom controllers is candidate to control the same patch
controllers-internal-conflicts-analysis-TOPDOWN-REGULATION ; --> partners
ifelse (partners != [])
[;there are partners
;search for the bigest controllers
set bigest max-one-of turtles-here with [breed = controllers and who >= TTN][energy];[size]
ifelse (who-of bigest = who-of myself)
[;i am the winer of conflict but I have to respect others
;ask other-turtles-here with [breed = controllers and who >= TTN] [die]
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4)
ifelse (TNp8 > 1)
[; there are other actual controllers or businesses arround the asked turtle
controllers-external-conflicts-analysis-TOPDOWN-REGULATION
]
[; no other controllers arround
;expand-preferences-ofcontrollers
print-expand-shiftsin-controls
]
]
[;i am the loser of all possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-TOPDOWN-REGULATION]
]
]
[;no partners
]
]
[;no other phantom turtle is candidate to use this patch
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4); and who >= TTN
ifelse (TNp8 > 1)
[; there are other controllers or businesses arround the asked turtle
controllers-external-conflicts-analysis-TOPDOWN-REGULATION
]
[; no other controllers arround
;expand-preferences-ofcontrollers
print-expand-shiftsin-controls
]
]
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-TOPDOWN-REGULATION]
]
end
to controllers-internal-conflicts-analysis-TOPDOWN-REGULATION; to get other phantom controllers on the patch
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
ifelse CollectiveObjective = "all together"
[
set Tp count other-turtles-here with [breed = controllers and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
set partners other-turtles-here with [breed = controllers and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
]
[
set Tp count other-turtles-here with [breed = controllers and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
set partners other-turtles-here with [breed = controllers and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
]
;if partners != []
ifelse (Tp > 0)
[; other phantom has the same objectives
type label ; type " (" type who type ")"
type " cooperates 1 with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation1 Tp; (cooperation1 + Tp)
set cooperation-with-R (cooperation-with-R + Tp)
ask partners
[
without-interruption
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
]
;expand-preferences-ofcontrollers
print-shiftsin-controls
]
[;possible conflict
;see above
]
end
to controllers-external-conflicts-analysis-TOPDOWN-REGULATION; for other actual turtle around the patch
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
ifelse CollectiveObjective = "all together"
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
]
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
]
;if partners != []
ifelse (Tp > 0)
[;others have the same objective
ifelse CollectiveObjective = "all together"
[
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [size]
]
[
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [size]
]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible alliances
type label ; type " (" type who type ")"
type " cooperates with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation2 Tp;(cooperation2 + Tp)
set cooperation-with-R (cooperation-with-R + count partners with [breed = controllers])
set cooperation-with-B (cooperation-with-B + count partners with [breed = businesses])
set cooperation-with-G (cooperation-with-G + count partners with [breed = gatekeepers])
ask partners
[
without-interruption
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
]
;expand-preferences-ofcontrollers
print-shiftsin-controls
]
[;no possibles alliances
]
]
[;possible conflict
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-TOPDOWN-REGULATION]
]
end
to businesses-attemptto-use-underused-resources-TOPDOWN-REGULATION
type "Businesses are attempting to make more integrated the " print UnderUsedResources
if (UnderUsedResources = "natural") [businesses-explore-natural-resources-TOPDOWN-REGULATION]
if (UnderUsedResources = "cultural") [businesses-explore-cultural-resources-TOPDOWN-REGULATION]
if (UnderUsedResources = "natural&cultural") [businesses-explore-undefined-resources-TOPDOWN-REGULATION]
end
to businesses-explore-undefined-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by != []
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
businesses-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to businesses-explore-natural-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by != []
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
businesses-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to businesses-explore-cultural-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and controlled-by != []
and used-by != []
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = businesses
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
businesses-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to businesses-moves-to-underused-resources-TOPDOWN-REGULATION ;; turtle proceduere
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
set Tp count other-turtles-here with [breed = businesses and who >= TTN]
ifelse (Tp > 0)
[; one other phantom businesses is candidate to control the same patch
;type Tp print " other phantom businesse(s) on the patch"
businesses-internal-conflicts-analysis-TOPDOWN-REGULATION ; --> partners
ifelse (partners != [])
[;there are partners
;search for the bigest businesses
set bigest max-one-of turtles-here with [breed = businesses and who >= TTN][energy];[size]
ifelse (who-of bigest = who-of myself)
[;i am the winer of all possible conflicts but I have to respect others
;ask other-turtles-here with [breed = businesses and who >= TTN] [die]
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4); and who >= TTN
ifelse (TNp8 > 1)
[; there are other actual businesses arround the asked turtle
businesses-external-conflicts-analysis-TOPDOWN-REGULATION
]
[; no other businesses arround
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
]
[;i am the loser of all possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-TOPDOWN-REGULATION]
]
]
[;no partners
]
]
[;no other phantom turtle is candidate to use this patch
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4)
ifelse (TNp8 > 1)
[; there are other businesses arround the asked turtle
businesses-external-conflicts-analysis-TOPDOWN-REGULATION
]
[; no other businesses arround
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
]
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-TOPDOWN-REGULATION]
]
end
to businesses-internal-conflicts-analysis-TOPDOWN-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
ifelse CollectiveObjective = "all together"
[
set Tp count other-turtles-here with [breed = businesses and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
set partners other-turtles-here with [breed = businesses and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
]
[
set Tp count other-turtles-here with [breed = businesses and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
set partners other-turtles-here with [breed = businesses and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
]
;if partners != []
ifelse (Tp > 0)
[; other phantom has the same objectives
type label ; type " (" type who type ")"
type " could cooperate 1 with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation1 Tp; (cooperation1 + Tp)
set cooperation-with-B (cooperation-with-B + Tp)
ask partners
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
[;possible conflict
;see above
]
end
to businesses-external-conflicts-analysis-TOPDOWN-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
ifelse CollectiveObjective = "all together"
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
]
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
]
;if partners != []
ifelse (Tp > 0)
[;others have the same objective
ifelse CollectiveObjective = "all together"
[
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [energy]; [size]
]
[
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [energy]; [size]
]
ifelse OTNp8 != nobody [set dis distance OTNp8][set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible alliances
type label ; type " (" type who type ")"
type " cooperates with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation2 Tp;(cooperation2 + Tp)
set cooperation-with-R (cooperation-with-R + count partners with [breed = controllers])
set cooperation-with-B (cooperation-with-B + count partners with [breed = businesses])
set cooperation-with-G (cooperation-with-G + count partners with [breed = gatekeepers])
ask partners
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
;expand-preferences-ofbusinesses
print-expand-shiftsin-uses
]
[;no possible alliances
]
]
[;possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [businesses-moves-to-underused-resources-TOPDOWN-REGULATION]
]
end
to gatekeepers-attemptto-promote-underused-resources-TOPDOWN-REGULATION
type "Gatekeepers are attempting to make more promoted the " print UnderUsedResources
if (UnderUsedResources = "natural") [gatekeepers-explore-natural-resources-TOPDOWN-REGULATION]
if (UnderUsedResources = "cultural") [gatekeepers-explore-cultural-resources-TOPDOWN-REGULATION]
if (UnderUsedResources = "natural&cultural") [gatekeepers-explore-undefined-resources-TOPDOWN-REGULATION]
end
to gatekeepers-explore-undefined-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and promoted-by = []
and (controlled-by != [] or used-by != [])
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to gatekeepers-explore-natural-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and promoted-by = []
and (controlled-by != [] or used-by != [])
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-natural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to gatekeepers-explore-cultural-resources-TOPDOWN-REGULATION
set listof-patches-with-underused-resources patches with
[
natural-resources >= ResourcesThreshold ;; UnderUsedResources >= ResourcesThreshold (O.5 ..0.9)
and promoted-by = []
and (controlled-by != [] or used-by != [])
]
ifelse CollectiveObjective = "all together"
[
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Q5113i = 999 ; and agreeing with one othe the collective objectives
]
]
[
set listof-turtles-with-same-profile turtles with
[
breed = gatekeepers
and who < TTN ; only "actual" controllers
and gains > 0
and (preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and Xi = 1 ; for an increasing of the number of tourists
and Ei = collective-build-in-goal ; and agreeing with the collective objective
]
]
ask listof-turtles-with-same-profile
[
hatch 1
[;then move its "phantom" by refering to its VisionRange
set attempt 1
hideturtle
gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION
]
]
end
to gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION-old ;; turtle proceduere
locals [bigest TNp8 OTNp8 dis]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[
;expand-preferences-ofgatekeepers
print-shiftsin-promotions
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION ]
]
end
to gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION ;; turtle proceduere
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
setxy (random-int-or-float screen-size-x) (random-int-or-float screen-size-y)
ifelse (patch-here = random-one-of listof-patches-with-underused-resources)
[;patch OK
set Tp count other-turtles-here with [breed = gatekeepers and who >= TTN]
ifelse (Tp > 0)
[; one other phantom gatekeepers is candidate to control the same patch
;type Tp print " other phantom businesse(s) on the patch"
gatekeepers-internal-conflicts-analysis-TOPDOWN-REGULATION ; --> partners
ifelse (partners != [])
[;there are partners
;search for the bigest businesses
set bigest max-one-of turtles-here with [breed = gatekeepers and who >= TTN][size]
ifelse (who-of bigest = who-of myself)
[;i am the winer of all possible conflicts but I have to respect others
;ask other-turtles-here with [breed = gatekeepers and who >= TTN] [die]
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4); and who >= TTN
ifelse (TNp8 > 1)
[; there are other actual businesses arround the asked turtle
gatekeepers-external-conflicts-analysis-TOPDOWN-REGULATION
]
[; no other gatekeepers arround
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
]
[;i am the loser of all possible conflicts
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION]
]
]
[;no partners
]
]
[;no other phantom turtle is candidate to use this patch
set TNp8 count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers) and who < TTN]
in-radius (ResourcesDensity * 4)
ifelse (TNp8 > 1)
[; there are other gatekeepers arround the asked turtle
gatekeepers-external-conflicts-analysis-TOPDOWN-REGULATION
]
[; no other gatekeepers arround
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
]
]
[; it is not a good patch
set attempt (attempt + 1)
if (attempt < 2000) [gatekeepers-moves-to-underused-resources-TOPDOWN-REGULATION]
]
end
to gatekeepers-internal-conflicts-analysis-TOPDOWN-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
ifelse CollectiveObjective = "all together"
[
set Tp count other-turtles-here with [breed = gatekeepers and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
set partners other-turtles-here with [breed = gatekeepers and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
]
[
set Tp count other-turtles-here with [breed = gatekeepers and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
set partners other-turtles-here with [breed = gatekeepers and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who >= TTN]
]
;if partners != []
ifelse (Tp > 0)
[; other phantom has the same objectives
type label ; type " (" type who type ")"
type " could cooperate 1 with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation1 Tp; (cooperation1 + Tp)
set cooperation-with-G (cooperation-with-G + Tp)
ask partners
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
[;possible conflict
;see above
]
end
to gatekeepers-external-conflicts-analysis-TOPDOWN-REGULATION
locals [Tp partners bigest TNp8 OTNp8 dis PNi PNf PNv]
ifelse CollectiveObjective = "all together"
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
]
[
set Tp count turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
set partners turtles with [(breed = controllers or breed = businesses or breed = gatekeepers)
and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN and label-of self != label-of myself]
in-radius (ResourcesDensity * 4)
]
;if partners != []
ifelse (Tp > 0)
[;others have the same objective
ifelse CollectiveObjective = "all together"
[
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Q5113i = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [size]
]
[
set OTNp8 max-one-of turtles with [(breed = controllers or breed = businesses) and Xi = 1
and (Ei = collective-build-in-goal or (Ei = 12 or member? 23 Qx5 or member? 24 Qx5 or member? 25 Qx5 or member? 26 Qx5 or member? 27 Qx5))
and (preffor-natural-resources >= ResourcesThreshold or preffor-cultural-resources >= ResourcesThreshold)
;and (perceptionoftpreffor-natural-resources >= ResourcesThreshold or perceptionoftpreffor-cultural-resources >= ResourcesThreshold)
and who < TTN]
in-radius (ResourcesDensity * 4) [size]
]
ifelse OTNp8 != nobody [set dis distance OTNp8] [set dis 0]
ifelse (dis > 0 and dis < ((size-of OTNp8 * ResourcesDensity) + (size * ResourcesDensity)))
[;possible alliances
type label ; type " (" type who type ")"
type " could cooperate 2 with "
type values-from partners [label]; cooperative-partners
type " to control " print patch-here
set cooperation2 Tp;(cooperation2 + Tp)
set cooperation-with-R (cooperation-with-R + count partners with [breed = controllers])
set cooperation-with-B (cooperation-with-B + count partners with [breed = businesses])
set cooperation-with-G (cooperation-with-G + count partners with [breed = gatekeepers])
ask partners
[
set cooperative-partners lput label-of myself cooperative-partners
set cooperative-partners remove-duplicates cooperative-partners
]
;expand-preferences-ofgatekeepers
print-expand-shiftsin-promotions
]
[;no possibles alliances
]
]
[;possible conflict
set attempt (attempt + 1)
if (attempt < 2000) [controllers-moves-to-underused-resources-TOPDOWN-REGULATION]
]
end
to tourists-attemptto-visit-underused-resources-TOPDOWN-REGULATION
locals [NTs NNTs OTs ONTs DNTs DONTs]
print "New tourists are attempting to find patches that match their expectations "
set NTs count turtles with [breed = tourists and who >= TTN]
set OTs count turtles with [breed = tourists and who < TTN]
set numof-unsatisfied-tourists 0
set KilledTourists 0
setup-newtourists-preferences
ask turtles with [breed = tourists and who >= TTN]
[
without-interruption
[
set attempt 0
move-to-upper-preferences
];close without
];close ask
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; GAME LEADED INTERACTIONS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-games
do-iterated-controllers-NPD
do-evolutionary-businesses-CG
do-evolutionary-gatekeepers-CG
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ITERATED N PRISONER'S DILEMMA
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-iterated-controllers-NPD
;; secondary setup procedures
set iteration 0
set-current-plot "Controllers Behaviours"
clear-plot
reset-count-games
reset-phantoms
set TTN count turtles; to be used to differentiate hatched ("phantom") turtles to actual turtles
show TTN
setup-more-controllers-NPD
store-initial-turtle-counts-NPD
setup-common-variables-NPD
;; runtime procedures
while [iteration < 500];(100 * Iterations)] ; true
[
do-iNPD
]
if num-cooperate-games > 0 [type "average payoff of cooperation (S1): " print precision (cooperate-score / (num-cooperate-games)) 1]
if num-defect-games > 0 [type "average payoff of defection (S2): " print precision (defect-score / (num-defect-games)) 1]
if num-unforgiving-games > 0 [type "average payoff of unforgiving (S3): " print precision (unforgiving-score / (num-unforgiving-games)) 1]
if num-tit-for-tat-games > 0 [type "average payoff of tit-for-tat (S4): " print precision (tit-for-tat-score / (num-tit-for-tat-games)) 1]
if num-suspicious-tft-games > 0 [type "average payoff of suspicious-tft (S5): " print precision (suspicious-tft-score / (num-suspicious-tft-games)) 1]
if num-trusting-ad-games > 0 [type "average payoff of trusting-ad (S6): " print precision (trusting-ad-score / (num-trusting-ad-games)) 1]
ask turtles with [breed = controllers and who >= TTN]
[;3 o ask
die
];3 c ask
set resfileN word "resultsOfRegulation-CPD-" iteration
export-world resfileN
print "End of the simulation of the CPD"
print "Save &Clear the Command Center"
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; secondary setup procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-more-controllers-NPD
locals [strategies-list dice]
set strategies-list ["defect" "tit-for-tat" "suspicious-tft" "unforgiving" "trusting-ad"]
ask turtles with [breed = controllers]
[;3 o ask
hatch (1 + round (Ri * Si))
[;o atch
set shape "default"
set size 1
ifelse (Xi = -1)
[
set strategy "defect" ;;defect always
]
[
ifelse (Ei = 12)
[set strategy "cooperate"] ;;cooperate always
[
set dice random-int-or-float 5 ;; will give 0, 1, 2, 3 or 4
set strategy item dice strategies-list
]
]
]; c hatch
];3 c ask
end
to store-initial-turtle-counts-NPD
set num-cooperate count turtles with [breed = controllers and who >= TTN and strategy = "cooperate"]
set num-defect count turtles with [breed = controllers and who >= TTN and strategy = "defect"]
set num-unforgiving count turtles with [breed = controllers and who >= TTN and strategy = "unforgiving"]
set num-tit-for-tat count turtles with [breed = controllers and who >= TTN and strategy = "tit-for-tat"]
set num-suspicious-tft count turtles with [breed = controllers and who >= TTN and strategy = "suspicious-tft"]
set num-trusting-ad count turtles with [breed = controllers and who >= TTN and strategy = "trusting-ad"]
type "num-cooperate positions (S1) : " print num-cooperate
type "num-defect positions (S2): " print num-defect
type "num-unforgiving positions (S3): " print num-unforgiving
type "num-tit-for-tat positions (S4): " print num-tit-for-tat
type "num-suspicious-tft (S5): " print num-suspicious-tft
type "num-trusting-ad (S6): " print num-trusting-ad
end
to setup-common-variables-NPD
ask turtles
[
set score 0
set defect-now? false
set partnered? false
set partner nobody
;rt random 360
;fd random (screen-edge-x + screen-edge-y)
]
ask turtles with [breed = controllers and who >= TTN]
[
rt random-int-or-float 360
fd random-int-or-float (screen-edge-x + screen-edge-y)
]
setup-history-lists ;;initialize PARTNER-HISTORY list in all turtles
end
;;initialize PARTNER-HISTORY list in all turtles
to setup-history-lists
locals [ default-history num-turtles ]
set num-turtles count turtles
set default-history [] ;;initialize the DEFAULT-HISTORY variable to be a list
;;create a list with NUM-TURTLE elements for storing partner histories
repeat num-turtles
[ set default-history (fput false default-history) ]
;;give each turtle a copy of this list for tracking partner histories
ask turtles ;with [breed = controllers]
[
set partner-history default-history
set cooperative-partners []
]
end
to reset-count-games
set num-cooperate-games 0
set cooperate-score 0
set num-cooperate-games 0
set num-defect-games 0
set defect-score 0
set num-defect-games 0
set num-unforgiving-games 0
set unforgiving-score 0
set num-unforgiving-games 0
set num-tit-for-tat-games 0
set tit-for-tat-score 0
set num-tit-for-tat-games 0
set num-suspicious-tft-games 0
set suspicious-tft-score 0
set num-suspicious-tft-games 0
set num-trusting-ad-games 0
set trusting-ad-score 0
set num-trusting-ad-games 0
end
to reset-phantoms
ask turtles with [who >= TTN][die]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; runtime procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-iNPD
locals [ partnered-turtles ]
without-interruption [ clear-last-round-NPD ]
set iteration iteration + 1
ask turtles with [breed = controllers and who >= TTN ]
[ partner-up-NPD ] ;;have turtles try to find a partner
set partnered-turtles turtles with [breed = controllers and who >= TTN and partnered? ]
ask partnered-turtles with [breed = controllers and who >= TTN]
[ select-action ] ;;all partnered turtles select action
ask partnered-turtles with [breed = controllers and who >= TTN]
[ play-a-round-NPD ]
do-bookkeeping-NPD
end
to clear-last-round-NPD
locals [ partnered-turtles ]
set partnered-turtles turtles with [breed = controllers and who >= TTN and partnered? ]
ask partnered-turtles with [breed = controllers and who >= TTN][ release-partners ]
end
;;release partner and turn around to leave
to release-partners
set partnered? false
set partner nobody
rt 180
;set label no-label
end
;;have turtles try to find a partner
;;This will be done using without-interruption.
;;This is so that other turtles can't act while one is trying to partner up.
;;Also, since other turtles that have already executed partner-up may have
;;caused the turtle executing partner-up to be partnered,
;;a check is needed to make sure the calling turtle isn't partnered.
to partner-up-NPD ;;turtle procedure
without-interruption
[ ;;we don't want other turtles acting
ifelse(not partnered?)
[ ;;make sure still not partnered
rt (random-int-or-float 90 - random-int-or-float 90) fd 1 ;;move around randomly
set partner random-one-of (turtles-at -1 0)
with [ breed = controllers and who >= TTN and not partnered? ]
if partner != nobody
[ ;;if successful grabbing a partner, partner up
set partnered? true
set (partnered?-of partner) true
;show partner
ask partner [ set partner myself ]
set heading 270 ;;face partner
set (heading-of partner) 90
]
]
[] ;;if partnered, don't do anything
]
end
;;choose an action based upon the strategy being played
to select-action ;;turtle procedure
if strategy = "cooperate" [ cooperate ]
if strategy = "defect" [ defect ]
if strategy = "tit-for-tat" [ tit-for-tat ]
if strategy = "unforgiving" [ unforgiving ]
if strategy = "suspicious-tft" [ suspicious-tft ]
if strategy = "trusting-ad" [ trusting-ad ]
end
to play-a-round-NPD ;;turtle procedure
get-payoff-NPD ;;calculate the payoff for this round
update-history ;;store the results for next time
end
;;calculate the payoff for this round and
;;display a label with that payoff.
to get-payoff-NPD
set partner-defected? defect-now?-of partner
ifelse partner-defected?
[
ifelse defect-now?
[
set score (score + 1)
set label 1 ;;P
]
[
set score (score + 0)
set label 0 ;;S
]
]
[
ifelse defect-now?
[
set score (score + 5 + (Si * Ri / 4))
set label 5 ;;T
]
[
set score (score + 3 + (0.5 * ((Si * Ri / 4) + (Si-of partner * Ri-of partner / 4))))
set label 3 ;;R
]
]
end
;;update PARTNER-HISTORY based upon the strategy being played
to update-history
if strategy = "cooperate" [ cooperate-history-update ]
if strategy = "defect" [ defect-history-update ]
if strategy = "tit-for-tat" [ tit-for-tat-history-update ]
if strategy = "unforgiving" [ unforgiving-history-update ]
if strategy = "suspicious-tft" [ suspicious-tft-history-update ]
if strategy = "trusting-ad" [ trusting-ad-history-update ]
end
;;;;;;;;;;;;;;;;
;;;Strategies;;;
;;;;;;;;;;;;;;;;
;;All the strategies are described in the Information Tab.
to cooperate
set num-cooperate-games num-cooperate-games + 1
set defect-now? false
set cooperative-partners (fput partner cooperative-partners)
end
to cooperate-history-update
;;uses no history- this is just for similarity with the other strategies
end
to defect
set num-defect-games num-defect-games + 1
set defect-now? true
end
to defect-history-update
;;uses no history- this is just for similarity with the other strategies
end
to trusting-ad
set num-trusting-ad-games num-trusting-ad-games + 1
ifelse (member? partner cooperative-partners)
[set defect-now? true]
[
set defect-now? false
set cooperative-partners (fput partner cooperative-partners)
]
end
to trusting-ad-history-update
set partner-history
(replace-item (who-of partner) partner-history partner-defected?)
end
to tit-for-tat
set num-tit-for-tat-games num-tit-for-tat-games + 1
set partner-defected? item (who-of partner) partner-history
ifelse (partner-defected?)
[set defect-now? true]
[
set defect-now? false
set cooperative-partners (fput partner cooperative-partners)
]
end
to tit-for-tat-history-update
set partner-history
(replace-item (who-of partner) partner-history partner-defected?)
end
to suspicious-tft
set num-suspicious-tft-games num-suspicious-tft-games + 1
set partner-defected? item (who-of partner) partner-history
ifelse (partner-defected?)
[set defect-now? true ]
[
ifelse (Xi = 1) ;Ei-of partner = 12)
[
set defect-now? false
set cooperative-partners (fput partner cooperative-partners)
]
[set defect-now? true ]
]
end
to suspicious-tft-history-update
set partner-history
(replace-item (who-of partner) partner-history partner-defected?)
end
to unforgiving
set num-unforgiving-games num-unforgiving-games + 1
set partner-defected? item (who-of partner) partner-history
ifelse (partner-defected? or defect-now?)
[set defect-now? true ]
[
set defect-now? false
set cooperative-partners (fput partner cooperative-partners)
]
end
to unforgiving-history-update
if partner-defected? [
set partner-history
(replace-item (who-of partner) partner-history partner-defected?)
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Plotting Procedures;;;
;;;;;;;;;;;;;;;;;;;;;;;;;
;;procedure called by go that calculates scores and plots
to do-bookkeeping-NPD
do-scoring
set-current-plot "Controllers Behaviours"
do-plotting-behaviours
end
to do-bookkeeping-BCG
do-scoring
set-current-plot "Businesses Behaviours"
do-plotting-behaviours
end
to do-bookkeeping-GCG
do-scoring
set-current-plot "Gatekeepers Behaviours"
do-plotting-behaviours
end
;;calculate the total scores of each strategy
to do-scoring
set cooperate-score (calc-score "cooperate" num-cooperate)
set defect-score (calc-score "defect" num-defect)
set tit-for-tat-score (calc-score "tit-for-tat" num-tit-for-tat)
set unforgiving-score (calc-score "unforgiving" num-unforgiving)
set suspicious-tft-score (calc-score "suspicious-tft" num-suspicious-tft)
set trusting-ad-score (calc-score "trusting-ad" num-trusting-ad)
end
;; returns the total score for a strategy if any turtles exist that are playing it
to-report calc-score [strategy-type num-with-strategy]
ifelse num-with-strategy > 0 [
report (sum values-from (turtles with [ strategy = strategy-type ]) [ score ])
] [
report 0
]
end
;;if a strategy has had any interactions, plot the avereage score per interaction
to do-plotting-behaviours
;set-current-plot "Controllers Behaviours"
if num-defect-games > 0 [
set-current-plot-pen "defect"
plot defect-score / (num-defect-games)
]
if num-cooperate-games > 0 [
set-current-plot-pen "cooperate"
plot cooperate-score / (num-cooperate-games)
]
if num-tit-for-tat-games > 0 [
set-current-plot-pen "tit-for-tat"
plot tit-for-tat-score / (num-tit-for-tat-games)
]
if num-unforgiving-games > 0 [
set-current-plot-pen "unforgiving"
plot unforgiving-score / (num-unforgiving-games)
]
if num-suspicious-tft-games > 0 [
set-current-plot-pen "suspicious-tft"
plot suspicious-tft-score / (num-suspicious-tft-games)
]
if num-trusting-ad-games > 0 [
set-current-plot-pen "trusting-ad"
plot trusting-ad-score / (num-trusting-ad-games)
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; EVOLUTIONARY BUSINESS CHICKEN GAME
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-evolutionary-businesses-CG
;; secondary setup procedures
set iteration 0
set-current-plot "Businesses Behaviours"
clear-plot
reset-count-games
reset-phantoms
setup-more-businesses-BCG
store-initial-turtle-counts-of-BCG
setup-common-variables-of-BCG
do-bookkeeping-BCG
;; runtime procedures
while [iteration < 500] ;(100 * Iterations)] ; true
[
do-iBCG
]
if num-cooperate-games > 0 [type "average payoff of cooperation (S1): " print precision (cooperate-score / (num-cooperate-games)) 1]
if num-defect-games > 0 [type "average payoff of defection (S2): " print precision (defect-score / (num-defect-games)) 1]
if num-unforgiving-games > 0 [type "average payoff of unforgiving (S3): " print precision (unforgiving-score / (num-unforgiving-games)) 1]
if num-tit-for-tat-games > 0 [type "average payoff of tit-for-tat (S4): " print precision (tit-for-tat-score / (num-tit-for-tat-games)) 1]
if num-suspicious-tft-games > 0 [type "average payoff of suspicious-tft (S5): " print precision (suspicious-tft-score / (num-suspicious-tft-games)) 1]
if num-trusting-ad-games > 0 [type "average payoff of trusting-ad (S6): " print precision (trusting-ad-score / (num-trusting-ad-games)) 1]
ask turtles with [(breed = businesses) and who >= TTN]
[;3 o ask
die
];3 c ask
set resfileN word "resultsOfRegulation-CPD-" iteration
export-world resfileN
print "End of the simulation of the BCG"
print "Save &Clear the Command Center"
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; secondary setup procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-more-businesses-BCG
locals [strategies-list dice]
set strategies-list ["defect" "tit-for-tat" "suspicious-tft" "unforgiving" "trusting-ad"]
ask turtles with [breed = businesses]
[;3 o ask
hatch (1 + round (Ri * Si))
[;o atch
set shape "default"
set size 1
ifelse (Xi = -1)
[
set strategy "defect" ;;defect always
]
[
ifelse (Ei = 12)
[set strategy "cooperate"] ;;cooperate always
[
set dice random-int-or-float 5 ;; will give 0, 1, 2, 3 or 4
set strategy item dice strategies-list
]
]
]; c hatch
];3 c ask
end
to store-initial-turtle-counts-of-BCG
set num-cooperate count turtles with [(breed = businesses) and who >= TTN and strategy = "cooperate"]
set num-defect count turtles with [(breed = businesses) and who >= TTN and strategy = "defect"]
set num-unforgiving count turtles with [(breed = businesses) and who >= TTN and strategy = "unforgiving"]
set num-tit-for-tat count turtles with [(breed = businesses) and who >= TTN and strategy = "tit-for-tat"]
set num-suspicious-tft count turtles with [(breed = businesses) and who >= TTN and strategy = "suspicious-tft"]
set num-trusting-ad count turtles with [(breed = businesses) and who >= TTN and strategy = "trusting-ad"]
type "num-cooperate positions (S1) : " print num-cooperate
type "num-defect positions (S2): " print num-defect
type "num-unforgiving positions (S3): " print num-unforgiving
type "num-tit-for-tat positions (S4): " print num-tit-for-tat
type "num-suspicious-tft (S5): " print num-suspicious-tft
type "num-trusting-ad (S6): " print num-trusting-ad
end
to setup-common-variables-of-BCG
ask turtles
[
set score 0
set defect-now? false
set partnered? false
set partner nobody
;rt random 360
;fd random (screen-edge-x + screen-edge-y)
]
ask turtles with [(breed = businesses) and who >= TTN]
[
rt random-int-or-float 360
fd random-int-or-float (screen-edge-x + screen-edge-y)
]
setup-history-lists ;;initialize PARTNER-HISTORY list in all turtles
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; runtime procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-iBCG
locals [ partnered-turtles ]
without-interruption [ clear-last-round-BCG ]
set iteration iteration + 1
ask turtles with [(breed = businesses) and who >= TTN ]
[ partner-up-BCG ] ;;have turtles try to find a partner
set partnered-turtles turtles with [(breed = businesses) and who >= TTN and partnered? ]
ask partnered-turtles with [(breed = businesses) and who >= TTN]
[ select-action ] ;;all partnered turtles select action
ask partnered-turtles with [(breed = businesses) and who >= TTN]
[ play-a-round-CG ]
do-bookkeeping-BCG
end
to clear-last-round-BCG
locals [ partnered-turtles ]
set partnered-turtles turtles with [(breed = businesses) and who >= TTN and partnered? ]
ask partnered-turtles with [(breed = businesses) and who >= TTN][ release-partners ]
end
;;have turtles try to find a partner
;;This will be done using without-interruption.
;;This is so that other turtles can't act while one is trying to partner up.
;;Also, since other turtles that have already executed partner-up may have
;;caused the turtle executing partner-up to be partnered,
;;a check is needed to make sure the calling turtle isn't partnered.
to partner-up-BCG ;;turtle procedure
without-interruption
[ ;;we don't want other turtles acting
ifelse(not partnered?)
[ ;;make sure still not partnered
rt (random-int-or-float 90 - random-int-or-float 90) fd 1 ;;move around randomly
set partner random-one-of (turtles-at -1 0)
with [ (breed = businesses) and who >= TTN and not partnered? ]
if partner != nobody
[ ;;if successful grabbing a partner, partner up
set partnered? true
set (partnered?-of partner) true
;show partner
ask partner [ set partner myself ]
set heading 270 ;;face partner
set (heading-of partner) 90
]
]
[] ;;if partnered, don't do anything
]
end
to play-a-round-CG ;;turtle procedure
get-payoff-CG ;;calculate the payoff for this round
update-history ;;store the results for next time
end
;;calculate the payoff for this round and
;;display a label with that payoff.
to get-payoff-CG
set partner-defected? defect-now?-of partner
ifelse partner-defected?
[
ifelse defect-now?
[
set score (score - 1)
set label -1 ;;P
]
[
set score (score + 2)
set label 2 ;;S
]
]
[
ifelse defect-now?
[
set score (score + 4 + (Si * Ri / 4))
set label 4 ;;T
]
[
set score (score + 3 + (0.5 * ((Si * Ri / 4) + (Si-of partner * Ri-of partner / 4))))
set label 3 ;;R
]
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; EVOLUTIONARY GATEKEEPERS CHICKEN GAME
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-evolutionary-gatekeepers-CG
;; secondary setup procedures
set iteration 0
set-current-plot "Gatekeepers Behaviours"
clear-plot
reset-count-games
reset-phantoms
setup-more-gatekeepers-GCG
store-initial-turtle-counts-of-GCG
setup-common-variables-of-GCG
do-bookkeeping-GCG
;; runtime procedures
while [iteration < 500] ;(100 * Iterations)] ; true
[
do-iGCG
]
if num-cooperate-games > 0 [type "average payoff of cooperation (S1): " print precision (cooperate-score / (num-cooperate-games)) 1]
if num-defect-games > 0 [type "average payoff of defection (S2): " print precision (defect-score / (num-defect-games)) 1]
if num-unforgiving-games > 0 [type "average payoff of unforgiving (S3): " print precision (unforgiving-score / (num-unforgiving-games)) 1]
if num-tit-for-tat-games > 0 [type "average payoff of tit-for-tat (S4): " print precision (tit-for-tat-score / (num-tit-for-tat-games)) 1]
if num-suspicious-tft-games > 0 [type "average payoff of suspicious-tft (S5): " print precision (suspicious-tft-score / (num-suspicious-tft-games)) 1]
if num-trusting-ad-games > 0 [type "average payoff of trusting-ad (S6): " print precision (trusting-ad-score / (num-trusting-ad-games)) 1]
ask turtles with [(breed = gatekeepers) and who >= TTN]
[;3 o ask
die
];3 c ask
set resfileN word "resultsOfRegulation-GCG" iteration
export-world resfileN
print "End of the simulation of the GCG"
print "Save &Clear the Command Center"
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; secondary setup procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup-more-gatekeepers-GCG
locals [strategies-list dice]
set strategies-list ["defect" "tit-for-tat" "suspicious-tft" "unforgiving" "trusting-ad"]
ask turtles with [breed = gatekeepers]
[;3 o ask
hatch (1 + round (Ri * Si))
[;o atch
set shape "default"
set size 1
ifelse (Xi = -1)
[
set strategy "defect" ;;defect always
]
[
ifelse (Ei = 12)
[set strategy "cooperate"] ;;cooperate always
[
set dice random-int-or-float 5 ;; will give 0, 1, 2, 3 or 4
set strategy item dice strategies-list
]
]
]; c hatch
];3 c ask
end
to store-initial-turtle-counts-of-GCG
set num-cooperate count turtles with [(breed = gatekeepers) and who >= TTN and strategy = "cooperate"]
set num-defect count turtles with [(breed = gatekeepers) and who >= TTN and strategy = "defect"]
set num-unforgiving count turtles with [(breed = gatekeepers) and who >= TTN and strategy = "unforgiving"]
set num-tit-for-tat count turtles with [(breed = gatekeepers) and who >= TTN and strategy = "tit-for-tat"]
set num-suspicious-tft count turtles with [(breed = gatekeepers) and who >= TTN and strategy = "suspicious-tft"]
set num-trusting-ad count turtles with [(breed = gatekeepers) and who >= TTN and strategy = "trusting-ad"]
type "num-cooperate positions (S1) : " print num-cooperate
type "num-defect positions (S2): " print num-defect
type "num-unforgiving positions (S3): " print num-unforgiving
type "num-tit-for-tat positions (S4): " print num-tit-for-tat
type "num-suspicious-tft (S5): " print num-suspicious-tft
type "num-trusting-ad (S6): " print num-trusting-ad
end
to setup-common-variables-of-GCG
ask turtles
[
set score 0
set defect-now? false
set partnered? false
set partner nobody
;rt random 360
;fd random (screen-edge-x + screen-edge-y)
]
ask turtles with [(breed = gatekeepers) and who >= TTN]
[
rt random-int-or-float 360
fd random-int-or-float (screen-edge-x + screen-edge-y)
]
setup-history-lists ;;initialize PARTNER-HISTORY list in all turtles
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; runtime procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to do-iGCG
locals [ partnered-turtles ]
without-interruption [ clear-last-round-GCG ]
set iteration iteration + 1
ask turtles with [(breed = gatekeepers) and who >= TTN ]
[ partner-up-GCG ] ;;have turtles try to find a partner
set partnered-turtles turtles with [(breed = gatekeepers) and who >= TTN and partnered? ]
ask partnered-turtles with [(breed = gatekeepers) and who >= TTN]
[ select-action ] ;;all partnered turtles select action
ask partnered-turtles with [(breed = gatekeepers) and who >= TTN]
[ play-a-round-CG ]
do-bookkeeping-GCG
end
to clear-last-round-GCG
locals [ partnered-turtles ]
set partnered-turtles turtles with [(breed = gatekeepers) and who >= TTN and partnered? ]
ask partnered-turtles with [(breed = gatekeepers) and who >= TTN][ release-partners ]
end
;;have turtles try to find a partner
;;This will be done using without-interruption.
;;This is so that other turtles can't act while one is trying to partner up.
;;Also, since other turtles that have already executed partner-up may have
;;caused the turtle executing partner-up to be partnered,
;;a check is needed to make sure the calling turtle isn't partnered.
to partner-up-GCG ;;turtle procedure
without-interruption
[ ;;we don't want other turtles acting
ifelse(not partnered?)
[ ;;make sure still not partnered
rt (random-int-or-float 90 - random-int-or-float 90) fd 1 ;;move around randomly
set partner random-one-of (turtles-at -1 0)
with [ (breed = gatekeepers) and who >= TTN and not partnered? ]
if partner != nobody
[ ;;if successful grabbing a partner, partner up
set partnered? true
set (partnered?-of partner) true
;show partner
ask partner [ set partner myself ]
set heading 270 ;;face partner
set (heading-of partner) 90
]
]
[] ;;if partnered, don't do anything
]
end
;;;;;;;;;;;;;;;;;;;;;;;;
;; Plotting Functions ;;
;;;;;;;;;;;;;;;;;;;;;;;;
to do-plotting-positions
set-current-plot "Positions"
set-current-plot-pen "BusinessesFor"
plot BusinessesFor
set-current-plot-pen "BusinessesAgainst"
plot BusinessesAgainst
set-current-plot-pen "CommunitiesFor"
plot CommunitiesFor
set-current-plot-pen "CommunitiesAgainst"
plot CommunitiesAgainst
end
to do-plotting-cooperations2
set-current-plot "Controllers Behaviours"
set-current-plot-pen "cooperate"
plot CoopControllers
set-current-plot "Businesses Behaviours"
set-current-plot-pen "cooperate"
plot CoopBusinesses
set-current-plot "Gatekeepers Behaviours"
set-current-plot-pen "cooperate"
plot CoopGatekeepers
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Calculation Functions ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;to-report impact [otherTurtle] ;; turtle procedure
; ;; report the impact of otherTurtle on myself
; locals [d]
; set d distance otherTurtle
; if (d = 0) [set d 1 ] ; 1 = self-distance
; ;; (exp ((ln d) * exponent)) calculates d to the power 'exponent'
; report square strength / (exp ((ln d) * 2)) ; 2 = exponent
;end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; *** Regulation Model Copyright Notice ***
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This model was created as part of the SPRITE project
; These projects gratefully acknowledge the support of the
; European Union -- grant numbers
; ...
;
; Copyright 2003 by Jean-Paul Bousset. All rights reserved.
;
; Permission to use, modify or redistribute this model is hereby granted,
; provided that both of the following requirements are followed:
; a) this copyright notice is included.
; b) this model will not be redistributed for profit without permission
; from the copyright holders.
; Contact the copyright holders for appropriate licenses for redistribution
; for profit.
;
; To refer to this model in academic publications, please use:
; Bousset, J-P. (2003). Negotiation model, SPRITE project,
; Cemagref, 24 av. des Landais,
; 63200 Aubiere, France.
;
; *** End of SPRITE Regulation Model Copyright Notice ***
@#$#@#$#@
GRAPHICS-WINDOW
463
10
969
537
15
15
16.0
1
10
1
1
1
0
1
1
1
CC-WINDOW
5
799
1222
894
Command Center
0
BUTTON
973
12
1113
47
run N-iterated games
do-games
NIL
1
T
OBSERVER
T
NIL
BUTTON
4
10
64
44
setup
setup
NIL
1
T
OBSERVER
T
NIL
CHOOSER
3
118
178
163
UnderUsedResources
UnderUsedResources
"natural&cultural" "natural" "cultural"
0
SLIDER
5
82
179
115
ResourcesDensity
ResourcesDensity
1
2
1.0
0.1
1
NIL
CHOOSER
180
119
464
164
CollectiveObjective
CollectiveObjective
"more provision of resources" "more quality of resources" "more supply of tourism products & services" "more promotion of place and products" "all together"
4
PLOT
972
49
1211
213
Controllers Behaviours
Iteration
PayOff
0.0
10.0
0.0
5.0
true
true
PENS
"cooperate" 1.0 0 -10899396 true
"defect" 1.0 0 -13345367 true
"tit-for-tat" 1.0 0 -2674135 true
"unforgiving" 1.0 0 -11221820 true
"suspicious-tft" 1.0 0 -16777216 true
"trusting-ad" 1.0 2 -8630108 true
SLIDER
348
83
461
116
Iterations
Iterations
1
20
10
1
1
NIL
PLOT
972
214
1211
377
Businesses Behaviours
Iteration
PayOff
0.0
10.0
0.0
5.0
true
true
PENS
"cooperate" 1.0 0 -10899396 true
"defect" 1.0 0 -13345367 true
"tit-for-tat" 1.0 0 -2674135 true
"unforgiving" 1.0 0 -11221820 true
"suspicious-tft" 1.0 0 -16777216 true
"trusting-ad" 1.0 2 -8630108 true
PLOT
972
378
1211
542
Gatekeepers Behaviours
Iteration
PayOff
0.0
10.0
0.0
5.0
true
true
PENS
"cooperate" 1.0 0 -10899396 true
"defect" 1.0 0 -13345367 true
"tit-for-tat" 1.0 0 -2674135 true
"unforgiving" 1.0 0 -11221820 true
"suspicious-tft" 1.0 0 -16777216 true
"trusting-ad" 1.0 2 -8630108 true
PLOT
1
166
246
333
Provisioned Resources
Iteration
Patches
0.0
10.0
0.0
100.0
true
true
PENS
"Natural" 1.0 0 -10899396 true
"Cultural" 1.0 0 -8630108 true
"Social" 1.0 0 -11221820 true
"Economic" 1.0 0 -2674135 true
PLOT
2
333
245
495
Used Resources
Iteration
Patches
0.0
10.0
0.0
100.0
true
true
PENS
"Natural" 1.0 0 -10899396 true
"Cultural" 1.0 0 -8630108 true
"Social" 1.0 0 -11221820 true
"Economic" 1.0 0 -2674135 true
PLOT
4
495
244
658
Promoted Resources
Iteration
Patches
0.0
10.0
0.0
100.0
true
true
PENS
"Natural" 1.0 0 -10899396 true
"Cultural" 1.0 0 -8630108 true
"Social" 1.0 0 -11221820 true
"Economic" 1.0 0 -2674135 true
PLOT
4
659
243
783
Visited Resources
Iteration
Patches
0.0
10.0
0.0
100.0
true
true
PENS
"Natural" 1.0 0 -10899396 true
"Cultural" 1.0 0 -8630108 true
"Social" 1.0 0 -11221820 true
"Economic" 1.0 0 -2674135 true
PLOT
245
660
465
783
Tourists Density
Iteration
Visists
0.0
10.0
0.0
1.0
true
true
PENS
"Natural" 1.0 0 -10899396 true
"Cultural" 1.0 0 -8630108 true
"Social" 1.0 0 -11221820 true
"Economic" 1.0 0 -2674135 true
BUTTON
67
10
256
44
simulate market-like evolution
build-no-regulated-scenarios
NIL
1
T
OBSERVER
T
NIL
SLIDER
4
47
179
80
ResourcesThreshold
ResourcesThreshold
0.1
0.9
0.5
0.1
1
NIL
SLIDER
348
47
462
80
NewTourists
NewTourists
10
50
20
10
1
NIL
BUTTON
257
10
462
44
simulate regulation
build-topdown-regulated-scenarios
NIL
1
T
OBSERVER
T
NIL
PLOT
465
660
670
784
Tourists
Iteration
Tourists
0.0
10.0
0.0
10.0
true
true
PENS
"Unsatisf" 1.0 0 -10899396 true
PLOT
245
332
465
495
Businesses Interactions
Iteration
Interaction
0.0
10.0
0.0
10.0
true
true
PENS
"conflict-G" 1.0 0 -2674135 true
"conflict-B" 1.0 0 -6459832 true
"conflict-R" 1.0 0 -16777216 true
"cooperate-R" 1.0 0 -10899396 true
"cooperate-B" 1.0 0 -13791810 true
"cooperate-G" 1.0 0 -8630108 true
PLOT
244
165
464
333
Controllers Interactions
Iteration
Interaction
0.0
10.0
0.0
10.0
true
true
PENS
"conflict-G" 1.0 0 -2674135 true
"conflict-B" 1.0 0 -6459832 true
"conflict-R" 1.0 0 -16777216 true
"cooperate-R" 1.0 0 -10899396 true
"cooperate-B" 1.0 0 -13791810 true
"cooperate-G" 1.0 0 -8630108 true
PLOT
245
495
465
660
Gatekeepers Interactions
Iteration
Interaction
0.0
10.0
0.0
10.0
true
true
PENS
"conflict-R" 1.0 0 -2674135 true
"conflict-B" 1.0 0 -6459832 true
"conflict-G" 1.0 0 -16777216 true
"cooperate-R" 1.0 0 -10899396 true
"cooperate-B" 1.0 0 -13791810 true
"cooperate-G" 1.0 0 -8630108 true
SLIDER
182
48
346
81
TouristsDensityEvolution
TouristsDensityEvolution
1
3
2.0
0.1
1
NIL
PLOT
969
545
1212
665
Scale (Lorenz Curve)
Actors %
Energy %
0.0
100.0
0.0
100.0
false
true
PENS
"gatekeepers" 1.0 0 -13791810 true
"controllers" 1.0 0 -16777216 true
"businesses" 1.0 0 -2674135 true
PLOT
970
665
1213
785
Scale (Gini Index)
Iteration
Gini
0.0
10.0
0.0
1.0
true
true
PENS
"gatekeepers" 1.0 0 -13791810 true
"controllers" 1.0 0 -16777216 true
"businesses" 1.0 0 -2674135 true
PLOT
465
539
670
661
Communities
Iteration
Communities
0.0
10.0
0.0
10.0
true
true
PENS
"Conflict" 1.0 0 -2674135 true
"Ccon" 1.0 0 -16777216 true
"Cfor" 1.0 0 -10899396 true
"Cneu" 1.0 0 -13345367 true
SWITCH
182
83
347
116
BottomUpRegulation?
BottomUpRegulation?
0
1
-1000
@#$#@#$#@
bzzzz
@#$#@#$#@
default
true
0
Polygon -7500403 true true 150 5 40 250 150 205 260 250
boy-shape
false
0
Circle -7500403 true true 107 15 84
Line -7500403 true 150 75 150 224
Line -7500403 true 150 150 74 135
Line -7500403 true 150 149 224 135
Line -7500403 true 150 224 195 284
Line -7500403 true 150 226 105 284
circle
true
0
Circle -7500403 true true 35 35 230
cow
false
0
Polygon -7500403 true true 57 141 134 122 209 122 245 140 228 170 168 190 106 186 62 179 49 166
Polygon -7500403 true true 71 178 53 266 68 271 82 176
Polygon -7500403 true true 76 194 81 267 96 265 85 178
Polygon -7500403 true true 196 177 178 262 193 262 208 170
Polygon -7500403 true true 204 183 212 257 227 254 213 166
Polygon -7500403 true true 231 134 243 111 214 100 202 123
Polygon -7500403 true true 213 100 274 123 285 97 260 84 252 65 232 56 212 56 205 68 207 92 225 101
Polygon -7500403 true true 56 139 30 188 51 161
line
true
0
Line -7500403 true 150 0 150 301
organisation-shape
false
14
Line -11221820 false 14 17 285 17
Line -11221820 false 13 16 13 286
Line -11221820 false 12 286 284 286
Line -11221820 false 284 17 284 287
person
false
0
Circle -7500403 true true 155 20 63
Rectangle -7500403 true true 158 79 217 164
Polygon -7500403 true true 158 81 110 129 131 143 158 109 165 110
Polygon -7500403 true true 216 83 267 123 248 143 215 107
Polygon -7500403 true true 167 163 145 234 183 234 183 163
Polygon -7500403 true true 195 163 195 233 227 233 206 159
@#$#@#$#@
NetLogo 3.0beta3
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@