aboutsummaryrefslogtreecommitdiffstats
path: root/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend
diff options
context:
space:
mode:
authorLibravatar ArenBabikian <aren.babikian@mail.mcgill.ca>2020-05-17 01:58:13 -0400
committerLibravatar ArenBabikian <aren.babikian@mail.mcgill.ca>2020-05-17 01:58:13 -0400
commit48871e1be75169e4e3768a7c0c47791e02c7e634 (patch)
treecfcd4e4fdc0dea4f4b0102a610459ed7509f47f8 /Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend
parentAdjust Taxation model. (diff)
downloadVIATRA-Generator-48871e1be75169e4e3768a7c0c47791e02c7e634.tar.gz
VIATRA-Generator-48871e1be75169e4e3768a7c0c47791e02c7e634.tar.zst
VIATRA-Generator-48871e1be75169e4e3768a7c0c47791e02c7e634.zip
update measurements setup. make archives.
Diffstat (limited to 'Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend')
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend61
1 files changed, 33 insertions, 28 deletions
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend
index 98bf7c83..c84f55d3 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend
+++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend
@@ -12,6 +12,7 @@ import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.RuntimeEn
12import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ScopeSpecification 12import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ScopeSpecification
13import hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor 13import hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor
14import hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor 14import hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor
15import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace
15import java.text.SimpleDateFormat 16import java.text.SimpleDateFormat
16import java.util.Date 17import java.util.Date
17import org.apache.commons.cli.BasicParser 18import org.apache.commons.cli.BasicParser
@@ -22,6 +23,8 @@ import org.apache.commons.cli.Option
22import org.apache.commons.cli.Options 23import org.apache.commons.cli.Options
23import org.apache.commons.cli.ParseException 24import org.apache.commons.cli.ParseException
24import org.eclipse.core.runtime.NullProgressMonitor 25import org.eclipse.core.runtime.NullProgressMonitor
26import org.eclipse.emf.ecore.resource.Resource
27import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
25 28
26class RunGeneratorConfig { 29class RunGeneratorConfig {
27 static var SIZE_LB = 20 30 static var SIZE_LB = 20
@@ -29,9 +32,10 @@ class RunGeneratorConfig {
29 static var HOUSEHOLD = 0 32 static var HOUSEHOLD = 0
30 33
31 static var RUNS = 10 34 static var RUNS = 10
32 static var RUNTIME = 900 35 static var MODELS = 10
36 static var RUNTIME = 1500
33 37
34 static var DOMAIN = "FamilyTree" // "FamilyTree", "Taxation", "Satellite" 38 static var DOMAIN = "FamilyTree" // "FamilyTree", "Satellite", "Taxation"
35 static val QUERIES = true 39 static val QUERIES = true
36 static val INITIAL = true 40 static val INITIAL = true
37 41
@@ -39,7 +43,7 @@ class RunGeneratorConfig {
39// Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("xmi", new XMIResourceFactoryImpl) 43// Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("xmi", new XMIResourceFactoryImpl)
40// val workspace = new FileSystemWorkspace('''x/''', "") 44// val workspace = new FileSystemWorkspace('''x/''', "")
41// workspace.initAndClear 45// workspace.initAndClear
42 46
43 val options = new Options() 47 val options = new Options()
44 48
45 val lb = new Option("lb", "lowerBound", true, "generated model Lower bound") 49 val lb = new Option("lb", "lowerBound", true, "generated model Lower bound")
@@ -48,8 +52,11 @@ class RunGeneratorConfig {
48 val ub = new Option("ub", "upperBound", true, "generated model Upper bound") 52 val ub = new Option("ub", "upperBound", true, "generated model Upper bound")
49 options.addOption(ub) 53 options.addOption(ub)
50 54
51 val n = new Option("n", "numRuns", true, "number of runs") 55 val nr = new Option("nr", "numRuns", true, "number of runs")
52 options.addOption(n) 56 options.addOption(nr)
57
58 val nm = new Option("nm", "numModels", true, "number of models")
59 options.addOption(nm)
53 60
54 val rt = new Option("rt", "runtime", true, "runtime limit") 61 val rt = new Option("rt", "runtime", true, "runtime limit")
55 options.addOption(rt) 62 options.addOption(rt)
@@ -76,8 +83,10 @@ class RunGeneratorConfig {
76 if(lbIn !== null) SIZE_LB = Integer.parseInt(lbIn) 83 if(lbIn !== null) SIZE_LB = Integer.parseInt(lbIn)
77 val ubIn = cmd.getOptionValue("upperBound") 84 val ubIn = cmd.getOptionValue("upperBound")
78 if(ubIn !== null) SIZE_UB = Integer.parseInt(ubIn) 85 if(ubIn !== null) SIZE_UB = Integer.parseInt(ubIn)
79 val nIn = cmd.getOptionValue("numRuns") 86 val nrIn = cmd.getOptionValue("numRuns")
80 if(nIn !== null) RUNS = Integer.parseInt(nIn) 87 if(nrIn !== null) RUNS = Integer.parseInt(nrIn)
88 val nmIn = cmd.getOptionValue("numModels")
89 if(nmIn !== null) MODELS = Integer.parseInt(nmIn)
81 val rtIn = cmd.getOptionValue("runtime") 90 val rtIn = cmd.getOptionValue("runtime")
82 if(rtIn !== null) RUNTIME = Integer.parseInt(rtIn) 91 if(rtIn !== null) RUNTIME = Integer.parseInt(rtIn)
83 val dIn = cmd.getOptionValue("domain") 92 val dIn = cmd.getOptionValue("domain")
@@ -85,6 +94,7 @@ class RunGeneratorConfig {
85 val hhIn = cmd.getOptionValue("household") 94 val hhIn = cmd.getOptionValue("household")
86 if(hhIn !== null) HOUSEHOLD = Integer.parseInt(hhIn) 95 if(hhIn !== null) HOUSEHOLD = Integer.parseInt(hhIn)
87 96
97 val isTaxation = DOMAIN == "Taxation"
88 // Workspace setup 98 // Workspace setup
89 val Date date = new Date(System.currentTimeMillis) 99 val Date date = new Date(System.currentTimeMillis)
90 val SimpleDateFormat format = new SimpleDateFormat("dd-HHmm") 100 val SimpleDateFormat format = new SimpleDateFormat("dd-HHmm")
@@ -97,27 +107,23 @@ class RunGeneratorConfig {
97 // ///////////////////////// 107 // /////////////////////////
98 // BEGIN RUN 108 // BEGIN RUN
99 println( 109 println(
100 "<<DOMAIN: " + DOMAIN + ", SIZE=" + SIZE_LB + "to" + SIZE_UB + ", Runs=" + RUNS + ", Runtime=" + RUNTIME + 110 "<<DOMAIN: " + DOMAIN + ", SIZE=" + SIZE_LB + "to" + SIZE_UB + ", Runs=" + RUNS + ", ModelsPerRun=" +
101 ">>") 111 MODELS + ", Runtime=" + RUNTIME + ">>")
102 if (DOMAIN == "TaxationWithRoot") { 112 if (isTaxation) println("<<Households: " + HOUSEHOLD + ">>")
103 println("<<Households: " + HOUSEHOLD + ">>") 113
104 } 114 var naming = DOMAIN + "/size" + toStr(SIZE_LB) + "to" + toStr(SIZE_UB) + "r" + RUNS + "n" + MODELS + "rt" + RUNTIME
105 115 if (isTaxation) naming = naming + "hh" + HOUSEHOLD
106
107
108 val naming = DOMAIN + "/size" + toStr(SIZE_LB) + "to" + toStr(SIZE_UB) + "x" + RUNS
109
110 val outputPath = "measurements/" + "models/" + naming + "_" + formattedDate 116 val outputPath = "measurements/" + "models/" + naming + "_" + formattedDate
111 val debugPath = "measurements/" + "debug/" + naming + "_" + formattedDate 117 val debugPath = "measurements/" + "debug/" + naming + "_" + formattedDate
112 val logPath = debugPath + "/log.txt" 118 val logPath = debugPath + "/log.txt"
113 val statsPath = "measurements/" + "stats/" + naming + 119 val statsPath = "measurements/" + "stats/" + naming + "stats_" + formattedDate + ".csv"
114 "stats_" + formattedDate + ".csv"
115 120
116 // Basic Adjustments 121 // Basic Adjustments
117 val genTask = config.commands.get(1) as GenerationTask 122 val genTask = config.commands.get(1) as GenerationTask
118 if(!QUERIES) genTask.patterns = null 123 if(!QUERIES) genTask.patterns = null
119 if(!INITIAL) genTask.partialModel = null 124 if(!INITIAL) genTask.partialModel = null
120 genTask.runs = RUNS 125 genTask.runs = RUNS
126 genTask.number = MODELS
121 127
122 // Size 128 // Size
123 val scopeSpec = genTask.scope as ScopeSpecification 129 val scopeSpec = genTask.scope as ScopeSpecification
@@ -130,20 +136,19 @@ class RunGeneratorConfig {
130 interval.maxUnlimited = false 136 interval.maxUnlimited = false
131 interval.maxNumber = SIZE_UB 137 interval.maxNumber = SIZE_UB
132 } 138 }
133// workspace.writeModel(config, '''x.xmi''')
134
135
136 139
137 if (DOMAIN == "TaxationWithRoot") { 140 if (isTaxation) {
138 if (HOUSEHOLD > 0) { 141 if (HOUSEHOLD > 0) {
139 val pms = genTask.partialModel as PartialModelSpecification 142 val pms = genTask.partialModel as PartialModelSpecification
140 val me = pms.entry.get(0) as ModelEntry 143 val me = pms.entry.get(0) as ModelEntry
141 val fs = me.path as FileSpecification 144 val fs = me.path as FileSpecification
142 fs.path = "inputs/Resource" + HOUSEHOLD + "hh.xmi" 145 fs.path = "inputs/Resource" + HOUSEHOLD + "hh.xmi"
143 println("<<Using " + fs.path + " as initial model>>") 146 println("<<Using " + fs.path + " as initial model>>")
144 } 147 } else {
148 scopeSpec.scopes.remove(1)
149 }
145 } 150 }
146 151// workspace.writeModel(config, '''x.xmi''')
147 // Runtime 152 // Runtime
148 val configScope = genTask.config as ConfigSpecification 153 val configScope = genTask.config as ConfigSpecification
149 val runtimeEntry = configScope.entries.get(0) as RuntimeEntry 154 val runtimeEntry = configScope.entries.get(0) as RuntimeEntry
@@ -165,11 +170,11 @@ class RunGeneratorConfig {
165 170
166 println() 171 println()
167 } 172 }
168 173
169 static def String toStr(int i) { 174 static def String toStr(int i) {
170 var toAdd = "" 175 var toAdd = ""
171 if(i<100 && i != -1) toAdd = "0" 176 if(i < 100 && i != -1) toAdd = "0"
172 return toAdd+i 177 return toAdd + i
173 } 178 }
174 179
175} 180}