diff options
author | 2020-05-13 00:34:43 -0400 | |
---|---|---|
committer | 2020-05-13 00:34:43 -0400 | |
commit | 4d914f3a77f64dc326933921b03735d4aabd9214 (patch) | |
tree | 2d2a7374c5becd54029e872cc38960cf3ce3610b /Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/GenerateFromConfig.xtend | |
parent | Adjust FamilyTree MM. Add new Taxation MM with possible Multiple Roots (diff) | |
download | VIATRA-Generator-4d914f3a77f64dc326933921b03735d4aabd9214.tar.gz VIATRA-Generator-4d914f3a77f64dc326933921b03735d4aabd9214.tar.zst VIATRA-Generator-4d914f3a77f64dc326933921b03735d4aabd9214.zip |
Adjust measurement setup. TaxationWithRoot support. JAR creation
Diffstat (limited to 'Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/GenerateFromConfig.xtend')
-rw-r--r-- | Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/GenerateFromConfig.xtend | 125 |
1 files changed, 62 insertions, 63 deletions
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/GenerateFromConfig.xtend b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/GenerateFromConfig.xtend index 5cda1e16..ccb0d7b3 100644 --- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/GenerateFromConfig.xtend +++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/GenerateFromConfig.xtend | |||
@@ -48,15 +48,15 @@ import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | |||
48 | import org.eclipse.viatra.query.runtime.api.IQueryGroup | 48 | import org.eclipse.viatra.query.runtime.api.IQueryGroup |
49 | 49 | ||
50 | class GenerateFromConfig { | 50 | class GenerateFromConfig { |
51 | static val SIZE_LB = 20 | 51 | static val SIZE_LB = 200 |
52 | static val SIZE_UB = 20 | 52 | static val SIZE_UB = 200 |
53 | static val SIZE_MUL = 1 | 53 | static val SIZE_MUL = 1 |
54 | static val SIZE_INC = 5 | 54 | static val SIZE_INC = 5 |
55 | 55 | ||
56 | static var REPS = 5 | 56 | static var REPS = 3 |
57 | static val RUNTIME = 2100 | 57 | static val RUNTIME = 600 |
58 | 58 | ||
59 | static val DOMAIN = "Satellite" // "FamilyTree", "Taxation", "Satellite" | 59 | static val DOMAIN = "FamilyTree" // "FamilyTree", "Taxation", "Satellite" |
60 | static val QUERIES = true | 60 | static val QUERIES = true |
61 | static val INITIAL = true | 61 | static val INITIAL = true |
62 | static val INDIV_WRT = false | 62 | static val INDIV_WRT = false |
@@ -69,7 +69,7 @@ class GenerateFromConfig { | |||
69 | // Workspace setup | 69 | // Workspace setup |
70 | val Date date = new Date(System.currentTimeMillis) | 70 | val Date date = new Date(System.currentTimeMillis) |
71 | val SimpleDateFormat format = new SimpleDateFormat("dd-HHmm"); | 71 | val SimpleDateFormat format = new SimpleDateFormat("dd-HHmm"); |
72 | val formattedDate = DOMAIN + "-" + format.format(date) | 72 | val formattedDate = DOMAIN + "/" + format.format(date) |
73 | 73 | ||
74 | val workspace = new FileSystemWorkspace('''output/''' + formattedDate + '''/''', "") | 74 | val workspace = new FileSystemWorkspace('''output/''' + formattedDate + '''/''', "") |
75 | workspace.initAndClear | 75 | workspace.initAndClear |
@@ -106,60 +106,59 @@ class GenerateFromConfig { | |||
106 | } | 106 | } |
107 | 107 | ||
108 | println() | 108 | println() |
109 | println("DOMAIN: " + DOMAIN + ", SIZE=" + size) | 109 | println("<<DOMAIN: " + DOMAIN + ", SIZE=" + size + ">>") |
110 | 110 | ||
111 | for (var i = 0; i < REPS; i++) { | 111 | // for (var i = 0; i < REPS; i++) { |
112 | 112 | // | |
113 | print("<<Run number " + i + ">> : ") | 113 | // print("<<Run number " + i + ">> : ") |
114 | 114 | // ///////////////////////////////////////////////////// | |
115 | 115 | // Define Config File | |
116 | // ///////////////////////////////////////////////////// | 116 | // val knownIntegers = new ArrayList<Integer> |
117 | // Define Config File | 117 | // knownIntegers.addAll(0, 10, 20, 30, 40, 50) |
118 | val knownIntegers = new ArrayList<Integer> | 118 | // |
119 | knownIntegers.addAll(0, 10, 20, 30, 40, 50) | 119 | // val knownReals = new ArrayList<BigDecimal> |
120 | 120 | // knownReals.addAll(new BigDecimal("0.0")) | |
121 | val knownReals = new ArrayList<BigDecimal> | 121 | // |
122 | knownReals.addAll(new BigDecimal("0.0")) | 122 | // val knownStrings = new ArrayList<String> |
123 | 123 | // knownStrings.addAll("r0", "r1", "r2", "r3", "r4", "r5", "r6") | |
124 | val knownStrings = new ArrayList<String> | 124 | |
125 | knownStrings.addAll("r0", "r1", "r2", "r3", "r4", "r5", "r6") | 125 | val outputPath = "output/" + formattedDate + "/size" + size + "/models/" |
126 | 126 | val debugPath = "output/" + formattedDate + "/size" + size + "/debug/" | |
127 | val outputPath = "output/" + formattedDate + "/size" + size + "/run" + i + "/models/" | 127 | val logPath = debugPath + "log.txt" |
128 | val debugPath = "output/" + formattedDate + "/size" + size + "/run" + i + "/debug/" | 128 | val statsPath = debugPath + "statistics.csv" |
129 | val logPath = debugPath + "log.txt" | 129 | |
130 | val statsPath = debugPath + "statistics.csv" | 130 | // Adjust configuration |
131 | 131 | val genTask = config.commands.get(0) as GenerationTask | |
132 | // Adjust configuration | 132 | if(!QUERIES) genTask.patterns = null |
133 | val genTask = config.commands.get(0) as GenerationTask | 133 | if(!INITIAL) genTask.partialModel = null |
134 | if(!QUERIES) genTask.patterns = null | 134 | genTask.runs = REPS |
135 | if(!INITIAL) genTask.partialModel = null | 135 | |
136 | 136 | val scopeSpec = genTask.scope as ScopeSpecification | |
137 | val scopeSpec = genTask.scope as ScopeSpecification | 137 | val objScope = scopeSpec.scopes.get(0) as ObjectTypeScope |
138 | val objScope = scopeSpec.scopes.get(0) as ObjectTypeScope | 138 | val interval = objScope.number as IntervallNumber |
139 | val interval = objScope.number as IntervallNumber | 139 | interval.min = size |
140 | interval.min = size | 140 | interval.maxUnlimited = true |
141 | interval.maxUnlimited = true | 141 | |
142 | 142 | val configScope = genTask.config as ConfigSpecification | |
143 | val configScope = genTask.config as ConfigSpecification | 143 | val runtimeEntry = configScope.entries.get(0) as RuntimeEntry |
144 | val runtimeEntry = configScope.entries.get(0) as RuntimeEntry | 144 | runtimeEntry.millisecLimit = RUNTIME |
145 | runtimeEntry.millisecLimit = RUNTIME | 145 | |
146 | 146 | // TODO add known ints, reals, string... | |
147 | // TODO add known ints, reals, string... | 147 | val debug = genTask.debugFolder as FileSpecification |
148 | val debug = genTask.debugFolder as FileSpecification | 148 | debug.path = debugPath |
149 | debug.path = debugPath | 149 | val output = genTask.tagetFolder as FileSpecification |
150 | val output = genTask.tagetFolder as FileSpecification | 150 | output.path = outputPath |
151 | output.path = outputPath | 151 | val log = genTask.targetLogFile as FileSpecification |
152 | val log = genTask.targetLogFile as FileSpecification | 152 | log.path = logPath |
153 | log.path = logPath | 153 | val stats = genTask.targetStatisticsFile as FileSpecification |
154 | val stats = genTask.targetStatisticsFile as FileSpecification | 154 | stats.path = statsPath |
155 | stats.path = statsPath | ||
156 | 155 | ||
157 | // workspace.writeModel(config, '''x.xmi''') | 156 | // workspace.writeModel(config, '''x.xmi''') |
158 | val startTime = System.currentTimeMillis | 157 | val startTime = System.currentTimeMillis |
159 | executor.executeScript(config, new NullProgressMonitor) | 158 | executor.executeScript(config, new NullProgressMonitor) |
160 | val measuredTime = System.currentTimeMillis - startTime | 159 | val measuredTime = System.currentTimeMillis - startTime |
161 | 160 | ||
162 | println("<<END ->" + measuredTime / 1000.0 + "s >>\n") | 161 | println("<<END ->" + measuredTime / 1000.0 + "s >>\n") |
163 | 162 | ||
164 | // val toAddtoCSV = DOMAIN + "," + QUERIES + "," + size + "," + | 163 | // val toAddtoCSV = DOMAIN + "," + QUERIES + "," + size + "," + |
165 | // (solution.class == ModelResultImpl).toString + "," + RUNTIME + "," + measuredTime / 1000.0 + "," + | 164 | // (solution.class == ModelResultImpl).toString + "," + RUNTIME + "," + measuredTime / 1000.0 + "," + |
@@ -169,13 +168,13 @@ class GenerateFromConfig { | |||
169 | // if(GLOBAL_WRT) global_writer.append(toAddtoCSV) | 168 | // if(GLOBAL_WRT) global_writer.append(toAddtoCSV) |
170 | // if(INDIV_WRT) indiv_writer.append(toAddtoCSV) | 169 | // if(INDIV_WRT) indiv_writer.append(toAddtoCSV) |
171 | // solution.writeStats(totalTime, solverConfig) | 170 | // solution.writeStats(totalTime, solverConfig) |
172 | // Run Garbage Collector | 171 | // Run Garbage Collector |
173 | val Runtime r = Runtime.getRuntime(); | 172 | // val Runtime r = Runtime.getRuntime(); |
174 | r.gc(); | 173 | // r.gc(); |
175 | r.gc(); | 174 | // r.gc(); |
176 | r.gc(); | 175 | // r.gc(); |
177 | Thread.sleep(3000) | 176 | // Thread.sleep(3000) |
178 | } | 177 | // } |
179 | if(INDIV_WRT) indiv_writer.close | 178 | if(INDIV_WRT) indiv_writer.close |
180 | } | 179 | } |
181 | if(GLOBAL_WRT) global_writer.close | 180 | if(GLOBAL_WRT) global_writer.close |