diff options
author | 2019-04-11 16:59:48 -0400 | |
---|---|---|
committer | 2020-06-07 19:36:36 -0400 | |
commit | ab556f8705c70a3376bcadf73698c95fd4df5bf9 (patch) | |
tree | 0c34ae58ee74f4f154659ad303775cee3e5eb206 /Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.java | |
parent | Implement containment circularity avoidance #20 (diff) | |
download | VIATRA-Generator-ab556f8705c70a3376bcadf73698c95fd4df5bf9.tar.gz VIATRA-Generator-ab556f8705c70a3376bcadf73698c95fd4df5bf9.tar.zst VIATRA-Generator-ab556f8705c70a3376bcadf73698c95fd4df5bf9.zip |
VAMPIRE: #39 Reorganise tests, working yakindu test, need debugging
Diffstat (limited to 'Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.java')
-rw-r--r-- | Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.java | 107 |
1 files changed, 90 insertions, 17 deletions
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.java b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.java index 7b4bb578..5fc2a391 100644 --- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.java +++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.java | |||
@@ -2,37 +2,110 @@ package ca.mcgill.ecse.dslreasoner.vampire.icse; | |||
2 | 2 | ||
3 | import ca.mcgill.ecse.dslreasoner.vampire.icse.GeneralTest; | 3 | import ca.mcgill.ecse.dslreasoner.vampire.icse.GeneralTest; |
4 | import ca.mcgill.ecse.dslreasoner.vampire.queries.FamPatterns; | 4 | import ca.mcgill.ecse.dslreasoner.vampire.queries.FamPatterns; |
5 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver; | ||
6 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration; | ||
7 | import functionalarchitecture.Function; | ||
8 | import functionalarchitecture.FunctionalOutput; | ||
5 | import functionalarchitecture.FunctionalarchitecturePackage; | 9 | import functionalarchitecture.FunctionalarchitecturePackage; |
10 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic; | ||
11 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration; | ||
12 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace; | ||
6 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; | 13 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; |
14 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel; | ||
15 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner; | ||
16 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput; | ||
17 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type; | ||
18 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem; | ||
19 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult; | ||
20 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic; | ||
7 | import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor; | 21 | import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor; |
22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic; | ||
8 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace; | 23 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace; |
24 | import java.util.HashMap; | ||
9 | import java.util.Map; | 25 | import java.util.Map; |
10 | import org.eclipse.emf.common.util.EList; | 26 | import org.eclipse.emf.common.util.EList; |
11 | import org.eclipse.emf.ecore.EObject; | 27 | import org.eclipse.emf.ecore.EObject; |
12 | import org.eclipse.emf.ecore.resource.Resource; | 28 | import org.eclipse.emf.ecore.resource.Resource; |
13 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; | 29 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; |
14 | import org.eclipse.xtend2.lib.StringConcatenation; | 30 | import org.eclipse.xtend2.lib.StringConcatenation; |
31 | import org.eclipse.xtext.xbase.lib.Exceptions; | ||
15 | import org.eclipse.xtext.xbase.lib.InputOutput; | 32 | import org.eclipse.xtext.xbase.lib.InputOutput; |
33 | import org.eclipse.xtext.xbase.lib.ObjectExtensions; | ||
34 | import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; | ||
16 | 35 | ||
17 | @SuppressWarnings("all") | 36 | @SuppressWarnings("all") |
18 | public class FAMTest { | 37 | public class FAMTest { |
19 | public static void main(final String[] args) { | 38 | public static void main(final String[] args) { |
20 | StringConcatenation _builder = new StringConcatenation(); | 39 | try { |
21 | _builder.append("initialModels/"); | 40 | final Ecore2Logic ecore2Logic = new Ecore2Logic(); |
22 | final FileSystemWorkspace inputs = new FileSystemWorkspace(_builder.toString(), ""); | 41 | final Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic); |
23 | StringConcatenation _builder_1 = new StringConcatenation(); | 42 | final InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic(); |
24 | _builder_1.append("output/FAMTest/"); | 43 | StringConcatenation _builder = new StringConcatenation(); |
25 | final FileSystemWorkspace workspace = new FileSystemWorkspace(_builder_1.toString(), ""); | 44 | _builder.append("initialModels/"); |
26 | workspace.initAndClear(); | 45 | final FileSystemWorkspace inputs = new FileSystemWorkspace(_builder.toString(), ""); |
27 | final Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; | 46 | StringConcatenation _builder_1 = new StringConcatenation(); |
28 | final Map<String, Object> map = reg.getExtensionToFactoryMap(); | 47 | _builder_1.append("output/FAMTest/"); |
29 | XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); | 48 | final FileSystemWorkspace workspace = new FileSystemWorkspace(_builder_1.toString(), ""); |
30 | map.put("logicproblem", _xMIResourceFactoryImpl); | 49 | workspace.initAndClear(); |
31 | InputOutput.<String>println("Input and output workspaces are created"); | 50 | final Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; |
32 | final EcoreMetamodelDescriptor metamodel = GeneralTest.loadMetamodel(FunctionalarchitecturePackage.eINSTANCE); | 51 | final Map<String, Object> map = reg.getExtensionToFactoryMap(); |
33 | final EList<EObject> partialModel = GeneralTest.loadPartialModel(inputs, "FaModel.xmi"); | 52 | XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); |
34 | final ViatraQuerySetDescriptor queries = GeneralTest.loadQueries(metamodel, FamPatterns.instance()); | 53 | map.put("logicproblem", _xMIResourceFactoryImpl); |
35 | InputOutput.<String>println("DSL loaded"); | 54 | InputOutput.<String>println("Input and output workspaces are created"); |
36 | GeneralTest.createAndSolveProblem(metamodel, partialModel, queries, workspace); | 55 | final EcoreMetamodelDescriptor metamodel = GeneralTest.loadMetamodel(FunctionalarchitecturePackage.eINSTANCE); |
56 | final EList<EObject> partialModel = GeneralTest.loadPartialModel(inputs, "FaModel.xmi"); | ||
57 | final ViatraQuerySetDescriptor queries = GeneralTest.loadQueries(metamodel, FamPatterns.instance()); | ||
58 | InputOutput.<String>println("DSL loaded"); | ||
59 | Ecore2LogicConfiguration _ecore2LogicConfiguration = new Ecore2LogicConfiguration(); | ||
60 | final TracedOutput<LogicProblem, Ecore2Logic_Trace> modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, _ecore2LogicConfiguration); | ||
61 | LogicProblem problem = modelGenerationProblem.getOutput(); | ||
62 | workspace.writeModel(problem, "Fam.logicproblem"); | ||
63 | InputOutput.<String>println("Problem created"); | ||
64 | long startTime = System.currentTimeMillis(); | ||
65 | LogicReasoner reasoner = null; | ||
66 | VampireSolver _vampireSolver = new VampireSolver(); | ||
67 | reasoner = _vampireSolver; | ||
68 | final HashMap<Class, Integer> classMapMin = new HashMap<Class, Integer>(); | ||
69 | classMapMin.put(Function.class, Integer.valueOf(1)); | ||
70 | classMapMin.put(functionalarchitecture.FunctionalInterface.class, Integer.valueOf(2)); | ||
71 | classMapMin.put(FunctionalOutput.class, Integer.valueOf(3)); | ||
72 | final Map<Type, Integer> typeMapMin = GeneralTest.getTypeMap(classMapMin, metamodel, ecore2Logic, modelGenerationProblem.getTrace()); | ||
73 | final HashMap<Class, Integer> classMapMax = new HashMap<Class, Integer>(); | ||
74 | classMapMax.put(Function.class, Integer.valueOf(5)); | ||
75 | classMapMax.put(functionalarchitecture.FunctionalInterface.class, Integer.valueOf(2)); | ||
76 | classMapMax.put(FunctionalOutput.class, Integer.valueOf(4)); | ||
77 | final Map<Type, Integer> typeMapMax = GeneralTest.getTypeMap(classMapMax, metamodel, ecore2Logic, modelGenerationProblem.getTrace()); | ||
78 | VampireSolverConfiguration _vampireSolverConfiguration = new VampireSolverConfiguration(); | ||
79 | final Procedure1<VampireSolverConfiguration> _function = (VampireSolverConfiguration it) -> { | ||
80 | it.documentationLevel = DocumentationLevel.FULL; | ||
81 | it.typeScopes.minNewElements = 4; | ||
82 | it.typeScopes.maxNewElements = 5; | ||
83 | int _size = typeMapMin.size(); | ||
84 | boolean _notEquals = (_size != 0); | ||
85 | if (_notEquals) { | ||
86 | it.typeScopes.minNewElementsByType = typeMapMin; | ||
87 | } | ||
88 | int _size_1 = typeMapMin.size(); | ||
89 | boolean _notEquals_1 = (_size_1 != 0); | ||
90 | if (_notEquals_1) { | ||
91 | it.typeScopes.maxNewElementsByType = typeMapMax; | ||
92 | } | ||
93 | it.contCycleLevel = 5; | ||
94 | it.uniquenessDuplicates = false; | ||
95 | }; | ||
96 | final VampireSolverConfiguration vampireConfig = ObjectExtensions.<VampireSolverConfiguration>operator_doubleArrow(_vampireSolverConfiguration, _function); | ||
97 | LogicResult solution = reasoner.solve(problem, vampireConfig, workspace); | ||
98 | long _currentTimeMillis = System.currentTimeMillis(); | ||
99 | long _minus = (_currentTimeMillis - startTime); | ||
100 | long totalTimeMin = (_minus / 60000); | ||
101 | long _currentTimeMillis_1 = System.currentTimeMillis(); | ||
102 | long _minus_1 = (_currentTimeMillis_1 - startTime); | ||
103 | long _divide = (_minus_1 / 1000); | ||
104 | long totalTimeSec = (_divide % 60); | ||
105 | InputOutput.<String>println("Problem solved"); | ||
106 | InputOutput.<String>println(((("Time was: " + Long.valueOf(totalTimeMin)) + ":") + Long.valueOf(totalTimeSec))); | ||
107 | } catch (Throwable _e) { | ||
108 | throw Exceptions.sneakyThrow(_e); | ||
109 | } | ||
37 | } | 110 | } |
38 | } | 111 | } |