-
Notifications
You must be signed in to change notification settings - Fork 2
/
good queries.txt
158 lines (134 loc) · 9.09 KB
/
good queries.txt
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
# good queries for T model
; finding workers
show [ location-type ] of activity-types
;shows all the jobs and the other activites, too. To get the jobs only, go to
show [ location-type ] of activity-types with [ is-job? ]
; number of jobs
[ list who count activity-link-neighbors with [ [ is-job? ] of my-activity-type ] ] of citizens
sum [ count activity-link-neighbors with [ [ is-job? ] of my-activity-type ] ] of citizens
; people without a job
citizens with [ not any? activity-link-neighbors with [ [ is-job? ] of my-activity-type ] ]
ask citizens with [ [ is-job? and location-type = "propaganda place" ] of [ my-activity-type ] of current-activity ] [ show [value] of link-with one-of topics with [ topic-name = "Institutional distrust" ]]
; recruiters
show reverse sort [ hours-with-recruiter ] of citizens
show [(list who risk hours-with-recruiter)] of [citizens-here] of citizen 6322
ask citizen 6322 [socialize-and-recruit]
show sort-by [ [a b] -> item 2 a > item 2 b] [(list who risk hours-with-recruiter)] of [citizens-here] of citizen 6322
; schedule
; remember that free time has starting time nobody
my starting and ending times
[ [ start-time duration ] of my-activity-type ] of activity-link-neighbors ] of citizens
; is hour 6 occupied for citizen 1730?
ask citizen 1730 [ show any? activity-link-neighbors with [ [ start-time <= 6 and start-time + duration <= 6 ] of my-activity-type ] ]
ask citizen 1730 [ show any? activity-link-neighbors with [ [ start-time != nobody and start-time <= 6 and start-time + duration <= 6 ] of my-activity-type ] ]
; all tasks
show remove-duplicates [ current-task ] of citizens
; all activities
[ [ [ location-type ] of my-activity-type ] of activity-link-neighbors ] of citizens
[ current-task ] of citizens
; homeless people?
any? citizens with [ not member? "residence" [ [ location-type ] of my-activity-type ] of activity-link-neighbors ]
; activities starting at midnight
citizens with [ [ [ start-time ] of my-activity-type = 0 ] of activity-link-neighbors ]
show any? citizens with [ not member? "residence" [ [ location-type ] of my-activity-type ] of activity-link-neighbors with [ [ not is-job? and not is-mandatory? ] of my-activity-type ] ]
; citizens who go at home just to sleep
[who ] of citizens with [ not member? "residence" [ [ location-type ] of my-activity-type ] of activity-link-neighbors with [ [ not is-mandatory? ] of my-activity-type ] ]
; community centers
; all the related activities.
show activities with [ [ is-job? and location-type = "community center" ] of my-activity-type ]
; who is working there? (list of community workers)
show [ who ] of turtle-set [ activity-link-neighbors ] of activities with [ [ is-job? and location-type = "community center" ] of my-activity-type ]
; are they fulfilled?
all? activities with [ [ is-job? and location-type = "community center" ] of my-activity-type ] [ any? activity-link-neighbors ]
; what other jobs the community workers have?
[ [ [ list is-job? location-type ] of my-activity-type ] of activity-link-neighbors ] of (turtle-set ([ activity-link-neighbors ] of activities with [ [ is-job? and location-type = "community center" ] of my-activity-type ]))
# people at the community centrs
count citizens with [ [ shape ] of locations-here = [ "community center" ] ]
; workplaces
; are the people in the workplace working?
all? ( citizens with [any? location-here with [ shape = "workplace"] ] ) [ [ [ location-shape ] of my-activity-type ] of current-activty = "workplace"]
; citizens registered to work
citizens with [ any? activity-link-neighbors with [ [ is-job? ] of my-activity-type ] ]
; citizen registed to work in places (note that one person could work in two places at some point)
[ list count activity-link-neighbors [ location-type ] of my-activity-type ] of activities with [ [ is-job? ] of my-activity-type ]
; what are they doing now (jobs)?
[ list location-type count citizens with [ [ my-activity-type ] of current-activity = myself ] ] of activity-types with [ is-job? ]
; what are they doing now (all)?
reduce sentence [ (list location-type "job" count citizens with [ [ my-activity-type ] of current-activity = myself ]) ] of activity-types with [ is-job? ]
; what are people doing?
show [ location-type ] of [ my-activity-type ] of [current-activity ] of citizen 1927
; note that all citizens have a current activity because nobodies are eliminated right into the go.
; the following gives you the community workers IF it is work time
show citizens with [ [ is-job? and location-type = "community center" ] of [ my-activity-type ] of current-activity ]
; while these are lazy people wasting time at the community centers
show citizens with [ [ not is-job? and location-type = "community center" ] of [ my-activity-type ] of current-activity ]
; what do they think about fundamentalism?
show mean [ value ] of link-set [ out-topic-link-to ( one-of topics with [ topic-name = "Institutional distrust" ]) ] of citizens
; what about a specific place? Let's find one specific community worker
let undercover-cop one-of [ activity-link-neighbors ] of activities with [ [ is-job? and location-type = "community center" ] of my-activity-type ]
; this should give the same
let undercover-cop one-of citizens with [ [ is-job? and location-type = "community center" ] of [ my-activity-type ] of current-activity ]
; where is he?
[ [ shape ] of locations-here ] of one-of citizens with [ [ is-job? and location-type = "community center" ] of [ my-activity-type ] of current-activity ]
; is it a community center?
[ shape ] of [ location-here ] of undercover-cop = "community center"
; who else is there?
show [other citizens-here] of undercover-cop
; all place kinds and people in them
[ (list location-type is-job? is-mandatory? count citizens with [ (one-of [ shape ] of locations-here) = [ location-type ] of myself ] ) ] of activity-types
; kids in school
; in school now
count citizens with [ [ shape ] of locations-here = [ "school" ] and age > 21 ]
; bad schools
schools with [ any? school-attendance-link-neighbors with [ education-level != [ education-level ] of myself - 1 ] ]
; all people should be in appropriate schools
all? persons [ not any? school-attendance-link-neighbors or education-level = ([ education-level ] of one-of school-attendance-link-neighbors) - 1 ]
; setup of imams
; the imams prepared at the beginning
[ who ] of citizens with [ [ value ] of out-topic-link-to ( one-of topics with [ topic-name = "Institutional distrust" ]) = 1 ]
; list of imams
[ who ] of (turtle-set [ activity-link-neighbors ] of activities with [ [ is-job? and location-type = "mosque" ] of my-activity-type ])
; what are the imams doing? Are they working?
[ list [ shape ] of locations-here workday? ] of (turtle-set [ activity-link-neighbors ] of activities with [ [ is-job? and location-type = "mosque" ] of my-activity-type ])
; activities of imams
[ [ list is-job? location-type ] of my-activity-type ] of turtle-set [ activity-link-neighbors ] of (turtle-set [ activity-link-neighbors ] of activities with [ [ is-job? and location-type = "mosque" ] of my-activity-type ])
; imams with two jobs
(turtle-set [ activity-link-neighbors ] of activities with [ [ is-job? and location-type = "mosque" ] of my-activity-type ]) with [ count activity-link-neighbors with [ [ is-job? ] of my-activity-type ] > 1 ]
# opinions of all potential imams
[ [ value ] of out-topic-link-to one-of topics with [ topic-name = "Institutional distrust" ] ] of citizens with [ runresult [ -> age >= 21 and get "muslim?" and get "male?"] ]
# are radical imams unwavering in their faith?
ask citizens with [ [ is-job? and location-type = "radical mosque" ] of [ my-activity-type ] of current-activity ] [ show [value] of link-with one-of topics with [ topic-name = "Institutional distrust" ]]
; the mosques
all? activities with [ [ is-job? and location-type = "mosque" ] of my-activity-type ] [ any? activity-link-neighbors ]
; people at the mosques
count citizens with [ [ shape ] of locations-here = [ "mosque" ] ]
-----
to-report imamsatwork
let a mean [ value ] of link-set [
out-topic-link-to ( one-of topics with [ topic-name = "Institutional distrust" ])
] of (citizens-on locations with [ shape = "mosque"]) with [
[ not (is-job? and location-type = "mosque") ] of [ my-activity-type ] of current-activity
]
repeat 100 [
ask citizens with [
[ is-job? and location-type = "mosque" ] of [ my-activity-type ] of current-activity
] [ preach ] ]
let b mean [ value ] of link-set [
out-topic-link-to ( one-of topics with [ topic-name = "Institutional distrust" ])
] of (citizens-on locations with [ shape = "mosque"]) with [
[ not (is-job? and location-type = "mosque") ] of [ my-activity-type ] of current-activity
]
report b - a
end
to runit
setup
repeat 10 [ go ]
while [ imamsatwork > 0
]
[
repeat 24 [go]
]
show "ended"
end
set total-citizens 10000 set community-side-length 100 reset-timer repeat 10 [setup show "ping" show timer]
set total-citizens 400 reset-timer foreach (range 30 50) [ l -> set community-side-length l setup show "ping" show timer] show "end"