diff options
Diffstat (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme')
6 files changed, 75 insertions, 99 deletions
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend index daa932fd..e15dbf3f 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend | |||
@@ -24,7 +24,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DiversityDescriptor | |||
24 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy | 24 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy |
25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner | 25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner |
26 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration | 26 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration |
27 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation | 27 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser |
28 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace | 28 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace |
29 | import java.util.LinkedList | 29 | import java.util.LinkedList |
30 | import java.util.List | 30 | import java.util.List |
@@ -32,9 +32,6 @@ import org.eclipse.emf.ecore.EObject | |||
32 | import org.eclipse.emf.ecore.resource.Resource | 32 | import org.eclipse.emf.ecore.resource.Resource |
33 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | 33 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl |
34 | import org.eclipse.xtend.lib.annotations.Data | 34 | import org.eclipse.xtend.lib.annotations.Data |
35 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification | ||
36 | import java.util.Set | ||
37 | import java.util.Comparator | ||
38 | 35 | ||
39 | enum Metamodel { | 36 | enum Metamodel { |
40 | FAM, YakinduWOSynch, Yakindu | 37 | FAM, YakinduWOSynch, Yakindu |
@@ -187,8 +184,7 @@ class ScenarioRunner { | |||
187 | it.runtimeLimit = 300 | 184 | it.runtimeLimit = 300 |
188 | it.typeScopes.maxNewElements = scenario.size | 185 | it.typeScopes.maxNewElements = scenario.size |
189 | it.typeScopes.minNewElements = scenario.size | 186 | it.typeScopes.minNewElements = scenario.size |
190 | it.solutionScope.numberOfRequiredSolution = scenario.number | 187 | it.solutionScope.numberOfRequiredSolutions = scenario.number |
191 | it.existingQueries = vq.patterns.map[it.internalQueryRepresentation] | ||
192 | it.nameNewElements = false | 188 | it.nameNewElements = false |
193 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis | 189 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis |
194 | it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints | 190 | it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints |
@@ -223,9 +219,8 @@ class ScenarioRunner { | |||
223 | it.runtimeLimit = 300 | 219 | it.runtimeLimit = 300 |
224 | it.typeScopes.maxNewElements = scenario.size | 220 | it.typeScopes.maxNewElements = scenario.size |
225 | it.typeScopes.minNewElements = scenario.size | 221 | it.typeScopes.minNewElements = scenario.size |
226 | it.solutionScope.numberOfRequiredSolution = scenario.number | 222 | it.solutionScope.numberOfRequiredSolutions = scenario.number |
227 | it.typeScopes.maxNewIntegers = 0 | 223 | it.typeScopes.maxNewIntegers = 0 |
228 | it.writeToFile=true | ||
229 | it.randomise = run-1 | 224 | it.randomise = run-1 |
230 | ] | 225 | ] |
231 | } | 226 | } |
@@ -259,7 +254,7 @@ class ScenarioRunner { | |||
259 | // ecore2GML.transform(root) | 254 | // ecore2GML.transform(root) |
260 | // workspace.writeText('''solutionVisualisation«representationNumber».gml''',gml) | 255 | // workspace.writeText('''solutionVisualisation«representationNumber».gml''',gml) |
261 | // | 256 | // |
262 | val visualiser = new GraphvizVisualisation | 257 | val visualiser = new GraphvizVisualiser |
263 | val visualisation = visualiser.visualiseConcretization(representation) | 258 | val visualisation = visualiser.visualiseConcretization(representation) |
264 | visualisation.writeToFile(workspace,'''solutionVisualisation«representationNumber»''') | 259 | visualisation.writeToFile(workspace,'''solutionVisualisation«representationNumber»''') |
265 | 260 | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend index 43d145d3..34f3c267 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend | |||
@@ -1,9 +1,10 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.run | 1 | package hu.bme.mit.inf.dslreasoner.run |
2 | 2 | ||
3 | import hu.bme.mit.inf.dslreasomer.domains.transima.fam.FunctionalArchitecture.FunctionalArchitecturePackage | 3 | import functionalarchitecture.FunctionalarchitecturePackage |
4 | import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Ecore | ||
4 | import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.FileSystem | 5 | import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.FileSystem |
5 | import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage | 6 | import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage |
6 | import hu.bme.mit.inf.dslreasoner.domains.transima.fam.patterns.Pattern | 7 | import hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns |
7 | import hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage | 8 | import hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage |
8 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor | 9 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor |
9 | import hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.Patterns | 10 | import hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.Patterns |
@@ -12,6 +13,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationMetho | |||
12 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ModelGenerationMethodBasedGlobalConstraint | 13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ModelGenerationMethodBasedGlobalConstraint |
13 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace | 14 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace |
14 | import java.util.Collection | 15 | import java.util.Collection |
16 | import java.util.HashMap | ||
15 | import java.util.LinkedHashMap | 17 | import java.util.LinkedHashMap |
16 | import java.util.List | 18 | import java.util.List |
17 | import java.util.Set | 19 | import java.util.Set |
@@ -21,14 +23,14 @@ import org.eclipse.emf.ecore.EEnum | |||
21 | import org.eclipse.emf.ecore.EEnumLiteral | 23 | import org.eclipse.emf.ecore.EEnumLiteral |
22 | import org.eclipse.emf.ecore.EObject | 24 | import org.eclipse.emf.ecore.EObject |
23 | import org.eclipse.emf.ecore.EReference | 25 | import org.eclipse.emf.ecore.EReference |
24 | import org.eclipse.xtext.xbase.lib.Functions.Function1 | ||
25 | import java.util.HashMap | ||
26 | import org.eclipse.emf.ecore.EcorePackage | 26 | import org.eclipse.emf.ecore.EcorePackage |
27 | import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Ecore | 27 | import org.eclipse.xtext.xbase.lib.Functions.Function1 |
28 | import hu.bme.mit.inf.dslreasoner.domains.transima.fam.Type | ||
29 | import hu.bme.mit.inf.dslreasoner.domains.transima.fam.Model | ||
28 | 30 | ||
29 | abstract class MetamodelLoader { | 31 | abstract class MetamodelLoader { |
30 | protected val ReasonerWorkspace workspace | 32 | protected val ReasonerWorkspace workspace |
31 | public new(ReasonerWorkspace workspace) { | 33 | new(ReasonerWorkspace workspace) { |
32 | this.workspace = workspace | 34 | this.workspace = workspace |
33 | } | 35 | } |
34 | def EcoreMetamodelDescriptor loadMetamodel() | 36 | def EcoreMetamodelDescriptor loadMetamodel() |
@@ -53,7 +55,7 @@ class FAMLoader extends MetamodelLoader{ | |||
53 | } | 55 | } |
54 | 56 | ||
55 | override loadMetamodel() { | 57 | override loadMetamodel() { |
56 | val package = FunctionalArchitecturePackage.eINSTANCE | 58 | val package = FunctionalarchitecturePackage.eINSTANCE |
57 | val List<EClass> classes = package.EClassifiers.filter(EClass).toList | 59 | val List<EClass> classes = package.EClassifiers.filter(EClass).toList |
58 | val List<EEnum> enums = package.EClassifiers.filter(EEnum).toList | 60 | val List<EEnum> enums = package.EClassifiers.filter(EEnum).toList |
59 | val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList | 61 | val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList |
@@ -70,12 +72,12 @@ class FAMLoader extends MetamodelLoader{ | |||
70 | } | 72 | } |
71 | 73 | ||
72 | override loadQueries(EcoreMetamodelDescriptor metamodel) { | 74 | override loadQueries(EcoreMetamodelDescriptor metamodel) { |
73 | val i = Pattern.instance | 75 | val i = FamPatterns.instance |
74 | val patterns = i.specifications.toList | 76 | val patterns = i.specifications.toList |
75 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet | 77 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet |
76 | val derivedFeatures = new LinkedHashMap | 78 | val derivedFeatures = new LinkedHashMap |
77 | derivedFeatures.put(i.type,metamodel.attributes.filter[it.name == "type"].head) | 79 | derivedFeatures.put(Type.instance,metamodel.attributes.filter[it.name == "type"].head) |
78 | derivedFeatures.put(i.model,metamodel.references.filter[it.name == "model"].head) | 80 | derivedFeatures.put(Model.instance,metamodel.references.filter[it.name == "model"].head) |
79 | val res = new ViatraQuerySetDescriptor( | 81 | val res = new ViatraQuerySetDescriptor( |
80 | patterns, | 82 | patterns, |
81 | wfPatterns, | 83 | wfPatterns, |
@@ -92,8 +94,8 @@ class FAMLoader extends MetamodelLoader{ | |||
92 | 94 | ||
93 | class YakinduLoader extends MetamodelLoader{ | 95 | class YakinduLoader extends MetamodelLoader{ |
94 | 96 | ||
95 | private var useSynchronization = true; | 97 | var useSynchronization = true; |
96 | private var useComplexStates = false; | 98 | var useComplexStates = false; |
97 | public static val patternsWithSynchronization = #[ | 99 | public static val patternsWithSynchronization = #[ |
98 | "synchHasNoOutgoing", "synchHasNoIncoming", "SynchronizedIncomingInSameRegion", "notSynchronizingStates", | 100 | "synchHasNoOutgoing", "synchHasNoIncoming", "SynchronizedIncomingInSameRegion", "notSynchronizingStates", |
99 | "hasMultipleOutgoingTrainsition", "hasMultipleIncomingTrainsition", "SynchronizedRegionsAreNotSiblings", | 101 | "hasMultipleOutgoingTrainsition", "hasMultipleIncomingTrainsition", "SynchronizedRegionsAreNotSiblings", |
@@ -104,10 +106,10 @@ class YakinduLoader extends MetamodelLoader{ | |||
104 | YakindummPackage.eINSTANCE.eClass | 106 | YakindummPackage.eINSTANCE.eClass |
105 | } | 107 | } |
106 | 108 | ||
107 | public def setUseSynchronization(boolean useSynchronization) { | 109 | def setUseSynchronization(boolean useSynchronization) { |
108 | this.useSynchronization = useSynchronization | 110 | this.useSynchronization = useSynchronization |
109 | } | 111 | } |
110 | public def setUseComplexStates(boolean useComplexStates) { | 112 | def setUseComplexStates(boolean useComplexStates) { |
111 | this.useComplexStates = useComplexStates | 113 | this.useComplexStates = useComplexStates |
112 | } | 114 | } |
113 | 115 | ||
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 8d96958d..ae810a9b 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 | |||
@@ -25,10 +25,12 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeInferenceMethod | |||
25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic | 25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic |
26 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | 26 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation |
27 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage | 27 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage |
28 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml | ||
28 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DiversityDescriptor | 29 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DiversityDescriptor |
29 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy | 30 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy |
30 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner | 31 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner |
31 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration | 32 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration |
33 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser | ||
32 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace | 34 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace |
33 | import java.io.BufferedReader | 35 | import java.io.BufferedReader |
34 | import java.io.InputStreamReader | 36 | import java.io.InputStreamReader |
@@ -37,9 +39,6 @@ import org.eclipse.emf.ecore.EObject | |||
37 | import org.eclipse.emf.ecore.resource.Resource | 39 | import org.eclipse.emf.ecore.resource.Resource |
38 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | 40 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl |
39 | import org.junit.Test | 41 | 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 | ||
43 | 42 | ||
44 | enum UseSolver{Viatra, Smt, ViatraWithSmt, Alloy} | 43 | enum UseSolver{Viatra, Smt, ViatraWithSmt, Alloy} |
45 | enum Domain{FAM, Yakindu, FileSystem,Ecore} | 44 | enum Domain{FAM, Yakindu, FileSystem,Ecore} |
@@ -129,7 +128,7 @@ class RunMeasurements { | |||
129 | val smtConfig = new SmtSolverConfiguration() => [ | 128 | val smtConfig = new SmtSolverConfiguration() => [ |
130 | it.typeScopes.maxNewElements = size | 129 | it.typeScopes.maxNewElements = size |
131 | it.typeScopes.minNewElements = size | 130 | it.typeScopes.minNewElements = size |
132 | it.solutionScope.numberOfRequiredSolution = number | 131 | it.solutionScope.numberOfRequiredSolutions = number |
133 | it.solverPath = '''"D:/Programs/Z3/4.3/z3.exe"''' | 132 | it.solverPath = '''"D:/Programs/Z3/4.3/z3.exe"''' |
134 | ] | 133 | ] |
135 | val solution = this.smtSolver.solve( | 134 | val solution = this.smtSolver.solve( |
@@ -142,9 +141,8 @@ class RunMeasurements { | |||
142 | val alloyConfig = new AlloySolverConfiguration => [ | 141 | val alloyConfig = new AlloySolverConfiguration => [ |
143 | it.typeScopes.maxNewElements = size | 142 | it.typeScopes.maxNewElements = size |
144 | it.typeScopes.minNewElements = size | 143 | it.typeScopes.minNewElements = size |
145 | it.solutionScope.numberOfRequiredSolution = number | 144 | it.solutionScope.numberOfRequiredSolutions = number |
146 | it.typeScopes.maxNewIntegers = 0 | 145 | it.typeScopes.maxNewIntegers = 0 |
147 | it.writeToFile = true | ||
148 | ] | 146 | ] |
149 | val solution = this.alloyReasoner.solve( | 147 | val solution = this.alloyReasoner.solve( |
150 | problem, | 148 | problem, |
@@ -157,13 +155,12 @@ class RunMeasurements { | |||
157 | it.runtimeLimit = 400 | 155 | it.runtimeLimit = 400 |
158 | it.typeScopes.maxNewElements = size | 156 | it.typeScopes.maxNewElements = size |
159 | it.typeScopes.minNewElements = size | 157 | it.typeScopes.minNewElements = size |
160 | it.solutionScope.numberOfRequiredSolution = number | 158 | it.solutionScope.numberOfRequiredSolutions = number |
161 | it.existingQueries = vq.patterns.map[it.internalQueryRepresentation] | ||
162 | it.nameNewElements = false | 159 | it.nameNewElements = false |
163 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis | 160 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis |
164 | it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints | 161 | it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints |
165 | it.stateCoderStrategy = StateCoderStrategy::Neighbourhood | 162 | it.stateCoderStrategy = StateCoderStrategy::Neighbourhood |
166 | it.debugCongiguration.partalInterpretationVisualisationFrequency = 100 | 163 | it.debugConfiguration.partalInterpretationVisualisationFrequency = 100 |
167 | //it.debugCongiguration.partialInterpretatioVisualiser = | 164 | //it.debugCongiguration.partialInterpretatioVisualiser = |
168 | //new GraphvizVisualisation | 165 | //new GraphvizVisualisation |
169 | //new PartialInterpretationSizePrinter | 166 | //new PartialInterpretationSizePrinter |
@@ -267,7 +264,7 @@ class RunMeasurements { | |||
267 | val gml = partialInterpretation2GML.transform(representation) | 264 | val gml = partialInterpretation2GML.transform(representation) |
268 | r.workspace.writeText('''solution«representationNumber».gml''',gml) | 265 | r.workspace.writeText('''solution«representationNumber».gml''',gml) |
269 | if(representation.newElements.size <160) { | 266 | if(representation.newElements.size <160) { |
270 | val visualiser = new GraphvizVisualisation | 267 | val visualiser = new GraphvizVisualiser |
271 | val visualisation = visualiser.visualiseConcretization(representation) | 268 | val visualisation = visualiser.visualiseConcretization(representation) |
272 | visualisation.writeToFile(r.workspace,'''solution«representationNumber»''') | 269 | visualisation.writeToFile(r.workspace,'''solution«representationNumber»''') |
273 | } | 270 | } |
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunModelExtension.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunModelExtension.xtend index d8f75b89..1b8fe3e9 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunModelExtension.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunModelExtension.xtend | |||
@@ -30,7 +30,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DiversityDescriptor | |||
30 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy | 30 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy |
31 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner | 31 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner |
32 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration | 32 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration |
33 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation | 33 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser |
34 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace | 34 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace |
35 | import java.io.BufferedReader | 35 | import java.io.BufferedReader |
36 | import java.io.InputStreamReader | 36 | import java.io.InputStreamReader |
@@ -44,7 +44,6 @@ import org.eclipse.emf.ecore.resource.Resource | |||
44 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | 44 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl |
45 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine | 45 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine |
46 | import org.eclipse.viatra.query.runtime.emf.EMFScope | 46 | import org.eclipse.viatra.query.runtime.emf.EMFScope |
47 | import java.lang.invoke.VolatileCallSite | ||
48 | 47 | ||
49 | enum PartialModelSource { Homeworks, Random } | 48 | enum PartialModelSource { Homeworks, Random } |
50 | enum ValidationTechique {Alloy, Viatra} | 49 | enum ValidationTechique {Alloy, Viatra} |
@@ -116,7 +115,7 @@ class RunModelExtensionMeasurements { | |||
116 | val smtConfig = new SmtSolverConfiguration() => [ | 115 | val smtConfig = new SmtSolverConfiguration() => [ |
117 | it.typeScopes.maxNewElements = size | 116 | it.typeScopes.maxNewElements = size |
118 | it.typeScopes.minNewElements = size | 117 | it.typeScopes.minNewElements = size |
119 | it.solutionScope.numberOfRequiredSolution = 1 | 118 | it.solutionScope.numberOfRequiredSolutions = 1 |
120 | it.solverPath = '''"D:/Programs/Z3/4.3/z3.exe"''' | 119 | it.solverPath = '''"D:/Programs/Z3/4.3/z3.exe"''' |
121 | ] | 120 | ] |
122 | val solution = this.smtSolver.solve( | 121 | val solution = this.smtSolver.solve( |
@@ -129,9 +128,8 @@ class RunModelExtensionMeasurements { | |||
129 | val alloyConfig = new AlloySolverConfiguration => [ | 128 | val alloyConfig = new AlloySolverConfiguration => [ |
130 | it.typeScopes.maxNewElements = size | 129 | it.typeScopes.maxNewElements = size |
131 | it.typeScopes.minNewElements = size | 130 | it.typeScopes.minNewElements = size |
132 | it.solutionScope.numberOfRequiredSolution = 1 | 131 | it.solutionScope.numberOfRequiredSolutions = 1 |
133 | it.typeScopes.maxNewIntegers = 0 | 132 | it.typeScopes.maxNewIntegers = 0 |
134 | it.writeToFile = true | ||
135 | ] | 133 | ] |
136 | val solution = this.alloyReasoner.solve( | 134 | val solution = this.alloyReasoner.solve( |
137 | problem, | 135 | problem, |
@@ -144,16 +142,12 @@ class RunModelExtensionMeasurements { | |||
144 | it.runtimeLimit = 400 | 142 | it.runtimeLimit = 400 |
145 | it.typeScopes.maxNewElements = size | 143 | it.typeScopes.maxNewElements = size |
146 | it.typeScopes.minNewElements = size | 144 | it.typeScopes.minNewElements = size |
147 | it.solutionScope.numberOfRequiredSolution = 1 | 145 | it.solutionScope.numberOfRequiredSolutions = 1 |
148 | it.existingQueries = vq.patterns.map[it.internalQueryRepresentation] | ||
149 | it.nameNewElements = false | 146 | it.nameNewElements = false |
150 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis | 147 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis |
151 | it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints | 148 | it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints |
152 | it.stateCoderStrategy = StateCoderStrategy::Neighbourhood | 149 | it.stateCoderStrategy = StateCoderStrategy::Neighbourhood |
153 | it.debugCongiguration.partalInterpretationVisualisationFrequency = 100 | 150 | it.debugConfiguration.partalInterpretationVisualisationFrequency = 100 |
154 | //it.debugCongiguration.partialInterpretatioVisualiser = | ||
155 | //new GraphvizVisualisation | ||
156 | //new PartialInterpretationSizePrinter | ||
157 | ] | 151 | ] |
158 | viatraConfig.diversityRequirement = diversityRequirement | 152 | viatraConfig.diversityRequirement = diversityRequirement |
159 | if (solver == UseSolver.Viatra) { | 153 | if (solver == UseSolver.Viatra) { |
@@ -314,7 +308,7 @@ class RunModelExtensionMeasurements { | |||
314 | val gml = partialInterpretation2GML.transform(representation) | 308 | val gml = partialInterpretation2GML.transform(representation) |
315 | r.workspace.writeText('''solution«representationNumber».gml''',gml) | 309 | r.workspace.writeText('''solution«representationNumber».gml''',gml) |
316 | if(representation.newElements.size <160) { | 310 | if(representation.newElements.size <160) { |
317 | val visualiser = new GraphvizVisualisation | 311 | val visualiser = new GraphvizVisualiser |
318 | val visualisation = visualiser.visualiseConcretization(representation) | 312 | val visualisation = visualiser.visualiseConcretization(representation) |
319 | visualisation.writeToFile(r.workspace,'''solution«representationNumber»''') | 313 | visualisation.writeToFile(r.workspace,'''solution«representationNumber»''') |
320 | } | 314 | } |
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend index 863a91c8..91c46dd6 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend | |||
@@ -1,41 +1,39 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.run | 1 | package hu.bme.mit.inf.dslreasoner.run |
2 | 2 | ||
3 | import functionalarchitecture.FunctionalarchitecturePackage | ||
4 | import hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns | ||
5 | import hu.bme.mit.inf.dslreasoner.domains.transima.fam.Model | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.transima.fam.Type | ||
7 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic | ||
8 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration | ||
9 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor | ||
10 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel | ||
11 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner | ||
12 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult | ||
13 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult | ||
14 | import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore | ||
15 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic | ||
16 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration | ||
17 | import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor | ||
18 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic | ||
19 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | ||
20 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml | ||
21 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner | ||
22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration | ||
23 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser | ||
3 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace | 24 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace |
4 | import hu.bme.mit.inf.dslreasomer.domains.transima.fam.FunctionalArchitecture.FunctionalArchitecturePackage | 25 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace |
26 | import java.util.LinkedHashMap | ||
27 | import java.util.LinkedList | ||
5 | import java.util.List | 28 | import java.util.List |
29 | import org.eclipse.emf.ecore.EAttribute | ||
6 | import org.eclipse.emf.ecore.EClass | 30 | import org.eclipse.emf.ecore.EClass |
7 | import org.eclipse.emf.ecore.EEnumLiteral | ||
8 | import org.eclipse.emf.ecore.EReference | ||
9 | import org.eclipse.emf.ecore.EEnum | 31 | import org.eclipse.emf.ecore.EEnum |
10 | import org.eclipse.emf.ecore.EAttribute | 32 | import org.eclipse.emf.ecore.EEnumLiteral |
11 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor | ||
12 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace | ||
13 | import org.eclipse.emf.ecore.EObject | 33 | import org.eclipse.emf.ecore.EObject |
14 | import java.util.LinkedHashMap | 34 | import org.eclipse.emf.ecore.EReference |
15 | import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor | ||
16 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic | ||
17 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic | ||
18 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic | ||
19 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration | ||
20 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration | ||
21 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration | ||
22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeInferenceMethod | ||
23 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy | ||
24 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner | ||
25 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult | ||
26 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | ||
27 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult | ||
28 | import org.eclipse.emf.ecore.resource.Resource | 35 | import org.eclipse.emf.ecore.resource.Resource |
29 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | 36 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl |
30 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml | ||
31 | import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolverConfiguration | ||
32 | import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolver | ||
33 | import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore | ||
34 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner | ||
35 | import java.util.LinkedList | ||
36 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation | ||
37 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicStructureBuilder | ||
38 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder | ||
39 | 37 | ||
40 | class SimpleRun { | 38 | class SimpleRun { |
41 | 39 | ||
@@ -59,7 +57,7 @@ class SimpleRun { | |||
59 | 57 | ||
60 | val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel,new Ecore2LogicConfiguration()) | 58 | val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel,new Ecore2LogicConfiguration()) |
61 | val modelExtensionProblem = instanceModel2Logic.transform(modelGenerationProblem,partialModel) | 59 | val modelExtensionProblem = instanceModel2Logic.transform(modelGenerationProblem,partialModel) |
62 | val validModelExtensionProblem = viatra2Logic.transformQueries(queries,modelGenerationProblem,new Viatra2LogicConfiguration) | 60 | val validModelExtensionProblem = viatra2Logic.transformQueries(queries,modelExtensionProblem,new Viatra2LogicConfiguration) |
63 | 61 | ||
64 | val logicProblem = validModelExtensionProblem.output | 62 | val logicProblem = validModelExtensionProblem.output |
65 | 63 | ||
@@ -71,11 +69,10 @@ class SimpleRun { | |||
71 | val viatraConfig = new ViatraReasonerConfiguration => [ | 69 | val viatraConfig = new ViatraReasonerConfiguration => [ |
72 | it.typeScopes.maxNewElements = 40 | 70 | it.typeScopes.maxNewElements = 40 |
73 | it.typeScopes.minNewElements = 40 | 71 | it.typeScopes.minNewElements = 40 |
74 | it.solutionScope.numberOfRequiredSolution = 1 | 72 | it.solutionScope.numberOfRequiredSolutions = 1 |
75 | it.existingQueries = queries.patterns.map[it.internalQueryRepresentation] | 73 | it.documentationLevel = DocumentationLevel.NONE |
76 | it.debugCongiguration.logging = false | 74 | it.debugConfiguration.partalInterpretationVisualisationFrequency = 1 |
77 | it.debugCongiguration.partalInterpretationVisualisationFrequency = 1 | 75 | it.debugConfiguration.partialInterpretatioVisualiser = new GraphvizVisualiser |
78 | it.debugCongiguration.partialInterpretatioVisualiser = new GraphvizVisualisation | ||
79 | ] | 76 | ] |
80 | solution = reasoner.solve(logicProblem,viatraConfig,workspace) | 77 | solution = reasoner.solve(logicProblem,viatraConfig,workspace) |
81 | /*/ | 78 | /*/ |
@@ -95,11 +92,6 @@ class SimpleRun { | |||
95 | val interpretations = reasoner.getInterpretations(solution as ModelResult) | 92 | val interpretations = reasoner.getInterpretations(solution as ModelResult) |
96 | val models = new LinkedList | 93 | val models = new LinkedList |
97 | for(interpretation : interpretations) { | 94 | for(interpretation : interpretations) { |
98 | val extension b = new LogicStructureBuilder | ||
99 | val extension a = new LogicProblemBuilder | ||
100 | |||
101 | |||
102 | |||
103 | val instanceModel = logic2Ecore.transformInterpretation(interpretation,modelGenerationProblem.trace) | 95 | val instanceModel = logic2Ecore.transformInterpretation(interpretation,modelGenerationProblem.trace) |
104 | models+=instanceModel | 96 | models+=instanceModel |
105 | } | 97 | } |
@@ -108,7 +100,7 @@ class SimpleRun { | |||
108 | } | 100 | } |
109 | 101 | ||
110 | def private static loadMetamodel() { | 102 | def private static loadMetamodel() { |
111 | val pckg = FunctionalArchitecturePackage.eINSTANCE | 103 | val pckg = FunctionalarchitecturePackage.eINSTANCE |
112 | val List<EClass> classes = pckg.EClassifiers.filter(EClass).toList | 104 | val List<EClass> classes = pckg.EClassifiers.filter(EClass).toList |
113 | val List<EEnum> enums = pckg.EClassifiers.filter(EEnum).toList | 105 | val List<EEnum> enums = pckg.EClassifiers.filter(EEnum).toList |
114 | val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList | 106 | val List<EEnumLiteral> literals = enums.map[ELiterals].flatten.toList |
@@ -118,12 +110,12 @@ class SimpleRun { | |||
118 | } | 110 | } |
119 | 111 | ||
120 | def private static loadQueries(EcoreMetamodelDescriptor metamodel) { | 112 | def private static loadQueries(EcoreMetamodelDescriptor metamodel) { |
121 | val i = hu.bme.mit.inf.dslreasoner.domains.transima.fam.patterns.Pattern.instance | 113 | val i = FamPatterns.instance |
122 | val patterns = i.specifications.toList | 114 | val patterns = i.specifications.toList |
123 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet | 115 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet |
124 | val derivedFeatures = new LinkedHashMap | 116 | val derivedFeatures = new LinkedHashMap |
125 | derivedFeatures.put(i.type,metamodel.attributes.filter[it.name == "type"].head) | 117 | derivedFeatures.put(Type.instance,metamodel.attributes.filter[it.name == "type"].head) |
126 | derivedFeatures.put(i.model,metamodel.references.filter[it.name == "model"].head) | 118 | derivedFeatures.put(Model.instance,metamodel.references.filter[it.name == "model"].head) |
127 | val res = new ViatraQuerySetDescriptor( | 119 | val res = new ViatraQuerySetDescriptor( |
128 | patterns, | 120 | patterns, |
129 | wfPatterns, | 121 | wfPatterns, |
@@ -160,8 +152,4 @@ class SimpleRun { | |||
160 | println("Solution saved and visualised") | 152 | println("Solution saved and visualised") |
161 | } | 153 | } |
162 | } | 154 | } |
163 | |||
164 | def static visualizeSolution() { | ||
165 | |||
166 | } | ||
167 | } \ No newline at end of file | 155 | } \ No newline at end of file |
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend index 6b74d161..3a100ace 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend | |||
@@ -1,16 +1,16 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.run | 1 | package hu.bme.mit.inf.dslreasoner.run |
2 | 2 | ||
3 | import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsPackage | ||
4 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage | ||
3 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicproblemPackage | 5 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicproblemPackage |
6 | import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.Viatra2LogicAnnotationsPackage | ||
4 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | 7 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation |
5 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage | 8 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage |
9 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml | ||
10 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser | ||
6 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace | 11 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace |
7 | import java.io.File | 12 | import java.io.File |
8 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage | ||
9 | import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsPackage | ||
10 | import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.Viatra2LogicAnnotationsPackage | ||
11 | import org.eclipse.emf.ecore.resource.Resource | 13 | import org.eclipse.emf.ecore.resource.Resource |
12 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml | ||
13 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation | ||
14 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | 14 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl |
15 | 15 | ||
16 | class VisualiseAllModelInDirectory { | 16 | class VisualiseAllModelInDirectory { |
@@ -62,7 +62,7 @@ class VisualiseAllModelInDirectory { | |||
62 | } | 62 | } |
63 | 63 | ||
64 | if(!hasPng && model.newElements.size <160) { | 64 | if(!hasPng && model.newElements.size <160) { |
65 | val visualiser = new GraphvizVisualisation | 65 | val visualiser = new GraphvizVisualiser |
66 | val visualisation = visualiser.visualiseConcretization(model) | 66 | val visualisation = visualiser.visualiseConcretization(model) |
67 | visualisation.writeToFile(workspace,fileNameWithoutExtension) | 67 | visualisation.writeToFile(workspace,fileNameWithoutExtension) |
68 | println('''«fileNameWithoutExtension».png''') | 68 | println('''«fileNameWithoutExtension».png''') |