-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.nls
More file actions
906 lines (781 loc) · 30.7 KB
/
Copy pathsetup.nls
File metadata and controls
906 lines (781 loc) · 30.7 KB
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
; the setup procedures for
; 1. the hidden variables (not set in the interface)
; 2. building the argumentative landscape with
; attacks and discovery relations
; 3. populate the landscape with researchers
; Procedure in which the variables that are not mentioned in the interface can
; be set.
; 1. This determines amount of information learned via
; intergroup-communication (share-with-other-networks)that a researcher can
; digest each tick. To learn one argument which was unknown before (= cyan =
; 85) all the way to the highest degree of exploration (= red = 15) costs 70.
; By default an attack relation costs as much as one color step of an argument
; (`rel-costfactor` = 10) and researchers can digest two full arguments per
; day (`max-learn`).
; 2. only every 5 ticks (= days) researchers move with full move-probability
; during the _move-around_ procedure. In between the move-probability is lower
; by the factor `small-movement` i.e. by default they move only with 1/5 th of
; the move probability on the days in between.
; 3. During the _move-around_ procedure the move probability is influenced by
; the color of the argument a researcher is standing on (`color-move`). The
; further researched an argument is (= lower color) the higher the
; move-probability is. Researchers move if
; `move-random < move-probability * (1 - ([color] of myargu / color-move))`
; where `move-random` is a random float on the interval [0,1] and myargu is the
; argument the researcher is currently standing/working on.
to initialize-hidden-variables
; cf. 1.
set rel-costfactor 10
set max-learn (70 * 2)
; the probability that researchers move every round is
; only small-movement * move-probability (cf. 2.)
set small-movement 0.2
; influence color on move probability (cf. 3.)
set color-move 200
; the maximal time a run can last before it is aborted
set g-max-ticks 500000
; every g-learn-frequency rounds researchers might learn some information
; about the landscape
set g-learn-frequency 20
end
; a landscape of arguments and a discovery relation
; on these arguments is defined
to create-discovery-landscape
; at the start arguments and starts are a circle
set-default-shape arguments "circle"
set-default-shape starts "circle"
set startsargum no-turtles
set disc-startsargum-non-red no-turtles
; The color equivalent to gray in the landscape is cyan (= 85) in the
; group-color-mem. This is set that way such that the smaller color the more
; discovered. Same goes for group-color-mem-cache
let group-colors-list n-values colla-groups [cyan]
repeat number-of-theories [ ; trees are created theory for theory
create-starts 1 [
; variables for color, the theory it belongs to
; and whether it just turned red are initialized
set color lime
set current-start true
set mytheory self
set group-color-mem group-colors-list
set group-color-mem-cache group-colors-list
set startsargum (turtle-set startsargum self)
set disc-startsargum-non-red (turtle-set disc-startsargum-non-red self)
]
let i 0
while [i < theory-depth] [
create-arguments ( 4 ^ (theory-depth - i))[
; variables for color, the theory it belongs to
; and whether it just turned red are initialized
set color gray
set current-argument true
set mytheory one-of starts with [current-start]
set group-color-mem group-colors-list
set group-color-mem-cache group-colors-list
set startsargum (turtle-set startsargum self)
]
set i i + 1
]
; with the created turtles (arguments and roots)
; trees are build, one for each start/root
create-discovery-trees
ask starts [ ; to make sure that all theories are visible
create-starters-with other starts [set color black]
set current-start false
]
ask arguments [set current-argument false]
]
; set the shape of the arguments of the best theory different from a circle
ask startsargum with [mytheory = start 0][
set shape "triangle"
]
end
; create the theory discovery trees
; each node has 0 or 4 child-arguments
; starting from the starts as root
to create-discovery-trees
; first level with starts as roots
ask starts with [count out-discovery-neighbors = 0 and current-start][
repeat 4 [
if any? arguments with [count in-discovery-neighbors = 0 and
current-argument] [
create-discovery-to one-of arguments with [
count in-discovery-neighbors = 0 and current-argument]
]
]
]
; then adding all the normal arguments
while [any? arguments with [count in-discovery-neighbors = 0 and
current-argument]][
ask arguments with [count in-discovery-neighbors = 1 and
count out-discovery-neighbors < 4 and current-argument][
let curarg self
repeat (4 - count out-discovery-neighbors) [
if any? other arguments with [count in-discovery-neighbors = 0 and
current-argument and not out-discovery-neighbor? curarg][
create-discovery-to one-of other arguments with
[count in-discovery-neighbors = 0 and current-argument]
]
]
]
]
end
; on the created landscape an attack relation is defined
; attacks occur only between theories
; the probability that an argument is attacked by another argument
; depends on the attack-probability for the theory the attacked
; argument belongs to, as can be set in the interface
; one theory, the objective best, defends all its arguments
to define-attack-relation
; first the random attacks are defined
create-attacks
; then the best theory defends itself (either in a random way or from the
; leaves)
defend-best
; the uncontested values of the attacks are set
set-uncontested-values
; the arguments and relations are spread over the patches
visualize
end
; this procedure creates the random attacks from one theory to another
to create-attacks
ask startsargum [
; variables for the current argument, the theory it belongs to,
; a random number between 0.00 and 1.00 and a list of theories
let askargu self
let curtheory mytheory
let attack-random random-float 1.00
let starts-list []
ask starts [
set starts-list lput who starts-list
]
set starts-list sort starts-list
; with attack-probability-2nd from the interface an attack towards
; the current argument is created
ifelse number-of-theories = 2 [
if attack-random < attack-probability-2nd and curtheory != start 0 [
create-incoming-attack curtheory askargu
]
][
; when there are three theories both attack-probability-2nd and -3rd are
; considered to create attacks, depending on the theory the current
; argument belongs to first for the third theory
ifelse [who] of curtheory = max starts-list and attack-random <
attack-probability-3rd [
create-incoming-attack curtheory askargu
][
; then attacks towards arguments of the 2nd theory are created
if [who] of curtheory != max starts-list and curtheory != start 0 and
attack-random < attack-probability-2nd [
create-incoming-attack curtheory askargu
]
]
]
; if the current argument belongs to the objective best theory
; an attack towards this argument is created with attack-probability-best
if attack-random < attack-probability-best and curtheory = start 0 [
create-incoming-attack curtheory askargu
]
]
end
; creates an incoming attack to the askargu from another argument which
; a) must not be from the same theory and
; b) must not be conected with askargu by an attack already
to create-incoming-attack [curtheory askargu]
create-attack-from one-of other startsargum with [mytheory != curtheory
and not attack-neighbor? askargu][
set color gray
set mytheory-end1 [mytheory] of end1
set mytheory-end2 curtheory
set in-group-i-memory n-values colla-networks [false]
]
end
; after the random attacks are created, attacks coming from the best theory
; are added such that it defends itself completely
to defend-best
; best-th-args is a turtle-set containing all the arguments (including the
; start) from the best theory
let best-th-args startsargum with [mytheory = start 0]
ask best-th-args [
; variable for the current argument
let askargu self
if any? in-attack-neighbors [
ask in-attack-neighbors [
; variable for the attacking argument, if such an argument exists
let askattack self
; a defending attack is only created if there is not yet an attack
; from an argument of the best theory towards the attacking argument
if not any? in-attack-neighbors with [mytheory = start 0][
create-attack-from one-of best-th-args with [
not attack-neighbor? askattack and not (self = askargu) and
not (defense-from-leaves and any? my-out-discoveries)][
set color gray
set mytheory-end1 (start 0)
set mytheory-end2 [mytheory] of end2
set in-group-i-memory n-values colla-networks [false]
]
]
]
]
]
end
; the uncontested values serve as a first approximation to lower the
; computational intensity of the calc-global-admiss (cga) procedure.
; They're not intended to be always correct and will be reset at the end
; of the cga procedure. For the cga procedure to work correctly it is only
; important that the attacks with uncontested = true are really not attacked
; themselves
to set-uncontested-values
ask attacks [
ifelse [any? my-in-attacks] of end1 [
set uncontested false
][
set uncontested true
]
]
end
; creates the visible tree, centered around
; the root of the best theory
to visualize
layout-radial
startsargum
links with [breed = discoveries or breed = starters]
start 0
; to to prevent potential conflicts when asking for general link
; primitives e.g. during update-memories the starters links are removed
ask starters [die]
end
; in this procedure the researchers are created,
; including their memory and the social netoworks
; and they are distributed randomly over the theories
to distribute-researchers
set-default-shape researchers "person"
; the right number of researchers is created
; and the researcher variables are initialized
researchers-create-scientists
; the researchers are moved to the roots of the theories where they will
; beginn their research (either in a controlled or random way)
ifelse controlled-spread-of-researchers and within-theory [
move-researchers-to-roots-controlled
][
move-researchers-to-roots
]
; create the network of collaborators
; if in the interface "within-theory" is on, collaborative networks are
; created among researchers that start from the same theory
; (i.e. homogeneous-groups). A network has col-group-size researchers in it
set colla-networks []
ifelse within-theory [
create-homogeneous-groups
][
; if "within-theory" is off in the interface, random collaborative networks
; (i.e. heterogeneous-groups) are created, all of size col-group-size
create-heterogeneous-groups
]
; the networks in which researchers share with other groups is created
create-networks
end
; create researchers and initialize their variables
to researchers-create-scientists
; an researcher is always aware of all the theories
; the information the researcher has about a theory
; is collected in current-theory-info which has
; the form [[(start 0) no. adm args] ...]
let theories []
foreach sort starts [ [curstart] ->
let start-add []
set start-add lput curstart start-add
set start-add lput 0 start-add
set theories lput start-add theories
]
create-researchers all-scientists [
; the researchers are blue-colored
set color blue
; some researcher-own variables are initialized
set collaborator-network []
set subjective-relations no-links
set to-add-mem-rel no-links
set argu-cache no-turtles
set non-admiss-subj-argu no-turtles
set to-add-mem-argu no-turtles
set flag-updated-memory false
set moved false
set rep-researcher false
set current-theory-info theories
set on-red-theory? false
set social-action ""
]
end
; The researchers are randomly distributed among the starts in packs of five
; which corresponds to the number of members each collaborative network has
; the researcher will set mygps (the argument she's currently working on)
; to be the root where she starts and she will add this root to her
; subjective-arguments
to move-researchers-to-roots
let none-best-start one-of starts with [mytheory != start 0]
ask n-of (biased-deceptive-groups * col-group-size) researchers [
set social-action "biased-deceptive"
set color white
move-to none-best-start
set mygps none-best-start
set subjective-arguments none-best-start
]
let remaining-researchers researchers with [social-action = ""]
ifelse within-theory [
while [any? remaining-researchers][
let start-destination one-of starts
ask n-of col-group-size remaining-researchers [
move-to start-destination
set mygps start-destination
set subjective-arguments start-destination
set remaining-researchers other remaining-researchers
]
]
][
ask remaining-researchers [
let start-destination one-of starts
move-to start-destination
set mygps start-destination
set subjective-arguments start-destination
]
]
end
;researchers are distributed in controlled way: a part of them (determined
;by the global col-groups-on-best-t) is placed on the best theory, while
;the rest are randomly distributed on the other two theories. This is meant to
;be used only in conjunction with homogeneous groups (i.e.
;`within-theory` = true).
to move-researchers-to-roots-controlled
let none-best-start one-of starts with [mytheory != start 0]
ask n-of (biased-deceptive-groups * col-group-size) researchers [
set social-action "biased-deceptive"
set color white
move-to none-best-start
set mygps none-best-start
set subjective-arguments none-best-start
]
let remaining-researchers researchers with [social-action = ""]
repeat col-groups-on-best-t [
if any? remaining-researchers [
let start-destination start 0
ask n-of col-group-size remaining-researchers [
move-to start-destination
set color pink
set mygps start-destination
set subjective-arguments start-destination
set remaining-researchers other remaining-researchers
]
]
]
while [any? remaining-researchers] [
let start-destination one-of starts with [who != 0]
ask n-of col-group-size remaining-researchers [
move-to start-destination
set color blue
set mygps start-destination
set subjective-arguments start-destination
set remaining-researchers other remaining-researchers
]
]
end
; if in the interface "within-theory" is on, collaborative networks are created
; among researchers that start from the same theory (i.e. homogeneous-groups)
; a network has col-group-size researchers in it
to create-homogeneous-groups
let i 0
ask starts [
; while there are more than five researchers on the root without a network
; networks of five researchers are created
while [any? researchers in-radius 0 with
[empty? collaborator-network and social-action = ""]] [
let cur-col no-turtles
; col-group-size researchers are added to the turtle-set cur-col which is
; then set as the collaborator-network of each of these researchers
ask n-of col-group-size researchers in-radius 0 with
[empty? collaborator-network and social-action = ""] [
set cur-col (turtle-set cur-col self)
]
; initialize variables for the collection of the networks
; and the networks that will share with each other
set colla-networks lput sort cur-col colla-networks
set group-color-mem replace-item i group-color-mem color
ask cur-col [
set collaborator-network sort cur-col
set group-id i
]
set i i + 1
]
]
if deceptive-groups != 0 [
ifelse group-distribution [
let cur-col shuffle colla-networks
let deceptive-grp-list reduce sentence sublist cur-col 0 deceptive-groups
ask researchers with [member? self deceptive-grp-list] [
set social-action "deceptive"
]
][
ask n-of (col-group-size * deceptive-groups) researchers
with [social-action = ""] [
set social-action "deceptive"
]
]
]
ask researchers with [social-action = ""] [
set social-action "reliable"
]
ask starts [
while [any? researchers in-radius 0 with
[empty? collaborator-network and social-action = "biased-deceptive"]] [
let cur-col no-turtles
; col-group-size researchers are added to the turtle-set cur-col which is
; then set as the collaborator-network of each of these researchers
ask n-of col-group-size researchers in-radius 0 with
[empty? collaborator-network and social-action = "biased-deceptive"] [
set cur-col (turtle-set cur-col self)
]
; initialize variables for the collection of the networks
; and the networks that will share with each other
set colla-networks lput sort cur-col colla-networks
set group-color-mem replace-item i group-color-mem color
ask cur-col [
set collaborator-network sort cur-col
set group-id i
]
set i i + 1
]
]
end
; if "within-theory" is off in the interface random collaborative networks
; are created (i.e. heterogeneous-groups), all of size col-group-size
to create-heterogeneous-groups
let i 0
while [any? researchers with
[empty? collaborator-network and social-action = ""]][
; variable that collects five researchers for a network
let cur-col no-turtles
; col-group-size researchers are added to the turtle-set cur-col which is
; then set as the collaborator-network of each of these researchers
ask n-of col-group-size researchers with
[empty? collaborator-network and social-action = ""][
set cur-col (turtle-set cur-col self)
]
; initialize variables for the collection of the networks
; and the networks that will share with each other
set colla-networks lput sort cur-col colla-networks
ask cur-col [
set collaborator-network sort cur-col
set group-id i
ask starts in-radius 0 [
set group-color-mem replace-item i group-color-mem color
]
]
set i i + 1
]
if deceptive-groups != 0 [
if-else group-distribution [
let cur-col shuffle colla-networks
let deceptive-grp-list reduce sentence sublist cur-col 0 deceptive-groups
ask researchers with [member? self deceptive-grp-list] [
set social-action "deceptive"
]
][
ask n-of (col-group-size * deceptive-groups) researchers
with [social-action = ""] [
set social-action "deceptive"
]
]
]
ask researchers with [social-action = ""] [
set social-action "reliable"
]
ask starts [
while [any? researchers in-radius 0 with
[empty? collaborator-network and social-action = "biased-deceptive"]] [
let cur-col no-turtles
; col-group-size researchers are added to the turtle-set cur-col which is
; then set as the collaborator-network of each of these researchers
ask n-of col-group-size researchers in-radius 0 with
[empty? collaborator-network and social-action = "biased-deceptive"] [
set cur-col (turtle-set cur-col self)
]
; initialize variables for the collection of the networks
; and the networks that will share with each other
set colla-networks lput sort cur-col colla-networks
set group-color-mem replace-item i group-color-mem color
ask cur-col [
set collaborator-network sort cur-col
set group-id i
]
set i i + 1
]
]
end
; Computations for the popularity plot and the reporters in behaviorspace runs
; it computes for every theory the number of researchers working on it
; (myscientists) and how many researchers consider a theory to be among the
; best (myscientists-pluralist). This values are added up in their respective
; global variables: research-time-monist/pluralist (cf. start-owned-variables).
; Arguments: update-pluralist? format: boolean. Determines whether the
; myscientists-pluralist value has to be updated (only true if ticks mod 5 = 4
; or at the end of a run)
to compute-popularity [update-pluralist?]
ask starts [
set myscientists 0
if update-pluralist? [
set myscientists-pluralist 0
]
]
; As long as researchers haven't done any admissibility calculations it is
; assumed that they think the theory they're currently working on is the
; single best theory
if ticks = 0 [
ask starts [
set myscientists-pluralist count researchers with
[social-action != "biased-deceptive"] in-radius 0
]
]
ask researchers with [social-action != "biased-deceptive"] [
let curresearcher self
let myargu mygps
let mystart [mytheory] of myargu
ask mystart [
set myscientists myscientists + 1
]
ifelse member? mystart g-red-theories [
set on-red-theory? true
][
set on-red-theory? false
]
if update-pluralist? [
ifelse cur-best-th != 0 [
foreach cur-best-th [ [curstart] ->
ask curstart [
set myscientists-pluralist (myscientists-pluralist
+ 1 / length [cur-best-th] of curresearcher)
]
]
][
; As long as researchers haven't done any admissibility calculations
; it is assumed that they think the theory they're currently working
; on is the single best theory
ask mystart [
set myscientists-pluralist (myscientists-pluralist + 1)
]
]
]
]
ask starts [
set research-time-monist research-time-monist + myscientists
set research-time-pluralist research-time-pluralist
+ myscientists-pluralist
]
let most-pop-th max-one-of starts [myscientists]
ifelse [myscientists] of most-pop-th = scientists [
if last-converged-th != most-pop-th [
; the +1 correction is b/c the variable is set before `tick` happens
let current-convergence-time ticks + 1
set round-converged current-convergence-time
set-convergence-duration current-convergence-time
set g-convergence-start lput current-convergence-time g-convergence-start
set last-converged-th most-pop-th
]
][
set-convergence-duration (ticks + 1)
set round-converged -1
set last-converged-th -1
]
; for the calculations of the times that no researcher
; was on the best theory
; the +1 correction is b/c the variable is set before `tick` happens
let current-time ticks + 1
ifelse [myscientists] of start 0 = 0 [
if none-before [
set g-none-on-best-start lput current-time g-none-on-best-start
]
set none-before false
][
set-non-on-best-duration current-time
set none-before true
]
set g-comp-pop-counter g-comp-pop-counter + 1
end
; the social network structures for collaborator networks
; is created according to the choice made in the interface:
; cycle, wheel or complete
to create-networks
; a temporary colla-networks variable is created such that the groups are in
; random order
let colla-networks-temp shuffle colla-networks
; an entry in share-structure starts with the network that
; is the network that initializes the sharing
set share-structure []
; in the case that the choice in the interface is cycle
ifelse network-structure = "cycle" [
let connect-networks colla-networks-temp
; when there are only two collaborator-networks
; they always share with each other
ifelse colla-groups = 2 [
set share-structure lput colla-networks-temp share-structure
set share-structure lput reverse colla-networks-temp share-structure
][
; in all other cases networks share with two neighboring networks
; for three networks this is still a complete case
while [length connect-networks > 2] [
; first the entries for the beginning and end of the list
ifelse empty? share-structure[
let to-add-structure1 []
let to-add-structure2 []
set to-add-structure1 lput first connect-networks to-add-structure1
set to-add-structure1 lput first but-first connect-networks
to-add-structure1
set to-add-structure1 lput last connect-networks to-add-structure1
set to-add-structure2 lput last connect-networks to-add-structure2
set to-add-structure2 lput first connect-networks to-add-structure2
set to-add-structure2 lput last but-last connect-networks
to-add-structure2
set share-structure lput to-add-structure1 share-structure
set share-structure lput to-add-structure2 share-structure
][
; then the networks in between
let to-add-structure []
set to-add-structure lput first but-first connect-networks to-add-structure
set to-add-structure lput first connect-networks to-add-structure
set connect-networks remove-item 0 connect-networks
set to-add-structure lput first but-first connect-networks to-add-structure
set share-structure lput to-add-structure share-structure
]
]
]
][
; in the case that the choice in the interface is wheel
ifelse network-structure = "wheel" [
let connect-networks colla-networks-temp
; when there are only two or three collaborator-networks
; they always share with each other
ifelse colla-groups < 4 [
set share-structure lput colla-networks-temp share-structure
set share-structure lput reverse colla-networks-temp share-structure
if colla-groups = 3 [
let add-colla-networks []
set add-colla-networks lput first but-first colla-networks-temp
add-colla-networks
set add-colla-networks lput first colla-networks-temp
add-colla-networks
set add-colla-networks lput last colla-networks-temp add-colla-networks
set share-structure lput add-colla-networks share-structure
]
][
; the first network is defined to be the royal family:
; the network that shares with all other networks
let middle first connect-networks
set connect-networks remove-item 0 connect-networks
let add-middle []
set add-middle lput middle add-middle
foreach connect-networks [ [?1] ->
if ?1 != middle [
set add-middle lput ?1 add-middle
]
]
; the other networks are put in a cycle, with the
; addition that every networks shares with middle (the royal family)
while [length connect-networks > 2] [
ifelse empty? share-structure[
let to-add-structure1 []
let to-add-structure2 []
set to-add-structure1 lput first connect-networks to-add-structure1
set to-add-structure1 lput first but-first connect-networks
to-add-structure1
set to-add-structure1 lput last connect-networks to-add-structure1
set to-add-structure1 lput middle to-add-structure1
set to-add-structure2 lput last connect-networks to-add-structure2
set to-add-structure2 lput first connect-networks to-add-structure2
set to-add-structure2 lput last but-last connect-networks
to-add-structure2
set to-add-structure2 lput middle to-add-structure2
set share-structure lput to-add-structure1 share-structure
set share-structure lput to-add-structure2 share-structure
][
let to-add-structure []
set to-add-structure lput first but-first connect-networks to-add-structure
set to-add-structure lput first connect-networks to-add-structure
set connect-networks remove-item 0 connect-networks
set to-add-structure lput first but-first connect-networks to-add-structure
set to-add-structure lput middle to-add-structure
set share-structure lput to-add-structure share-structure
]
]
; the first entry of share-structure is the royal family entry
set share-structure fput add-middle share-structure
]
][
; the other cases: a completely connected graph
; for each collaborator-network an entry is created with at the
; first position the network and then all others
foreach colla-networks-temp [ [?1] ->
let cur-network ?1
let to-add-structure []
set to-add-structure lput cur-network to-add-structure
foreach colla-networks-temp [ [??1] ->
if ??1 != cur-network [
set to-add-structure lput ??1 to-add-structure
]
]
set share-structure lput to-add-structure share-structure
]
]
]
end
; This procedure calculates the objective admissibility of each theory which is
; saved in the `objective-admissibility` value of each start.
; The calculation for the best theory (start 0) is redundant as it will always
; have full admissibility, but is still performed as a kind of check for the
; model.
to calc-global-admiss
let startslist sort starts
foreach startslist [[curtheory] ->
; all attacks which are concerning the curtheory (i.e. incoming or
; outgoing) form the link-set curtheory-attacks (e.g. (agentset, 90 links))
let curtheory-attacks attacks with [mytheory-end1 = curtheory
or mytheory-end2 = curtheory]
ask curtheory [
let non-admiss-argu admissibility-calc-core curtheory-attacks
set objective-admissibility (count startsargum with [
mytheory = curtheory]
- count non-admiss-argu with [mytheory = curtheory])
]
]
; the attacks are reset b/c none of them is yet discovered so
; they're currently all uncontested
ask attacks [
set uncontested true
]
end
; records the number of scientists on each start at the beginning of the run
to record-initial-scientists
ask starts [
set initial-scientists count researchers with
[social-action != "biased-deceptive"] in-radius 0
if initial-scientists = scientists [
set last-converged-th self
set g-convergence-start lput 0 g-convergence-start
]
]
if last-converged-th = 0 [
set last-converged-th -1
set round-converged -1
]
ifelse [initial-scientists] of (start 0) = 0 [
set g-none-on-best-start lput 0 g-none-on-best-start
set none-before false
][
set none-before true
]
end
; creates the list from which items are drawn in case that
; `necessary-convergence` is selected in the interface
to set-g-learn-set
; researchers can learn any argument and/or attack in the landscape by chance
let learn-args sort startsargum
let learn-rel sort attacks
set g-learn-set sentence learn-args learn-rel
end