diff options
Diffstat (limited to 'Tests/MODELS2020-CaseStudies/case.study.pledge.run/src')
-rw-r--r-- | Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend | 62 |
1 files changed, 49 insertions, 13 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 c1925786..01f74f29 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 | |||
@@ -1,7 +1,9 @@ | |||
1 | package run | 1 | package run |
2 | 2 | ||
3 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ClassTypeScope | ||
3 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigSpecification | 4 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigSpecification |
4 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript | 5 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript |
6 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ExactNumber | ||
5 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.FileSpecification | 7 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.FileSpecification |
6 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.GenerationTask | 8 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.GenerationTask |
7 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.IntervallNumber | 9 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.IntervallNumber |
@@ -10,8 +12,10 @@ import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.RuntimeEn | |||
10 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ScopeSpecification | 12 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ScopeSpecification |
11 | import hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor | 13 | import hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor |
12 | import hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor | 14 | import hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor |
15 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace | ||
13 | import java.text.SimpleDateFormat | 16 | import java.text.SimpleDateFormat |
14 | import java.util.Date | 17 | import java.util.Date |
18 | import org.apache.commons.cli.BasicParser | ||
15 | import org.apache.commons.cli.CommandLine | 19 | import org.apache.commons.cli.CommandLine |
16 | import org.apache.commons.cli.CommandLineParser | 20 | import org.apache.commons.cli.CommandLineParser |
17 | import org.apache.commons.cli.HelpFormatter | 21 | import org.apache.commons.cli.HelpFormatter |
@@ -19,26 +23,27 @@ import org.apache.commons.cli.Option | |||
19 | import org.apache.commons.cli.Options | 23 | import org.apache.commons.cli.Options |
20 | import org.apache.commons.cli.ParseException | 24 | import org.apache.commons.cli.ParseException |
21 | import org.eclipse.core.runtime.NullProgressMonitor | 25 | import org.eclipse.core.runtime.NullProgressMonitor |
22 | import org.apache.commons.cli.BasicParser | 26 | import org.eclipse.emf.ecore.resource.Resource |
27 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | ||
23 | 28 | ||
24 | class RunGeneratorConfig { | 29 | class RunGeneratorConfig { |
25 | static var SIZE_LB = 20 | 30 | static var SIZE_LB = 20 |
26 | static var SIZE_UB = -1 | 31 | static var SIZE_UB = -1 |
32 | static var HOUSEHOLD = -1 | ||
27 | 33 | ||
28 | static var RUNS = 10 | 34 | static var RUNS = 10 |
29 | static var RUNTIME = 600 | 35 | static var RUNTIME = 900 |
30 | 36 | ||
31 | static var DOMAIN = "FamilyTree" // "FamilyTree", "Taxation", "Satellite" | 37 | static var DOMAIN = "FamilyTree" // "FamilyTree", "Taxation", "Satellite" |
32 | static val QUERIES = true | 38 | static val QUERIES = true |
33 | static val INITIAL = true | 39 | static val INITIAL = true |
34 | 40 | ||
35 | def static void main(String[] args) { | 41 | def static void main(String[] args) { |
36 | |||
37 | val options = new Options() | 42 | val options = new Options() |
38 | 43 | ||
39 | val lb = new Option("lb", "lowerBound", true, "generated model Lower bound") | 44 | val lb = new Option("lb", "lowerBound", true, "generated model Lower bound") |
40 | options.addOption(lb) | 45 | options.addOption(lb) |
41 | 46 | ||
42 | val ub = new Option("ub", "upperBound", true, "generated model Upper bound") | 47 | val ub = new Option("ub", "upperBound", true, "generated model Upper bound") |
43 | options.addOption(ub) | 48 | options.addOption(ub) |
44 | 49 | ||
@@ -50,7 +55,10 @@ class RunGeneratorConfig { | |||
50 | 55 | ||
51 | val d = new Option("d", "domain", true, "domain") | 56 | val d = new Option("d", "domain", true, "domain") |
52 | options.addOption(d) | 57 | options.addOption(d) |
53 | 58 | ||
59 | val hh = new Option("hh", "household", true, "number of households") | ||
60 | options.addOption(hh) | ||
61 | |||
54 | val CommandLineParser parser = new BasicParser | 62 | val CommandLineParser parser = new BasicParser |
55 | val formatter = new HelpFormatter() | 63 | val formatter = new HelpFormatter() |
56 | var CommandLine cmd | 64 | var CommandLine cmd |
@@ -62,7 +70,7 @@ class RunGeneratorConfig { | |||
62 | formatter.printHelp("utility-name", options) | 70 | formatter.printHelp("utility-name", options) |
63 | System.exit(1) | 71 | System.exit(1) |
64 | } | 72 | } |
65 | 73 | ||
66 | val lbIn = cmd.getOptionValue("lowerBound") | 74 | val lbIn = cmd.getOptionValue("lowerBound") |
67 | if(lbIn !== null) SIZE_LB = Integer.parseInt(lbIn) | 75 | if(lbIn !== null) SIZE_LB = Integer.parseInt(lbIn) |
68 | val ubIn = cmd.getOptionValue("upperBound") | 76 | val ubIn = cmd.getOptionValue("upperBound") |
@@ -73,7 +81,9 @@ class RunGeneratorConfig { | |||
73 | if(rtIn !== null) RUNTIME = Integer.parseInt(rtIn) | 81 | if(rtIn !== null) RUNTIME = Integer.parseInt(rtIn) |
74 | val dIn = cmd.getOptionValue("domain") | 82 | val dIn = cmd.getOptionValue("domain") |
75 | if(dIn !== null) DOMAIN = dIn | 83 | if(dIn !== null) DOMAIN = dIn |
76 | 84 | val hhIn = cmd.getOptionValue("household") | |
85 | if(hhIn !== null) HOUSEHOLD = Integer.parseInt(hhIn) | ||
86 | |||
77 | // Workspace setup | 87 | // Workspace setup |
78 | val Date date = new Date(System.currentTimeMillis) | 88 | val Date date = new Date(System.currentTimeMillis) |
79 | val SimpleDateFormat format = new SimpleDateFormat("dd-HHmm") | 89 | val SimpleDateFormat format = new SimpleDateFormat("dd-HHmm") |
@@ -85,12 +95,21 @@ class RunGeneratorConfig { | |||
85 | 95 | ||
86 | // ///////////////////////// | 96 | // ///////////////////////// |
87 | // BEGIN RUN | 97 | // BEGIN RUN |
88 | println("<<DOMAIN: " + DOMAIN + ", SIZE=" + SIZE_LB + "to" + SIZE_UB + ", Runs=" + RUNS + ", Runtime=" + RUNTIME+">>\n") | 98 | println( |
89 | 99 | "<<DOMAIN: " + DOMAIN + ", SIZE=" + SIZE_LB + "to" + SIZE_UB + ", Runs=" + RUNS + ", Runtime=" + RUNTIME + | |
90 | val outputPath = "measurements/" + "models/"+ DOMAIN + "/size" + SIZE_LB + "to" + SIZE_UB + "_" + formattedDate | 100 | ">>") |
91 | val debugPath = "measurements/" + "debug/" + DOMAIN + "/size" + SIZE_LB + "to" + SIZE_UB + "_" + formattedDate | 101 | if (DOMAIN == "TaxationWithRoot") { |
102 | println("<<Households: " + HOUSEHOLD + ">>") | ||
103 | } | ||
104 | println() | ||
105 | |||
106 | val naming = DOMAIN + "/size" + toStr(SIZE_LB) + "to" + toStr(SIZE_UB) + "x" + RUNS | ||
107 | |||
108 | val outputPath = "measurements/" + "models/" + naming + "_" + formattedDate | ||
109 | val debugPath = "measurements/" + "debug/" + naming + "_" + formattedDate | ||
92 | val logPath = debugPath + "/log.txt" | 110 | val logPath = debugPath + "/log.txt" |
93 | val statsPath = "measurements/" + "stats/" + DOMAIN + "/size" + SIZE_LB + "to" + SIZE_UB + "x" + RUNS + "stats_" + formattedDate + ".csv" | 111 | val statsPath = "measurements/" + "stats/" + naming + |
112 | "stats_" + formattedDate + ".csv" | ||
94 | 113 | ||
95 | // Basic Adjustments | 114 | // Basic Adjustments |
96 | val genTask = config.commands.get(1) as GenerationTask | 115 | val genTask = config.commands.get(1) as GenerationTask |
@@ -103,12 +122,23 @@ class RunGeneratorConfig { | |||
103 | val objScope = scopeSpec.scopes.get(0) as ObjectTypeScope | 122 | val objScope = scopeSpec.scopes.get(0) as ObjectTypeScope |
104 | val interval = objScope.number as IntervallNumber | 123 | val interval = objScope.number as IntervallNumber |
105 | interval.min = SIZE_LB | 124 | interval.min = SIZE_LB |
106 | if(SIZE_UB == -1) interval.maxUnlimited = true | 125 | if (SIZE_UB == -1) |
126 | interval.maxUnlimited = true | ||
107 | else { | 127 | else { |
108 | interval.maxUnlimited = false | 128 | interval.maxUnlimited = false |
109 | interval.maxNumber = SIZE_UB | 129 | interval.maxNumber = SIZE_UB |
110 | } | 130 | } |
111 | 131 | ||
132 | if (DOMAIN == "TaxationWithRoot") { | ||
133 | if (HOUSEHOLD == -1) { | ||
134 | scopeSpec.scopes.remove(1) | ||
135 | } else { | ||
136 | val clsScope = scopeSpec.scopes.get(1) as ClassTypeScope | ||
137 | val num = clsScope.number as ExactNumber | ||
138 | num.exactNumber = HOUSEHOLD | ||
139 | } | ||
140 | } | ||
141 | |||
112 | // Runtime | 142 | // Runtime |
113 | val configScope = genTask.config as ConfigSpecification | 143 | val configScope = genTask.config as ConfigSpecification |
114 | val runtimeEntry = configScope.entries.get(0) as RuntimeEntry | 144 | val runtimeEntry = configScope.entries.get(0) as RuntimeEntry |
@@ -129,5 +159,11 @@ class RunGeneratorConfig { | |||
129 | 159 | ||
130 | println() | 160 | println() |
131 | } | 161 | } |
162 | |||
163 | static def String toStr(int i) { | ||
164 | var toAdd = "" | ||
165 | if(i<100 && i != -1) toAdd = "0" | ||
166 | return toAdd+i | ||
167 | } | ||
132 | 168 | ||
133 | } | 169 | } |