diff options
author | 2020-05-06 16:16:57 -0400 | |
---|---|---|
committer | 2020-05-06 16:16:57 -0400 | |
commit | e44d27fde5c3b6c933ea3de33781f6ad03d6545b (patch) | |
tree | fd4a58ed41ff3a91702cb1b7b89a9d9688fc1b4e /Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen | |
parent | Adjust classpath for Z3 in viatra2logic (diff) | |
download | VIATRA-Generator-e44d27fde5c3b6c933ea3de33781f6ad03d6545b.tar.gz VIATRA-Generator-e44d27fde5c3b6c933ea3de33781f6ad03d6545b.tar.zst VIATRA-Generator-e44d27fde5c3b6c933ea3de33781f6ad03d6545b.zip |
Adjustments to FamilyTree and Pledge Case studies
Diffstat (limited to 'Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen')
3 files changed, 36 insertions, 16 deletions
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.GeneratePledgeModels.xtendbin b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.GeneratePledgeModels.xtendbin index 7c005ae3..3430ce88 100644 --- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.GeneratePledgeModels.xtendbin +++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.GeneratePledgeModels.xtendbin | |||
Binary files differ | |||
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.gitignore b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.gitignore index 01940246..f3c882e4 100644 --- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.gitignore +++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.gitignore | |||
@@ -4,3 +4,5 @@ | |||
4 | /GenerateScenarios.java | 4 | /GenerateScenarios.java |
5 | /.GenerateScenarios.xtendbin | 5 | /.GenerateScenarios.xtendbin |
6 | /.GeneratePledgeModels.java._trace | 6 | /.GeneratePledgeModels.java._trace |
7 | /.GeneratePledgeModels.xtendbin | ||
8 | /GeneratePledgeModels.java | ||
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GeneratePledgeModels.java b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GeneratePledgeModels.java index 24f2b9b4..35ddb32f 100644 --- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GeneratePledgeModels.java +++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GeneratePledgeModels.java | |||
@@ -8,6 +8,7 @@ import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic; | |||
8 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration; | 8 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration; |
9 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace; | 9 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace; |
10 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; | 10 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; |
11 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel; | ||
11 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicModelInterpretation; | 12 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicModelInterpretation; |
12 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput; | 13 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput; |
13 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type; | 14 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type; |
@@ -17,13 +18,12 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult; | |||
17 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.Statistics; | 18 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.Statistics; |
18 | import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore; | 19 | import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore; |
19 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic; | 20 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic; |
20 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration; | ||
21 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicTrace; | ||
22 | import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor; | 21 | import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor; |
23 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic; | 22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic; |
24 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation; | 23 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation; |
25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml; | 24 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml; |
26 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation; | 25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation; |
26 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DebugConfiguration; | ||
27 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner; | 27 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner; |
28 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration; | 28 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration; |
29 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser; | 29 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser; |
@@ -65,7 +65,6 @@ import org.eclipse.xtext.xbase.lib.IterableExtensions; | |||
65 | import org.eclipse.xtext.xbase.lib.ListExtensions; | 65 | import org.eclipse.xtext.xbase.lib.ListExtensions; |
66 | import org.eclipse.xtext.xbase.lib.ObjectExtensions; | 66 | import org.eclipse.xtext.xbase.lib.ObjectExtensions; |
67 | import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; | 67 | import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; |
68 | import queries.Case_study_A; | ||
69 | 68 | ||
70 | @SuppressWarnings("all") | 69 | @SuppressWarnings("all") |
71 | public class GeneratePledgeModels { | 70 | public class GeneratePledgeModels { |
@@ -100,26 +99,28 @@ public class GeneratePledgeModels { | |||
100 | _builder_2.append("/"); | 99 | _builder_2.append("/"); |
101 | String _plus_1 = (_plus + _builder_2); | 100 | String _plus_1 = (_plus + _builder_2); |
102 | final FileSystemWorkspace workspace = new FileSystemWorkspace(_plus_1, ""); | 101 | final FileSystemWorkspace workspace = new FileSystemWorkspace(_plus_1, ""); |
102 | StringConcatenation _builder_3 = new StringConcatenation(); | ||
103 | _builder_3.append("output/"); | ||
104 | String _plus_2 = (_builder_3.toString() + formattedDate); | ||
105 | StringConcatenation _builder_4 = new StringConcatenation(); | ||
106 | _builder_4.append("/debug/"); | ||
107 | String _plus_3 = (_plus_2 + _builder_4); | ||
108 | final FileSystemWorkspace debug = new FileSystemWorkspace(_plus_3, ""); | ||
103 | workspace.initAndClear(); | 109 | workspace.initAndClear(); |
104 | InputOutput.<String>println("Input and output workspaces are created"); | 110 | InputOutput.<String>println("Input and output workspaces are created"); |
105 | final EcoreMetamodelDescriptor metamodel = GeneratePledgeModels.loadMetamodel(TaxationPackage.eINSTANCE); | 111 | final EcoreMetamodelDescriptor metamodel = GeneratePledgeModels.loadMetamodel(TaxationPackage.eINSTANCE); |
106 | final EList<EObject> partialModel = GeneratePledgeModels.loadPartialModel(inputs, "Household.xmi"); | 112 | final EList<EObject> partialModel = GeneratePledgeModels.loadPartialModel(inputs, "Household.xmi"); |
107 | final ViatraQuerySetDescriptor queries = GeneratePledgeModels.loadQueries(metamodel, Case_study_A.instance()); | ||
108 | InputOutput.<String>println("DSL loaded"); | 113 | InputOutput.<String>println("DSL loaded"); |
109 | final int SIZE = 10; | 114 | final int SIZE = 2; |
110 | int REPS = 1; | 115 | int REPS = 1; |
111 | final int RUNTIME = 600; | 116 | final int RUNTIME = 600; |
112 | Ecore2LogicConfiguration _ecore2LogicConfiguration = new Ecore2LogicConfiguration(); | 117 | Ecore2LogicConfiguration _ecore2LogicConfiguration = new Ecore2LogicConfiguration(); |
113 | final TracedOutput<LogicProblem, Ecore2Logic_Trace> modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, _ecore2LogicConfiguration); | 118 | final TracedOutput<LogicProblem, Ecore2Logic_Trace> modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, _ecore2LogicConfiguration); |
114 | LogicProblem problem = modelGenerationProblem.getOutput(); | 119 | LogicProblem problem = modelGenerationProblem.getOutput(); |
115 | Viatra2LogicConfiguration _viatra2LogicConfiguration = new Viatra2LogicConfiguration(); | 120 | debug.writeModel(problem, "problem.logicproblem"); |
116 | final TracedOutput<LogicProblem, Viatra2LogicTrace> validModelExtensionProblem = viatra2Logic.transformQueries(queries, modelGenerationProblem, _viatra2LogicConfiguration); | ||
117 | problem = validModelExtensionProblem.getOutput(); | ||
118 | workspace.writeModel(problem, "problem.logicproblem"); | ||
119 | InputOutput.<String>println("Problem created"); | 121 | InputOutput.<String>println("Problem created"); |
120 | for (int i = 0; (i < REPS); i++) { | 122 | for (int i = 0; (i < REPS); i++) { |
121 | { | 123 | { |
122 | InputOutput.<String>println((("Run #" + Integer.valueOf(i)) + ":")); | ||
123 | ViatraReasoner reasoner = new ViatraReasoner(); | 124 | ViatraReasoner reasoner = new ViatraReasoner(); |
124 | final TreeSet<Integer> knownIntegers = new TreeSet<Integer>(); | 125 | final TreeSet<Integer> knownIntegers = new TreeSet<Integer>(); |
125 | CollectionExtensions.<Integer>addAll(knownIntegers, Integer.valueOf(0)); | 126 | CollectionExtensions.<Integer>addAll(knownIntegers, Integer.valueOf(0)); |
@@ -130,8 +131,14 @@ public class GeneratePledgeModels { | |||
130 | CollectionExtensions.<String>addAll(knownStrings, "r0", "r1", "r2"); | 131 | CollectionExtensions.<String>addAll(knownStrings, "r0", "r1", "r2"); |
131 | ViatraReasonerConfiguration _viatraReasonerConfiguration = new ViatraReasonerConfiguration(); | 132 | ViatraReasonerConfiguration _viatraReasonerConfiguration = new ViatraReasonerConfiguration(); |
132 | final Procedure1<ViatraReasonerConfiguration> _function = (ViatraReasonerConfiguration it) -> { | 133 | final Procedure1<ViatraReasonerConfiguration> _function = (ViatraReasonerConfiguration it) -> { |
134 | it.documentationLevel = DocumentationLevel.FULL; | ||
135 | DebugConfiguration _debugConfiguration = new DebugConfiguration(); | ||
136 | final Procedure1<DebugConfiguration> _function_1 = (DebugConfiguration it_1) -> { | ||
137 | it_1.logging = true; | ||
138 | }; | ||
139 | DebugConfiguration _doubleArrow = ObjectExtensions.<DebugConfiguration>operator_doubleArrow(_debugConfiguration, _function_1); | ||
140 | it.debugCongiguration = _doubleArrow; | ||
133 | it.runtimeLimit = RUNTIME; | 141 | it.runtimeLimit = RUNTIME; |
134 | it.typeScopes.maxNewElements = SIZE; | ||
135 | boolean _isEmpty = knownIntegers.isEmpty(); | 142 | boolean _isEmpty = knownIntegers.isEmpty(); |
136 | boolean _not = (!_isEmpty); | 143 | boolean _not = (!_isEmpty); |
137 | if (_not) { | 144 | if (_not) { |
@@ -144,19 +151,21 @@ public class GeneratePledgeModels { | |||
144 | } | 151 | } |
145 | }; | 152 | }; |
146 | final ViatraReasonerConfiguration solverConfig = ObjectExtensions.<ViatraReasonerConfiguration>operator_doubleArrow(_viatraReasonerConfiguration, _function); | 153 | final ViatraReasonerConfiguration solverConfig = ObjectExtensions.<ViatraReasonerConfiguration>operator_doubleArrow(_viatraReasonerConfiguration, _function); |
154 | InputOutput.<String>println((("Run #" + Integer.valueOf(i)) + ":")); | ||
147 | final long startTime = System.currentTimeMillis(); | 155 | final long startTime = System.currentTimeMillis(); |
148 | LogicResult solution = reasoner.solve(problem, solverConfig, workspace); | 156 | LogicResult solution = reasoner.solve(problem, solverConfig, debug); |
149 | long _currentTimeMillis_1 = System.currentTimeMillis(); | 157 | long _currentTimeMillis_1 = System.currentTimeMillis(); |
150 | final long totalTime = (_currentTimeMillis_1 - startTime); | 158 | final long totalTime = (_currentTimeMillis_1 - startTime); |
151 | InputOutput.<String>println(" Problem Solved"); | 159 | InputOutput.<String>println(" Problem Solved"); |
152 | GeneratePledgeModels.writeStats(solution, totalTime); | 160 | GeneratePledgeModels.writeStats(solution, totalTime, solverConfig); |
153 | if ((solution instanceof ModelResult)) { | 161 | if ((solution instanceof ModelResult)) { |
154 | GeneratePledgeModels.writeRepresentation(solution, workspace, i); | 162 | GeneratePledgeModels.writeRepresentation(solution, workspace, i); |
163 | GeneratePledgeModels.writeInterpretation(solution, logic2Ecore, workspace, i, reasoner, modelGenerationProblem); | ||
155 | InputOutput.<String>println(" Solution saved and visualised"); | 164 | InputOutput.<String>println(" Solution saved and visualised"); |
156 | } else { | 165 | } else { |
157 | String _string = solution.getClass().getSimpleName().toString(); | 166 | String _string = solution.getClass().getSimpleName().toString(); |
158 | String _plus_2 = (" Returned: " + _string); | 167 | String _plus_4 = (" Returned: " + _string); |
159 | InputOutput.<String>println(_plus_2); | 168 | InputOutput.<String>println(_plus_4); |
160 | } | 169 | } |
161 | final Runtime r = Runtime.getRuntime(); | 170 | final Runtime r = Runtime.getRuntime(); |
162 | r.gc(); | 171 | r.gc(); |
@@ -284,11 +293,20 @@ public class GeneratePledgeModels { | |||
284 | } | 293 | } |
285 | } | 294 | } |
286 | 295 | ||
287 | public static String writeStats(final LogicResult solution, final long time) { | 296 | public static String writeStats(final LogicResult solution, final long time, final ViatraReasonerConfiguration config) { |
288 | String _xblockexpression = null; | 297 | String _xblockexpression = null; |
289 | { | 298 | { |
290 | final Statistics stats = solution.getStatistics(); | 299 | final Statistics stats = solution.getStatistics(); |
291 | InputOutput.<String>println(" Statistics:"); | 300 | InputOutput.<String>println(" Statistics:"); |
301 | Object _xifexpression = null; | ||
302 | if ((config.typeScopes.maxNewElements == 2147483647)) { | ||
303 | _xifexpression = "*"; | ||
304 | } else { | ||
305 | _xifexpression = Integer.valueOf(config.typeScopes.maxNewElements); | ||
306 | } | ||
307 | String _plus = (((" #new nodes : [" + Integer.valueOf(config.typeScopes.minNewElements)) + "..") + _xifexpression); | ||
308 | String _plus_1 = (_plus + "]"); | ||
309 | InputOutput.<String>println(_plus_1); | ||
292 | _xblockexpression = InputOutput.<String>println(((" \"solve\" time: " + Double.valueOf((((double) time) / 1000))) + " s")); | 310 | _xblockexpression = InputOutput.<String>println(((" \"solve\" time: " + Double.valueOf((((double) time) / 1000))) + " s")); |
293 | } | 311 | } |
294 | return _xblockexpression; | 312 | return _xblockexpression; |