-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRnetlogo_Ubuntu_cluster.R
93 lines (78 loc) · 4.23 KB
/
Rnetlogo_Ubuntu_cluster.R
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
### RNetlogo Package ###
# --Linux Version--#
library(RNetLogo)
library(doParallel)
nl.path <- "/usr/local/Cluster-Apps/netlogo/6.0.4/app"
NLStart(nl.path, gui=F, nl.obj=NULL, is3d=FALSE, nl.jarname='netlogo-6.0.4.jar')
model.path <- "/home/hs621/github/jasss/Gangnam_v6_macro.nlogo"
NLLoadModel(model.path)
new.col.names <- c( "riskpop", "d_sinsa", "d_nonhyun1", "d_nonhyun2",
"d_samsung1", "d_samsung2","d_daechi1","d_daechi4","d_yeoksam1",
"d_yeoksam2","d_dogok1","d_dogok2","d_gaepo1","d_gaepo4",
"d_ilwon","d_ilwon1","d_ilwon2","d_suseo", "d_ap","d_chungdam",
"d_daechi2","d_gaepo2","d_segok",
"a_u15","a_btw1564","a_ov65","e_high","e_low")
init <- Sys.time()
foreach (i = 1:50) %dopar% {
NLCommand("setup")
NLCommand (paste('set AC', 100))
NLCommand (paste('set Scenario', '"BAU"'))
NLCommand (paste('set scenario-percent', '"inc-sce"'))
NLCommand (paste('set PM10-parameters', 100))
simulation <- paste("model100",i, sep = ".")
assign(simulation, NLDoReportWhile("ticks < 8764" , "go",
c("%riskpop", "d_sinsa", "d_nonhyun1", "d_nonhyun2",
"d_samsung1", "d_samsung2","d_daechi1","d_daechi4","d_yeoksam1",
"d_yeoksam2","d_dogok1","d_dogok2","d_gaepo1","d_gaepo4",
"d_ilwon","d_ilwon1","d_ilwon2","d_suseo", "d_ap","d_chungdam",
"d_daechi2","d_gaepo2","d_segok",
"a_u15","a_btw1564","a_ov65","e_high","e_low"), df.col.names= new.col.names,as.data.frame = T, max.minutes=150)
)
h <- paste("health100",i, sep = ".")
assign(h, NLGetAgentSet(c("who", "homename", "destinationName", "age", "health"), "people"))
}
Sys.time() - init
init <- Sys.time()
foreach (i = 1:50) %dopar% {
NLCommand("setup")
NLCommand (paste('set AC', 150))
NLCommand (paste('set Scenario', '"BAU"'))
NLCommand (paste('set scenario-percent', '"inc-sce"'))
NLCommand (paste('set PM10-parameters', 100))
simulation <- paste("model100",i, sep = ".")
assign(simulation, NLDoReportWhile("ticks < 8764" , "go",
c("%riskpop", "d_sinsa", "d_nonhyun1", "d_nonhyun2",
"d_samsung1", "d_samsung2","d_daechi1","d_daechi4","d_yeoksam1",
"d_yeoksam2","d_dogok1","d_dogok2","d_gaepo1","d_gaepo4",
"d_ilwon","d_ilwon1","d_ilwon2","d_suseo", "d_ap","d_chungdam",
"d_daechi2","d_gaepo2","d_segok",
"a_u15","a_btw1564","a_ov65","e_high","e_low"), df.col.names= new.col.names,as.data.frame = T, max.minutes=150)
)
h <- paste("health100",i, sep = ".")
assign(h, NLGetAgentSet(c("who", "homename", "destinationName", "age", "health"), "people"))
}
Sys.time() - init
init <- Sys.time()
foreach (i = 1:50) %dopar% {
NLCommand("setup")
NLCommand (paste('set AC', 200))
NLCommand (paste('set Scenario', '"BAU"'))
NLCommand (paste('set scenario-percent', '"inc-sce"'))
NLCommand (paste('set PM10-parameters', 100))
simulation <- paste("model100",i, sep = ".")
assign(simulation, NLDoReportWhile("ticks < 8764" , "go",
c("%riskpop", "d_sinsa", "d_nonhyun1", "d_nonhyun2",
"d_samsung1", "d_samsung2","d_daechi1","d_daechi4","d_yeoksam1",
"d_yeoksam2","d_dogok1","d_dogok2","d_gaepo1","d_gaepo4",
"d_ilwon","d_ilwon1","d_ilwon2","d_suseo", "d_ap","d_chungdam",
"d_daechi2","d_gaepo2","d_segok",
"a_u15","a_btw1564","a_ov65","e_high","e_low"), df.col.names= new.col.names,as.data.frame = T, max.minutes=150)
)
h <- paste("health100",i, sep = ".")
assign(h, NLGetAgentSet(c("who", "homename", "destinationName", "age", "health"), "people"))
}
Sys.time() - init
#######################################
#
save.image(file = "/home/hs621/github/jasss/cluster.Rdata")
stopCluster(cl)