diff options
Diffstat (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend')
-rw-r--r-- | Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend index e96a6bf6..8d96958d 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend | |||
@@ -37,9 +37,12 @@ import org.eclipse.emf.ecore.EObject | |||
37 | import org.eclipse.emf.ecore.resource.Resource | 37 | import org.eclipse.emf.ecore.resource.Resource |
38 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | 38 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl |
39 | import org.junit.Test | 39 | import org.junit.Test |
40 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation | ||
41 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationSizePrinter | ||
42 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml | ||
40 | 43 | ||
41 | enum UseSolver{Viatra, Smt, ViatraWithSmt, Alloy} | 44 | enum UseSolver{Viatra, Smt, ViatraWithSmt, Alloy} |
42 | enum Domain{FAM, Yakindu} | 45 | enum Domain{FAM, Yakindu, FileSystem,Ecore} |
43 | enum Diversity{No, Diverse} | 46 | enum Diversity{No, Diverse} |
44 | 47 | ||
45 | class RunMeasurements { | 48 | class RunMeasurements { |
@@ -70,8 +73,12 @@ class RunMeasurements { | |||
70 | if(dsl == Domain::FAM) { | 73 | if(dsl == Domain::FAM) { |
71 | return new FAMLoader(inputs) | 74 | return new FAMLoader(inputs) |
72 | } else if(dsl == Domain::Yakindu) { | 75 | } else if(dsl == Domain::Yakindu) { |
73 | return new YakinduLoader(inputs) | 76 | return new YakinduLoader(inputs) =>[it.useSynchronization = true useComplexStates = false] |
74 | } else throw new IllegalArgumentException('''Unknown domain: «dsl»''') | 77 | } else if(dsl == Domain::FileSystem){ |
78 | return new FileSystemLoader(inputs) | ||
79 | } else if(dsl == Domain::Ecore) { | ||
80 | return new EcoreLoader(inputs) | ||
81 | }else throw new IllegalArgumentException('''Unknown domain: «dsl»''') | ||
75 | } | 82 | } |
76 | def static init() { | 83 | def static init() { |
77 | LogiclanguagePackage.eINSTANCE.class | 84 | LogiclanguagePackage.eINSTANCE.class |
@@ -147,7 +154,7 @@ class RunMeasurements { | |||
147 | return solution | 154 | return solution |
148 | } else { | 155 | } else { |
149 | val viatraConfig = new ViatraReasonerConfiguration => [ | 156 | val viatraConfig = new ViatraReasonerConfiguration => [ |
150 | it.runtimeLimit = 20 | 157 | it.runtimeLimit = 400 |
151 | it.typeScopes.maxNewElements = size | 158 | it.typeScopes.maxNewElements = size |
152 | it.typeScopes.minNewElements = size | 159 | it.typeScopes.minNewElements = size |
153 | it.solutionScope.numberOfRequiredSolution = number | 160 | it.solutionScope.numberOfRequiredSolution = number |
@@ -156,6 +163,10 @@ class RunMeasurements { | |||
156 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis | 163 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis |
157 | it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints | 164 | it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints |
158 | it.stateCoderStrategy = StateCoderStrategy::Neighbourhood | 165 | it.stateCoderStrategy = StateCoderStrategy::Neighbourhood |
166 | it.debugCongiguration.partalInterpretationVisualisationFrequency = 100 | ||
167 | //it.debugCongiguration.partialInterpretatioVisualiser = | ||
168 | //new GraphvizVisualisation | ||
169 | //new PartialInterpretationSizePrinter | ||
159 | ] | 170 | ] |
160 | viatraConfig.diversityRequirement = diversityRequirement | 171 | viatraConfig.diversityRequirement = diversityRequirement |
161 | if (solver == UseSolver.Viatra) { | 172 | if (solver == UseSolver.Viatra) { |
@@ -189,13 +200,13 @@ class RunMeasurements { | |||
189 | } | 200 | } |
190 | 201 | ||
191 | static val monitoring = false | 202 | static val monitoring = false |
192 | static val clean = false | 203 | static val clean = true |
193 | static val domain = Domain::Yakindu | 204 | static val domain = Domain::FAM |
194 | static val solver = UseSolver::Viatra | 205 | static val solver = UseSolver::Viatra |
195 | static val diverse = true | 206 | static val diverse = false |
196 | static val wf = false | 207 | static val wf = true |
197 | public static var sizes = #[50] | 208 | public static var sizes = #[11,5,10,15,20,25,30,35,40,45,50,100,150,200,250,300,350,400,450,500] |
198 | static var int number = 3 | 209 | static var int number = 1 |
199 | 210 | ||
200 | def static void waitForEnter() { | 211 | def static void waitForEnter() { |
201 | if(monitoring) { | 212 | if(monitoring) { |
@@ -215,8 +226,8 @@ class RunMeasurements { | |||
215 | //println("- Queries loaded") | 226 | //println("- Queries loaded") |
216 | 227 | ||
217 | if(!wf) { | 228 | if(!wf) { |
218 | mm.attributes.forEach[it.lowerBound = 0] | 229 | // mm.attributes.forEach[it.lowerBound = 0] |
219 | mm.references.forEach[it.lowerBound = 0] | 230 | // mm.references.forEach[it.lowerBound = 0] |
220 | mm.references.removeAll(vq.derivedFeatures.values) | 231 | mm.references.removeAll(vq.derivedFeatures.values) |
221 | mm.attributes.removeAll(vq.derivedFeatures.values) | 232 | mm.attributes.removeAll(vq.derivedFeatures.values) |
222 | } | 233 | } |
@@ -252,6 +263,15 @@ class RunMeasurements { | |||
252 | val representationNumber = representationIndex + 1 | 263 | val representationNumber = representationIndex + 1 |
253 | if(representation instanceof PartialInterpretation) { | 264 | if(representation instanceof PartialInterpretation) { |
254 | r.workspace.writeModel(representation, '''solution«representationNumber».partialinterpretation''') | 265 | r.workspace.writeModel(representation, '''solution«representationNumber».partialinterpretation''') |
266 | val partialInterpretation2GML = new PartialInterpretation2Gml | ||
267 | val gml = partialInterpretation2GML.transform(representation) | ||
268 | r.workspace.writeText('''solution«representationNumber».gml''',gml) | ||
269 | if(representation.newElements.size <160) { | ||
270 | val visualiser = new GraphvizVisualisation | ||
271 | val visualisation = visualiser.visualiseConcretization(representation) | ||
272 | visualisation.writeToFile(r.workspace,'''solution«representationNumber»''') | ||
273 | } | ||
274 | |||
255 | } else { | 275 | } else { |
256 | r.workspace.writeText('''solution«representationNumber».txt''',representation.toString) | 276 | r.workspace.writeText('''solution«representationNumber».txt''',representation.toString) |
257 | } | 277 | } |
@@ -274,14 +294,14 @@ class RunMeasurements { | |||
274 | println("save") | 294 | println("save") |
275 | //val id = 50//args.get(0) | 295 | //val id = 50//args.get(0) |
276 | for(size : sizes) { | 296 | for(size : sizes) { |
277 | val run = (1..50).map['''r«it»'''] | 297 | val run = (1..10).map['''r«it»'''] |
278 | for(runIndex : run) { | 298 | for(runIndex : run) { |
279 | val runID = runIndex+"_"+size | 299 | val runID = runIndex+"_"+size |
280 | print(runID + ";") | 300 | print(runID + ";") |
281 | 301 | ||
282 | try { | 302 | try { |
283 | runMeasure(runID,size) | 303 | runMeasure(runID,size) |
284 | } catch(Exception e) {} | 304 | } catch(Exception e) {e.printStackTrace} |
285 | 305 | ||
286 | System.gc System.gc System.gc | 306 | System.gc System.gc System.gc |
287 | Thread.sleep(2000) | 307 | Thread.sleep(2000) |