-
Notifications
You must be signed in to change notification settings - Fork 0
/
PondTrade_step08_adding feedback loops 1.nlogo
1363 lines (1133 loc) · 31.6 KB
/
PondTrade_step08_adding feedback loops 1.nlogo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; GNU GENERAL PUBLIC LICENSE ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The PondTrade model
;; Copyright (C) 2018 Andreas Angourakis (andros.spica@gmail.com)
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;;;;;;;;;;;;;;;;
;;; BREEDS ;;;;;;
;;;;;;;;;;;;;;;;;
breed [ settlements settlement ]
breed [ ships ship ]
;;;;;;;;;;;;;;;;;
;;; VARIABLES ;;;
;;;;;;;;;;;;;;;;;
globals [ routes ]
settlements-own [ sizeLevel ]
ships-own [ base route destination direction lastPosition cargoValue ]
patches-own
[
isLand
pathCost
;;; path-finding related
parent-patch ; patch's predecessor
f ; the value of knowledge plus heuristic cost function f()
g ; the value of knowledge cost function g()
h ; the value of heuristic cost function h()
]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; SETUP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup
clear-all
reset-ticks
create-map
create-coastal-settlements
set-routes
create-ships-per-settlement
update-display
end
to create-map
let centralPatch patch (min-pxcor + (floor world-width / 2)) (min-pycor + (floor world-height / 2))
let halfSmallerDimension (world-width / 2)
if (world-width > world-height) [ set halfSmallerDimension (world-height / 2) ]
let minDistOfLandToCenter round ((pondSize / 100) * halfSmallerDimension)
ask patches
[
let coastThreshold minDistOfLandToCenter ; defaults to the basic value
;; add noise to coast line
; set general noise range depending on UI's coastalNoiseLevel and the size of world
let noiseRange (halfSmallerDimension * coastalNoiseLevel / 100)
; noiseType is specified with the chooser in the UI
if (noiseType = "uniform")
[
; adds a random amount from a uniform distribution with mean minDistOfLandToCenter
set noiseRange (random-float noiseRange) - (noiseRange / 2)
set coastThreshold minDistOfLandToCenter + noiseRange
]
if (noiseType = "normal")
[
; adds a random amount from a normal distribution with mean minDistOfLandToCenter
set coastThreshold random-normal minDistOfLandToCenter (halfSmallerDimension * coastalNoiseLevel / 100)
]
ifelse (distance centralPatch < coastThreshold)
[
set isLand false
]
[
set isLand true
]
]
smooth-coast-line
assign-path-cost
ask patches [ paint-terrain ]
end
to smooth-coast-line
; smooth coast line
repeat smoothIterations
[
ask patches
[
ifelse (isLand = false)
[
; water patch
; consider ratios instead of absolute numbers to avoid having isolated water bodies adjacent to the world limits (less than 8 neighbors)
if (count neighbors with [isLand = true] / count neighbors >= coastLineSmoothThreshold / 8)
[
; water patch has a certain number of land neighbors
set isLand true ; converted to land
]
]
[
; land patch
if (count neighbors with [isLand = false] / count neighbors >= coastLineSmoothThreshold / 8)
[
; land patch has a certain number of water neighbors
set isLand false ; converted to water
]
]
]
]
end
to assign-path-cost
ask patches
[
ifelse (isLand = false)
[ set pathCost 1 ] ; arbitrary unit for now
[ set pathCost relativePathCostInLand ] ; defined by parameter in relation to the cost of path in water (i.e., 1)
]
end
to paint-terrain ; ego = patch
ifelse (isLand = false)
[ set pcolor 106 ] ; blue for water
[ set pcolor 54 ] ; green for land
end
to create-coastal-settlements
; consider only coastal patches
let coastalPatches patches with [(isLand = true) and (any? neighbors with [isLand = false])]
repeat numberOfSettlements
[
; ask a random coastal patch without a settlement already
ask one-of coastalPatches with [not any? settlements-here]
[
sprout-settlements 1 ; creates one "turtle" of breed settlements
[
set sizeLevel 1 ; the size level is initiated at minimum (i.e., 1)
set shape "circle 2"
]
; replace the land path cost with the port pathCost
set pathCost relativePathCostInPort
; exclude this patch from the pool of coastal patches
set coastalPatches other coastalPatches
]
]
end
to create-ships-per-settlement
ask settlements
[
let thisSettlement self ; to avoid the confusion of nested agent queries
hatch-ships round sizeLevel ; use the sizeLevel variable as the number of ships based in the settlement
[
set base thisSettlement
; give meaningful display related to base
set shape "sailboat side" ; import this shape from the library (Tools > Shape editor > import from library)
set color [color] of base
set size 3
choose-destination
]
]
end
to set-routes
set routes [] ; initialize/reset the routes as an empty list
let settlementsWithoutRoutes settlements ; helper variable to keep track of which settlement already searched for routes
ask settlements
[
let thisSettlement self
ask other settlementsWithoutRoutes
[
let optimalRoute find-a-path ([patch-here] of thisSettlement) ([patch-here] of self) ; find the optimal route to this settlement
set routes lput optimalRoute routes ; add the optimal route to the end of the routes list
]
set settlementsWithoutRoutes other settlementsWithoutRoutes
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; CYCLE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to go
tick
update-ships
; the size of settlements decays with a constant rate, up to 1 (minimum)
ask settlements
[
set sizeLevel max (list 1 (sizeLevel * (1 - (settlementSizeDecayRate / 100)) ) )
]
update-display
end
to update-ships
let shipsInBase ships with [is-in-base]
let shipsInDestination ships with [is-in-destination]
; UPDATE LAST POSITION
ask ships
[
; update lastPosition if in a patch centre
if ((xcor = [pxcor] of patch-here) and (ycor = [pycor] of patch-here))
[
set lastPosition patch-here
]
]
; UNLOAD
ask (turtle-set shipsInBase shipsInDestination) with [cargoValue > 0]
[
; unload cargo (changes sizeLevel)
unload-cargo
; load cargo (changes stock)
load-cargo
]
; CHOOSE DESTINATION
ask shipsInBase
[
; update the destination whenever in the base settlement and there is cargo to transport
choose-destination
]
; FIND DIRECTION in route
ask (turtle-set shipsInBase shipsInDestination)
[
find-direction
]
; MOVE towards the next position in the route
ask ships
[
; move following the route when there is cargo to transport
move-to-destination
]
end
to choose-destination ; ego = ship
let thisShip self
; get routes connecting the base settlement
let routesFromBase get-routes-to-settlement [base] of thisShip
; order these routes by benefit/cost ratio
set routesFromBase sort-by [ [?1 ?2] -> benefit-cost-of-route ?1 > benefit-cost-of-route ?2 ] routesFromBase
; print the options available
; foreach routesFromBase
; [
; print "==============================================================="
; print "route between:"
; print [who] of get-origin-and-destination ?
; print "has the benefit-cost ratio of:"
; print benefit-cost-of-route ?
; ]
; print "-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x"
; select the one with higher benefit/cost ratio
set route first routesFromBase
; get the settlement of destination
set destination one-of (get-origin-and-destination route) with [who != [who] of ([base] of thisShip)]
end
to find-direction ; ego = ship
; find where in the route list is the ship
let currentPosition position lastPosition route
; set direction if in a settlement
ifelse (currentPosition = 0) ; in the first extreme of the route list
[
; move in the route list towards larger index numbers
set direction 1
]
[
if (currentPosition = (length route - 1)) ; in the last extreme of the route list
[
; move in the route list towards smaller index numbers
set direction -1
]
]
; else the ship is in route to either the base or the destination
end
to move-to-destination ; ego = ship
; find where in the route list is the ship
let currentPosition position lastPosition route
; move through the route following direction
let targetPatch item (currentPosition + direction) route
;move-to targetPatch ; constant travel time (1 patch per tick)
facexy ([pxcor] of targetPatch) ([pycor] of targetPatch)
forward min (
list
(1 / [pathCost] of patch-here) ; the maximum distance in a tick in the current patch
(distancexy ([pxcor] of targetPatch) ([pycor] of targetPatch)) ; the distance to the target patch
)
end
to-report is-in-base ; ego = ship
report (xcor = [xcor] of base) and (ycor = [ycor] of base) ; if the ship arrived at the centre of the base patch
end
to-report is-in-destination ; ego = ship
report (xcor = [xcor] of destination) and (ycor = [ycor] of destination) ; if the ship arrived at the centre of the destination patch
end
to unload-cargo ; ego = ship
let thisShip self
let settlementHere one-of settlements-here
; unload cargo
ask settlementHere [ add-trade-effect [cargoValue] of thisShip ]
end
to load-cargo ; ego = ship
let settlementHere one-of settlements-here
; load cargo
set cargoValue [sizeLevel] of settlementHere
end
to add-trade-effect [ value ] ; ego = settlement
set sizeLevel sizeLevel + value
end
to update-display
paint-routes
paint-active-routes
; scale the size of settlements according to their dynamic free-scaled sizeLevel
let maxSettlementSize max [sizeLevel] of settlements
ask settlements
[
set hidden? not showSettlements
set size 1 + (sizeLevel / maxSettlementSize) * 9
]
end
to paint-routes
; resets route patches to the terrain color
foreach routes
[ ?1 ->
let aRoute ?1
foreach aRoute
[ ??1 ->
ask ??1 [ paint-terrain ]
]
]
; paint route patches in shades of red depending on route frequency
foreach routes
[ ?1 ->
let aRoute ?1
foreach aRoute
[ ??1 ->
ask ??1
[
if (showRoutes)
[
ifelse (pcolor < 11 or pcolor > 19) ; if its the first route crossing the patch
[
set pcolor 11
]
[
set pcolor min (list (pcolor + 1) (19)) ; sets a maximum at 19 (the brightest)
]
]
]
]
]
end
to paint-active-routes
ask ships
[
foreach route
[ ?1 ->
ask ?1
[
ifelse (showActiveRoutes)
[
set pcolor yellow
]
[
if (not showRoutes) ; if not displaying all routes
[
; resets to the patch terrain color
paint-terrain
]
]
]
]
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Get and set routes (helper 'to-report' procedures) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to-report get-route [ settlement1 settlement2 ] ; accepts two settlements and returns a route
; get routes connecting settlement1
let routesFromSettlement1 filter
[ ?1 ->
([one-of settlements-here] of first ?1 = settlement1) or
([one-of settlements-here] of last ?1 = settlement1)
] routes
; get the route connecting settlement2 from the previous list
let routeFromSettlement1ToSettlement2 filter
[ ?1 ->
([one-of settlements-here] of first ?1 = settlement2) or
([one-of settlements-here] of last ?1 = settlement2)
] routesFromSettlement1
report first routeFromSettlement1ToSettlement2
end
to-report get-routes-to-settlement [ aSettlement ] ; accepts a settlement and return a list of routes
report filter
[ ?1 ->
([one-of settlements-here] of first ?1 = aSettlement) or
([one-of settlements-here] of last ?1 = aSettlement)
] routes
end
to-report get-origin-and-destination [ aRoute ] ; accepts a route and returns a turtle-set with two settlements
report (turtle-set ([ one-of settlements-here ] of first aRoute) ([one-of settlements-here ] of last aRoute))
end
to-report benefit-cost-of-route [ aRoute ] ; accepts a route and returns a number (the benefit/cost ratio of the route)
let cost 0
foreach aRoute ; for every patch in the given route
[ ?1 ->
set cost cost + [pathCost] of ?1
]
let originAndDestination get-origin-and-destination aRoute
let benefit 0
ask originAndDestination [ set benefit benefit + sizeLevel ] ; the benefit is the sum of the sizeLevel of the two settlements
report benefit / cost
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; A* path finding algorithm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; modified from Meghendra Singh's Astardemo1 model in NetLogo User Community Models
; http://ccl.northwestern.edu/netlogo/models/community/Astardemo1
; modified lines/fragments are marked with ";-------------------------------*"
; In this version, patches have different movement cost.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; the actual implementation of the A* path finding algorithm
; it takes the source and destination patches as inputs
; and reports the optimal path if one exists between them as output
to-report find-a-path [ source-patch destination-patch]
; initialize all variables to default values
let search-done? false
let search-path []
let current-patch 0
let open [] ;-------------------------------*
let closed [] ;-------------------------------*
;-------------------------------*
ask patches with [ f != 0 ]
[
set f 0
set h 0
set g 0
]
;-------------------------------*
; add source patch in the open list
set open lput source-patch open
; loop until we reach the destination or the open list becomes empty
while [ search-done? != true]
[
ifelse length open != 0
[
; sort the patches in open list in increasing order of their f() values
set open sort-by [ [?1 ?2] -> [f] of ?1 < [f] of ?2 ] open
; take the first patch in the open list
; as the current patch (which is currently being explored (n))
; and remove it from the open list
set current-patch item 0 open
set open remove-item 0 open
; add the current patch to the closed list
set closed lput current-patch closed
; explore the Von Neumann (left, right, top and bottom) neighbors of the current patch
ask current-patch
[
; if any of the neighbors is the destination stop the search process
ifelse any? neighbors4 with [ (pxcor = [ pxcor ] of destination-patch) and (pycor = [pycor] of destination-patch)] ;-------------------------------*
[
set search-done? true
]
[
; the neighbors should not already explored patches (part of the closed list)
ask neighbors4 with [ (not member? self closed) and (self != parent-patch) ] ;-------------------------------*
[
; the neighbors to be explored should also not be the source or
; destination patches or already a part of the open list (unexplored patches list)
if not member? self open and self != source-patch and self != destination-patch
[
;set pcolor 45 ;-------------------------------*
; add the eligible patch to the open list
set open lput self open
; update the path finding variables of the eligible patch
set parent-patch current-patch
set g [g] of parent-patch + pathCost ;-------------------------------*
set h distance destination-patch
set f (g + h)
]
]
]
; if self != source-patch ;-------------------------------*
; [
; set pcolor 35
; ]
]
]
[
; if a path is not found (search is incomplete) and the open list is exhausted
; display a user message and report an empty search path list.
user-message( "A path from the source to the destination does not exist." )
report []
]
]
; if a path is found (search completed) add the current patch
; (node adjacent to the destination) to the search path.
set search-path lput current-patch search-path
; trace the search path from the current patch
; all the way to the source patch using the parent patch
; variable which was set during the search for every patch that was explored
let temp first search-path
while [ temp != source-patch ]
[
; ask temp ;-------------------------------*
; [
; set pcolor 85
; ]
set search-path lput [parent-patch] of temp search-path
set temp [parent-patch] of temp
]
; add the destination patch to the front of the search path
set search-path fput destination-patch search-path
; reverse the search path so that it starts from a patch adjacent to the
; source patch and ends at the destination patch
set search-path reverse search-path
; report the search path
report search-path
end
@#$#@#$#@
GRAPHICS-WINDOW
292
16
805
530
-1
-1
5.0
1
10
1
1
1
0
0
0
1
-50
50
-50
50
0
0
1
ticks
30.0
SLIDER
13
322
248
355
pondSize
pondSize
0
100
75.0
1
1
% of smallest dimension
HORIZONTAL
SLIDER
14
422
254
455
coastalNoiseLevel
coastalNoiseLevel
0
100
20.0
1
1
% of minDistToCentre
HORIZONTAL
SLIDER
15
467
281
500
coastLineSmoothThreshold
coastLineSmoothThreshold
0
8
5.0
1
1
of 8 neighbors
HORIZONTAL
CHOOSER
13
366
151
411
noiseType
noiseType
"no noise" "uniform" "normal"
2
SLIDER
17
511
189
544
smoothIterations
smoothIterations
0
20
3.0
1
1
NIL
HORIZONTAL
SLIDER
63
57
235
90
numberOfSettlements
numberOfSettlements
0
50
6.0
1
1
NIL
HORIZONTAL
BUTTON
11
15
78
48
Set up
setup
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
SWITCH
14
223
144
256
showSettlements
showSettlements
0
1
-1000
BUTTON
157
211
251
244
Update display
update-display
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
TEXTBOX
18
293
168
311
Map parameters
14
0.0
1
SLIDER
9
91
286
124
relativePathCostInLand
relativePathCostInLand
0
100
50.0
0.01
1
X path cost in water
HORIZONTAL
BUTTON
96
16
159
49
Go
go
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
180
16
243
49
Go
go
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
TEXTBOX
820
16
1295
84
The 'setup' procedure may take a while, depending on the number of settlements. The simulation step is still quite fast.
14
0.0
1
TEXTBOX
16
201
166
219
Display options
14
0.0
1
SWITCH
14
256
121
289
showRoutes
showRoutes
1
1
-1000
SLIDER
9
157
287
190
settlementSizeDecayRate
settlementSizeDecayRate
0
25
5.0
0.01
1
% of sizeLevel
HORIZONTAL
SWITCH
121
256
261
289
showActiveRoutes
showActiveRoutes
0
1
-1000
PLOT
826
153
1297
273
Settlement size distribution
NIL
NIL
0.0
10.0
0.0
10.0
true
false
"carefully [set-plot-x-range -1 ((max [sizeLevel] of settlements) + 1)] [ set-plot-x-range 0 1 ]\nset-histogram-num-bars 20" "carefully [set-plot-x-range -1 ((max [sizeLevel] of settlements) + 1)] [ set-plot-x-range 0 1 ]\nset-histogram-num-bars 20"
PENS
"default" 1.0 1 -16777216 true "histogram [sizeLevel] of settlements" "histogram [sizeLevel] of settlements"
PLOT
828
274
1298
483
Settlement centrality change
NIL
NIL
0.0
10.0
0.0
10.0
true
false
"" ""
PENS
"default" 1.0 2 -16777216 true "" "let hub max-one-of settlements [sizeLevel]\ncarefully [ set-plot-pen-color [color] of hub ] []\ncarefully [ plot [who] of hub] [ plot 0 ]"
SLIDER
9
124
286
157
relativePathCostInPort
relativePathCostInPort
0
100
10.0
0.01
1
X path cost in water
HORIZONTAL
@#$#@#$#@
## WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
## HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
## HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
## THINGS TO NOTICE