-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot.nls
More file actions
113 lines (87 loc) · 4.01 KB
/
plot.nls
File metadata and controls
113 lines (87 loc) · 4.01 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
;;SIMULATOR: VERSION 1
to writetoFile
if (iterationCounter = total-number-of-turns / number-of-agents)
[
if (write-matrix?)
[
write-matrix
]
if (write-payoff?)
[
writeData
]
if (write-numofLikesPerTag?)
[
write-numofLikesPerTag
]
if (write-numofLikesPerDoc?)
[
write-numofLikesPerDoc
]
if (write-numofFollowersPerPeer?)
[
write-numofFollowersPerPeer
]
]
end
to write-Matrix
file-open (word directory-of-results "-" the-random-seed "-" "follow-Matrix-" (total-number-of-turns / 60) ".csv")
let matrix-list []
;create a CSV value version o
let rowCount 0
let colCount 0
let val 0
file-type "Source " file-type ", " file-type "Target " file-type "\n"
repeat number-of-agents [
repeat number-of-documents [
set val matrix:get like-matrix rowCount colCount
if (val = 1)
[file-type rowCount + 1 file-type ", " file-type number-of-agents + colCount + 1 file-type "\n" ]
;file-type val file-type ", "
set colCount (colCount + 1) mod number-of-documents
]
set rowCount rowCount + 1
;file-type "\n"
]
file-close
end
to write-consumerProducer-payoff
file-open (word directory-of-results "-" the-random-seed "-" "payoff.csv")
file-type mean [score] of turtles with [not document? and turtleType = "consumer" ] file-type " , "
file-type mean [point] of turtles with [not document? and turtleType = "producer" ] file-type "\n "
file-close
end
to write-consumers-payoff[ breed1 taste1 breed2 taste2 ]
file-open (word directory-of-results "-" the-random-seed "-" "payoff.csv")
file-type mean [score] of turtles with [not document? and breed = breed1 and tags = taste1 and turtleType = "consumer" ] file-type " , "
file-type mean [score] of turtles with [not document? and breed = breed2 and tags = taste2 and turtleType = "consumer" ] file-type "\n "
file-close
end
to write-numofLikesPerTag
file-open (word directory-of-results "-" the-random-seed "-" "numOfLikesPerTag.csv")
file-type (count connect-links with [member? end2 documents = true and [tags] of end2 = [1]] / 200) file-type " , "
file-type (count connect-links with [member? end2 documents = true and [tags] of end2 = [0]] / 200) file-type "\n "
file-close
end
to write-numofFollowersPerTag
file-open (word directory-of-results "-" the-random-seed "-" "numofFollowersPerTag.csv")
file-type (count connect-links with [member? end2 documents = false and [tags] of end2 = [1]] / 200) file-type " , "
file-type (count connect-links with [member? end2 documents = false and [tags] of end2 = [0]] / 200) file-type "\n "
file-close
end
to write-numofLikesPerDoc
file-open (word directory-of-results "-" the-random-seed "-" "numOflikesPerDoc-" (total-number-of-turns / 60) ".csv")
let turtleCount 0
repeat number-of-documents [
set turtleCount turtleCount + 1
ask turtle turtleCount [file-print count my-in-connect-links]]
file-close
end
to write-numofFollowersPerPeer
file-open (word directory-of-results "-" the-random-seed "-" "numofFollowersPerPeer-" (total-number-of-turns / 60) ".csv")
let turtleCount number-of-documents - 1
repeat number-of-agents [
set turtleCount turtleCount + 1
ask turtle turtleCount [file-print count my-in-connect-links]]
file-close
end