-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMalwarePropagationModel.nlogo
1912 lines (1682 loc) · 53 KB
/
MalwarePropagationModel.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
turtles-own
[
node-clustering-coefficient ;; and how close its neighbours are to being a complete graph
distance-from-other-turtles ;; list of distances of this node from other turtles
;; state of the computer during the virus propagation
susceptible?
infectious?
attacked?
;; indicate whether the node was attacked by the one virus or the other
antivirus1?
antivirus2?
;; time counter during the attack state of a node
attacked-at-tick
;; count the attacks of both viruses, together and separately
attack-count
attack1-count
attack2-count
]
links-own
[
rewired? ;; keeps track of whether the link has been rewired or not
]
globals
[
clustering-coefficient ;; clustering coefficient of the network (all turtles)
average-path-length ;; average path length of the network
clustering-coefficient-of-lattice ;; clustering coefficient of the initial lattice
average-path-length-of-lattice ;; average path length of the initial lattice
infinity ;; a very large number for distance between two turtles which
;; don't have a connected or unconnected path between them
highlight-string ;; for node inspector
connected-network?
]
;;;;;;;;;;;;;;;;;;;;;;;
;;; Network Setup ;;;
;;;;;;;;;;;;;;;;;;;;;;;
to startup
set highlight-string ""
end
;; It sets up a network according to the chosen network type;
;; calls startup, do-calculations and infect-initial and resets the ticks.
to setup
clear-all
set infinity 99999 ;; just an arbitrary choice for a large number
set-default-shape turtles "circle"
startup
if network-type = "small-world"[
make-turtles
;; arrange them in a circle in order by who number
layout-circle (sort turtles) max-pxcor - 0.5
;; set up a variable to determine if we still have a connected network
;; (in most cases we will since it starts out fully connected)
let success? false
while [not success?] [
;; we need to find initial values for lattice
wire-them
;;calculate average path length and clustering coefficient for the lattice
set success? do-calculations
]
;; setting the values for the initial lattice
set clustering-coefficient-of-lattice clustering-coefficient
set average-path-length-of-lattice average-path-length
rewire-all
]
if network-type = "scale-free"[
make-node nobody ;; first node, unattached
make-node turtle 0 ;; second node, attached to first node
let i 0
while [ i < num-nodes - 2][
set i i + 1
make-node find-partner ;; find partner & use it as attachment point for new node
layout
]
let success? do-calculations
]
if network-type = "computernetwork"[
make-turtles
setup-spatially-clustered-network
let success? do-calculations
]
infect-initial
reset-ticks
end
to make-turtles
create-turtles num-nodes [
set color green
set susceptible? true
set infectious? false
set attacked? false
set antivirus1? false
set antivirus2? false
set attack-count 0
set attack1-count 0
set attack2-count 0
set shape "cylinder"
]
end
;; scale-free network function creates one node with a connection to an old-node and moves towards it
to make-node [old-node]
create-turtles 1
[
set color green
set susceptible? true
set infectious? false
set attacked? false
set antivirus1? false
set antivirus2? false
set attack-count 0
set attack1-count 0
set attack2-count 0
set shape "cylinder"
if old-node != nobody
[ create-link-with old-node
;; position the new node near its partner
move-to old-node
fd 8
]
]
end
to-report find-partner
report [one-of both-ends] of one-of links
end
;; layout the scale-free network during the creation animation
to layout
;; the number 3 here is arbitrary; more repetitions slows down the
;; model, but too few gives poor layouts
repeat 3 [
;; the more turtles we have to fit into the same amount of space,
;; the smaller the inputs to layout-spring we'll need to use
let factor sqrt count turtles
;; numbers here are arbitrarily chosen for pleasing appearance
layout-spring turtles links (1 / factor) (7 / factor) (1 / factor)
display ;; for smooth animation
]
;; don't bump the edges of the world
let x-offset max [xcor] of turtles + min [xcor] of turtles
let y-offset max [ycor] of turtles + min [ycor] of turtles
;; big jumps look funny, so only adjust a little each time
set x-offset limit-magnitude x-offset 0.1
set y-offset limit-magnitude y-offset 0.1
ask turtles [ setxy (xcor - x-offset / 2) (ycor - y-offset / 2) ]
end
to-report limit-magnitude [number limit]
if number > limit [ report limit ]
if number < (- limit) [ report (- limit) ]
report number
end
;; sets up a spatially clustered computer network
to setup-spatially-clustered-network
ask turtles[
; for visual reasons, we don't put any nodes *too* close to the edges
setxy (random-xcor * 0.95) (random-ycor * 0.95)
]
let num-links (average-node-degree * num-nodes) / 2
while [count links < num-links ]
[
ask one-of turtles
[
let choice (min-one-of (other turtles with [not link-neighbor? myself])
[distance myself])
if choice != nobody [ create-link-with choice ]
]
]
; make the network look a little prettier
repeat 10
[
layout-spring turtles links 0.3 (world-width / (sqrt num-nodes)) 1
]
end
to rewire-all
;; make sure num-turtles is setup correctly; if not run setup first
if count turtles != num-nodes [
setup
]
;; set up a variable to see if the network is connected
let success? false
;; if we end up with a disconnected network, we keep trying, because the APL distance
;; isn't meaningful for a disconnected network.
while [not success?] [
;; kill the old lattice, reset neighbors, and create new lattice
ask links [ die ]
wire-them
ask links [
;; whether to rewire it or not?
if (random-float 1) < rewiring-probability
[
;; "a" remains the same
let node1 end1
;; if "a" is not connected to everybody
if [ count link-neighbors ] of end1 < (count turtles - 1)
[
;; find a node distinct from node1 and not already a neighbor of node1
let node2 one-of turtles with [ (self != node1) and (not link-neighbor? node1) ]
;; wire the new edge
ask node1 [ create-link-with node2 [ set rewired? true ] ]
set rewired? true
]
]
;; remove the old edge
if (rewired?)
[
die
]
]
;; check to see if the new network is connected and calculate path length and clustering
;; coefficient at the same time
set success? do-calculations
]
end
;; infects the specified number of nodes and can be influenced by the outlier-hub coefficient
to infect-initial
let max-connect [count link-neighbors] of max-one-of turtles [count link-neighbors]
let max-turtle max-one-of turtles [(sum remove infinity distance-from-other-turtles) / (length remove infinity distance-from-other-turtles)]
let max-avg [(sum remove infinity distance-from-other-turtles) / (length remove infinity distance-from-other-turtles)] of max-turtle
let min-turtle min-one-of turtles with [count link-neighbors > 0] [(sum remove infinity distance-from-other-turtles) / (length remove infinity distance-from-other-turtles)]
let min-avg [(sum remove infinity distance-from-other-turtles) / (length remove infinity distance-from-other-turtles)] of min-turtle
while [count turtles with [infectious? = true] < infected-at-start] [
ask turtle random num-nodes [
let pairs (length remove infinity distance-from-other-turtles)
let local-val (sum remove infinity distance-from-other-turtles) / pairs
let prob 1
let base 1
if outlier-hub < 0 and (count link-neighbors > 0) [
set prob (local-val / max-avg) * (1 / count link-neighbors)
set base -1 * outlier-hub
]
if outlier-hub > 0 and local-val > 0 and local-val <= max-avg [
set prob (min-avg / local-val ) * (count link-neighbors / max-connect)
set base outlier-hub
]
if susceptible? and (random-float base <= prob) [
set color orange
set antivirus2? true
if antivirus-propagation = true [
if random-float 100 > proportion-red-purple [
set color pink
set antivirus1? true
set antivirus2? false
]
]
set susceptible? false
set infectious? true
set attacked? false
set shape "circle"
]
]
]
end
;;;;;;;;;;;;;;;;;;;;;;
;;; Main Procedure ;;;
;;;;;;;;;;;;;;;;;;;;;;
to go
;color all turtles
ask turtles with [susceptible? and ((not antivirus1?) or (not patch-exploit))] [
let i count link-neighbors with [infectious? and (not antivirus1?)]
if random-float 1 < i * h [
set color orange
set shape "circle"
]
]
ask turtles with [infectious? and (not antivirus1?)] [
if auto-cut = true [
if random-float 1 < detection-probability [
cut who
]
]
if random-float 1 < a [
set color red
set attacked-at-tick ticks
]
if random-float 1 < b [set color green]
]
if antivirus-propagation = true [
ask turtles with [susceptible? and ((not antivirus2?) or (not patch-exploit))] [
let i count link-neighbors with [infectious? and (not antivirus2?)]
if random-float 1 < i * h2 [
set color pink
set shape "circle"
]
]
ask turtles with [infectious? and (not antivirus2?)] [
if auto-cut = true [
if random-float 1 < detection-probability [
cut who
]
]
if random-float 1 < a2 [
set color violet
set attacked-at-tick ticks
]
if random-float 1 < b2 [set color green]
]
]
ask turtles with [attacked?] [
if attacked-at-tick + T + 1 = ticks [
if color = red [
set attack1-count attack1-count + 1
]
if color = violet [
set attack2-count attack2-count + 1
]
set attack-count attack-count + 1
set color green
set attack-count attack-count + 1
if auto-rewire = true [
rewire who auto-rewire-probability
]
]
]
;change the status according to new color
ask turtles with [color = green] [
set susceptible? true
set infectious? false
set attacked? false
]
ask turtles with [color = orange] [
set susceptible? false
set infectious? true
set attacked? false
set antivirus1? false
set antivirus2? true
]
ask turtles with [color = red] [
set susceptible? false
set infectious? false
set attacked? true
]
ask turtles with [color = pink] [
set susceptible? false
set infectious? true
set attacked? false
set antivirus1? true
set antivirus2? false
]
ask turtles with [color = violet] [
set susceptible? false
set infectious? false
set attacked? true
]
set connected-network? do-calculations
ask turtles with [count link-neighbors = 0] [
set shape "x"
]
ask turtles with [count link-neighbors > 0] [
set shape "circle"
]
if not any? turtles with [(color = red) or (color = orange) or (color = violet) or (color = pink) ] [ stop ]
tick
end
;;;;;;;;;;;;;;;;;;;;
;;; Calculations ;;;
;;;;;;;;;;;;;;;;;;;;
;; do-calculations reports true if the network is connected,
;; and reports false if the network is disconnected.
to-report do-calculations
;; set up a variable so we can report if the network is disconnected
let connected? true
;; find the path lengths in the network
find-path-lengths
let num-connected-pairs sum [length remove infinity (remove 0 distance-from-other-turtles)] of turtles
;; In a connected network on N nodes, we should have N(N-1) measurements of distances between pairs,
;; and none of those distances should be infinity.
;; If there were any "infinity" length paths between nodes, then the network is disconnected.
;; In that case, calculating the average-path-length doesn't really make sense.
ifelse ( num-connected-pairs != (count turtles * (count turtles - 1) ))
[
set average-path-length infinity
;; report that the network is not connected
set connected? false
]
[
set average-path-length (sum [sum distance-from-other-turtles] of turtles) / (num-connected-pairs)
]
;; find the clustering coefficient and add to the aggregate for all iterations
find-clustering-coefficient
;; report whether the network is connected or not
report connected?
end
to-report in-neighbourhood? [ hood ]
report ( member? end1 hood and member? end2 hood )
end
to find-clustering-coefficient
ifelse all? turtles [count link-neighbors <= 1]
[
;; it is undefined
;; what should this be?
set clustering-coefficient 0
]
[
let total 0
ask turtles with [ count link-neighbors <= 1]
[ set node-clustering-coefficient "undefined" ]
ask turtles with [ count link-neighbors > 1]
[
let hood link-neighbors
set node-clustering-coefficient (2 * count links with [ in-neighbourhood? hood ] /
((count hood) * (count hood - 1)) )
;; find the sum for the value at turtles
set total total + node-clustering-coefficient
]
;; take the average
set clustering-coefficient total / count turtles with [count link-neighbors > 1]
]
end
;; Path length computation
;; Implements the Floyd Warshall algorithm for All Pairs Shortest Paths
;; It is a dynamic programming algorithm which builds bigger solutions
;; from the solutions of smaller subproblems using memoization that
;; is storing the results.
;; It keeps finding incrementally if there is shorter path through
;; the kth node.
;; Since it iterates over all turtles through k,
;; so at the end we get the shortest possible path for each i and j.
to find-path-lengths
;; reset the distance list
ask turtles
[
set distance-from-other-turtles []
]
let i 0
let j 0
let k 0
let node1 one-of turtles
let node2 one-of turtles
let node-count count turtles
;; initialize the distance lists
while [i < node-count]
[
set j 0
while [j < node-count]
[
set node1 turtle i
set node2 turtle j
;; zero from a node to itself
ifelse i = j
[
ask node1 [
set distance-from-other-turtles lput 0 distance-from-other-turtles
]
]
[
;; 1 from a node to it's neighbor
ifelse [ link-neighbor? node1 ] of node2
[
ask node1 [
set distance-from-other-turtles lput 1 distance-from-other-turtles
]
]
;; infinite to everyone else
[
ask node1 [
set distance-from-other-turtles lput infinity distance-from-other-turtles
]
]
]
set j j + 1
]
set i i + 1
]
set i 0
set j 0
let dummy 0
while [k < node-count]
[
set i 0
while [i < node-count]
[
set j 0
while [j < node-count]
[
;; alternate path length through kth node
set dummy ( (item k [distance-from-other-turtles] of turtle i) +
(item j [distance-from-other-turtles] of turtle k))
;; is the alternate path shorter?
if dummy < (item j [distance-from-other-turtles] of turtle i)
[
ask turtle i [
set distance-from-other-turtles replace-item j distance-from-other-turtles dummy
]
]
set j j + 1
]
set i i + 1
]
set k k + 1
]
end
;;;;;;;;;;;;;;;;;;;;;;;
;;; Edge Operations ;;;
;;;;;;;;;;;;;;;;;;;;;;;
;; creates a new lattice
to wire-them
;; iterate over the turtles
let n 0
while [n < count turtles]
[
;; make edges with the very next neighbors
make-edge turtle n
turtle ((n + 1) mod count turtles)
make-edge turtle n
turtle ((n + 2) mod count turtles)
set n n + 1
]
end
;; connects the two turtles
to make-edge [node1 node2]
ask node1 [ create-link-with node2 [
set rewired? false
] ]
end
;; rewire node n with probability x
to rewire [n x]
let node1 turtle n
if random-float 1 < x [
if [ count link-neighbors ] of node1 < (count turtles / 2) [
;; find a node distinct from node1 and not already a neighbor of node1
let potential-turtles turtles with [ (self != node1) and (not link-neighbor? node1)]
let preferred-turtles turtles with [count link-neighbors = 0]
let i 0
let j (count link-neighbors * rewire-percentage / 100)
while [ i < j ][
;; remove the old edge
let potential-edges links with [ (end1 = node1) or (end2 = node1) ]
if any? potential-edges [
ask one-of potential-edges [ die ]
]
set i i + 1
]
let selected-turtles min-n-of i potential-turtles [attack-count]
if patch-exploit = true and antivirus-propagation = true[
ask node1[
if color = red [
set selected-turtles min-n-of i potential-turtles [attack1-count]
]
if color = violet [
set selected-turtles min-n-of i potential-turtles [attack2-count]
]
]
]
if (prefer-disconnected)[
ifelse (count preferred-turtles) >= i [
set selected-turtles min-n-of i preferred-turtles [attack-count]
if patch-exploit = true and antivirus-propagation = true[
ask node1[
if color = red [
set selected-turtles min-n-of i preferred-turtles [attack1-count]
]
if color = violet [
set selected-turtles min-n-of i preferred-turtles [attack2-count]
]
]
]
][
let diff i - (count preferred-turtles)
set selected-turtles (turtle-set preferred-turtles (min-n-of diff potential-turtles [attack-count]))
if patch-exploit = true and antivirus-propagation = true[
ask node1[
if color = red [
set selected-turtles (turtle-set preferred-turtles (min-n-of diff potential-turtles [attack2-count]))
]
if color = violet [
set selected-turtles (turtle-set preferred-turtles (min-n-of diff potential-turtles [attack2-count]))
]
]
]
]
]
ask selected-turtles [
create-link-with node1 [ set color cyan set rewired? true ]
]
]
]
end
;; cut all connections to / from node n
to cut [n]
let node turtle n
let potential-edges links with [ (end1 = node) or (end2 = node) ]
if any? potential-edges [
ask potential-edges [ die ]
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Inspect & Infect with Mouse ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to highlight
;; remove any previous highlights
ask turtles [set shape "circle"]
ask links [ set color gray ]
if mouse-inside? [ do-highlight ]
display
end
to do-highlight
;; getting the node closest to the mouse
let min-d min [distancexy mouse-xcor mouse-ycor] of turtles
let node one-of turtles with [count link-neighbors > 0 and distancexy mouse-xcor mouse-ycor = min-d]
if node != nobody
[
;; highlight the chosen node
ask node
[
set shape "circle 2"
let pairs (length remove infinity distance-from-other-turtles)
let local-val (sum remove infinity distance-from-other-turtles) / pairs
let immune ""
if antivirus1? = true and patch-exploit = true and antivirus-propagation = true [ set immune "immune to red | " ]
if antivirus2? = true and patch-exploit = true and antivirus-propagation = true [ set immune "immune to purple | " ]
if antivirus1? = false and antivirus2? = false [ set immune "uneffected | " ]
if node-clustering-coefficient = "undefined"[
set highlight-string (word immune attack-count " previous attacks | avg path length = " precision local-val 3
" (for " pairs " turtles )")
]
if not (node-clustering-coefficient = "undefined")[
set highlight-string (word immune attack-count " previous attacks | clustering coefficient = " precision node-clustering-coefficient 3
" | avg path length = " precision local-val 3
" (for " pairs " turtles )")
]
]
let neighbor-nodes [ link-neighbors ] of node
let direct-links [ my-links ] of node
;; highlight neighbors
ask neighbor-nodes
[
set shape "dot"
;; highlight edges connecting the chosen node to its neighbors
ask my-links [
ifelse (end1 = node or end2 = node)
[
set color blue ;
]
[
if (member? end1 neighbor-nodes and member? end2 neighbor-nodes)
[ set color yellow ]
]
]
]
]
end
to infect-with-mouse
if mouse-down? [
let min-d min [distancexy mouse-xcor mouse-ycor] of turtles
let node one-of turtles with [count link-neighbors > 0 and distancexy mouse-xcor mouse-ycor = min-d]
if node != nobody[
ask node [
set color orange
set susceptible? false
set infectious? true
set attacked? false
set antivirus1? false
set antivirus2? true
set shape "circle"
]
]
]
end
to infect-pink-with-mouse
if mouse-down? [
let min-d min [distancexy mouse-xcor mouse-ycor] of turtles
let node one-of turtles with [count link-neighbors > 0 and distancexy mouse-xcor mouse-ycor = min-d]
if node != nobody[
ask node [
set color pink
set susceptible? false
set infectious? true
set attacked? false
set antivirus1? true
set antivirus2? false
set shape "circle"
]
]
]
end
;; The Small Worlds model and parts of the code are adapted from
;; Wilensky, U. (2005). NetLogo Small Worlds model. http://ccl.northwestern.edu/netlogo/models/SmallWorlds. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
;; The Preferential Attachment / Scale Free model and parts of the code are adapted from
;; Wilensky, U. (2005). NetLogo Preferential Attachment model. http://ccl.northwestern.edu/netlogo/models/PreferentialAttachment. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
;; The setup of a spatially clustered computer network was adapted from
;; Stonedahl, F. and Wilensky, U. (2008). NetLogo Virus on a Network model. http://ccl.northwestern.edu/netlogo/models/VirusonaNetwork. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
; See Info tab for full copyright and license.
@#$#@#$#@
GRAPHICS-WINDOW
307
10
893
597
-1
-1
17.52
1
10
1
1
1
0
0
0
1
-16
16
-16
16
1
1
1
ticks
30.0
SLIDER
4
59
146
92
num-nodes
num-nodes
10
150
100.0
1
1
NIL
HORIZONTAL
BUTTON
9
15
64
48
NIL
setup
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
SLIDER
5
98
141
131
rewiring-probability
rewiring-probability
0
1
0.21
0.01
1
NIL
HORIZONTAL
SLIDER
3
134
175
167
infected-at-start
infected-at-start
1
num-nodes - 1
25.0
1
1
NIL
HORIZONTAL
BUTTON
70
16
125
49
NIL
go
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
0
SLIDER
8
190
41
340
h
h
0
1
0.095
0.005
1
NIL
VERTICAL
SLIDER
55
191
88
341
a
a
0
1
0.2
0.005
1
NIL
VERTICAL
SLIDER
105
190
138
340
b
b
0
a
0.025
0.005
1
NIL
VERTICAL
INPUTBOX
143
283
193
343
T
5.0
1
0
Number
PLOT
907
16
1873
729
plot
time (ticks)
nodes
0.0
25.0
0.0
100.0
true
true
"" ""
PENS
"susceptible" 1.0 0 -10899396 true "" "plot count turtles with [susceptible?]"
"infectious" 1.0 0 -955883 true "" "plot count turtles with [infectious?]"
"attacked" 1.0 0 -2674135 true "" "plot count turtles with [attacked?]"
"effected" 1.0 0 -7500403 true "" "plot count turtles with [antivirus1? or antivirus2?]"
"disconnected" 1.0 0 -16777216 true "" "plot count turtles with [count link-neighbors = 0]"
MONITOR
675
694
750
739
Susceptible
count turtles with [susceptible?]
17
1
11
MONITOR
637
746
706
791
Infectious
count turtles with [infectious?]
17
1
11
MONITOR
717
748
780
793
Attacked
count turtles with [attacked?]
17
1
11
SWITCH
6
738
111
771
auto-rewire
auto-rewire
0
1
-1000
SLIDER
119
738
281
771
auto-rewire-probability
auto-rewire-probability
0
1
0.35
0.05
1
NIL
HORIZONTAL
SWITCH
7
676
99
709
auto-cut
auto-cut
0
1
-1000
SLIDER
106