diff options
author | 2020-05-17 01:58:13 -0400 | |
---|---|---|
committer | 2020-05-17 01:58:13 -0400 | |
commit | 48871e1be75169e4e3768a7c0c47791e02c7e634 (patch) | |
tree | cfcd4e4fdc0dea4f4b0102a610459ed7509f47f8 /Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen | |
parent | Adjust Taxation model. (diff) | |
download | VIATRA-Generator-48871e1be75169e4e3768a7c0c47791e02c7e634.tar.gz VIATRA-Generator-48871e1be75169e4e3768a7c0c47791e02c7e634.tar.zst VIATRA-Generator-48871e1be75169e4e3768a7c0c47791e02c7e634.zip |
update measurements setup. make archives.
Diffstat (limited to 'Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen')
4 files changed, 0 insertions, 719 deletions
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.GenerateFromConfig.xtendbin b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.GenerateFromConfig.xtendbin deleted file mode 100644 index 729dff74..00000000 --- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.GenerateFromConfig.xtendbin +++ /dev/null | |||
Binary files differ | |||
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 deleted file mode 100644 index 189920e9..00000000 --- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.GeneratePledgeModels.xtendbin +++ /dev/null | |||
Binary files differ | |||
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GenerateFromConfig.java b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GenerateFromConfig.java deleted file mode 100644 index 763e2917..00000000 --- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GenerateFromConfig.java +++ /dev/null | |||
@@ -1,225 +0,0 @@ | |||
1 | package run; | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.Command; | ||
4 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.Config; | ||
5 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigEntry; | ||
6 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigSpecification; | ||
7 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript; | ||
8 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.File; | ||
9 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.FileSpecification; | ||
10 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.GenerationTask; | ||
11 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.IntervallNumber; | ||
12 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.NumberSpecification; | ||
13 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ObjectTypeScope; | ||
14 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.RuntimeEntry; | ||
15 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.Scope; | ||
16 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ScopeSpecification; | ||
17 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.TypeScope; | ||
18 | import hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor; | ||
19 | import hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor; | ||
20 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult; | ||
21 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.Statistics; | ||
22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration; | ||
23 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace; | ||
24 | import java.io.PrintWriter; | ||
25 | import java.text.SimpleDateFormat; | ||
26 | import java.util.Date; | ||
27 | import java.util.Map; | ||
28 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
29 | import org.eclipse.emf.common.util.URI; | ||
30 | import org.eclipse.emf.ecore.resource.Resource; | ||
31 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; | ||
32 | import org.eclipse.xtend2.lib.StringConcatenation; | ||
33 | import org.eclipse.xtext.xbase.lib.Exceptions; | ||
34 | import org.eclipse.xtext.xbase.lib.Functions.Function0; | ||
35 | import org.eclipse.xtext.xbase.lib.InputOutput; | ||
36 | |||
37 | @SuppressWarnings("all") | ||
38 | public class GenerateFromConfig { | ||
39 | private static final int SIZE_LB = 200; | ||
40 | |||
41 | private static final int SIZE_UB = 200; | ||
42 | |||
43 | private static final int SIZE_MUL = 1; | ||
44 | |||
45 | private static final int SIZE_INC = 5; | ||
46 | |||
47 | private static int REPS = 3; | ||
48 | |||
49 | private static final int RUNTIME = 600; | ||
50 | |||
51 | private static final String DOMAIN = "FamilyTree"; | ||
52 | |||
53 | private static final boolean QUERIES = true; | ||
54 | |||
55 | private static final boolean INITIAL = true; | ||
56 | |||
57 | private static final boolean INDIV_WRT = false; | ||
58 | |||
59 | private static final boolean GLOBAL_WRT = false; | ||
60 | |||
61 | private static final String q2t = new Function0<String>() { | ||
62 | @Override | ||
63 | public String apply() { | ||
64 | String _xifexpression = null; | ||
65 | if (GenerateFromConfig.QUERIES) { | ||
66 | _xifexpression = "Y"; | ||
67 | } else { | ||
68 | _xifexpression = "N"; | ||
69 | } | ||
70 | return _xifexpression; | ||
71 | } | ||
72 | }.apply(); | ||
73 | |||
74 | public static void main(final String[] args) { | ||
75 | try { | ||
76 | Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); | ||
77 | XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); | ||
78 | _extensionToFactoryMap.put("xmi", _xMIResourceFactoryImpl); | ||
79 | long _currentTimeMillis = System.currentTimeMillis(); | ||
80 | final Date date = new Date(_currentTimeMillis); | ||
81 | final SimpleDateFormat format = new SimpleDateFormat("dd-HHmm"); | ||
82 | String _format = format.format(date); | ||
83 | final String formattedDate = ((GenerateFromConfig.DOMAIN + "/") + _format); | ||
84 | StringConcatenation _builder = new StringConcatenation(); | ||
85 | _builder.append("output/"); | ||
86 | String _plus = (_builder.toString() + formattedDate); | ||
87 | StringConcatenation _builder_1 = new StringConcatenation(); | ||
88 | _builder_1.append("/"); | ||
89 | String _plus_1 = (_plus + _builder_1); | ||
90 | final FileSystemWorkspace workspace = new FileSystemWorkspace(_plus_1, ""); | ||
91 | workspace.initAndClear(); | ||
92 | InputOutput.<String>println("Input and output workspaces are created"); | ||
93 | final ScriptExecutor executor = new ScriptExecutor(); | ||
94 | final String path = (("config//generic" + GenerateFromConfig.DOMAIN) + ".vsconfig"); | ||
95 | ConfigurationScript config = StandaloneScriptExecutor.loadScript(path); | ||
96 | InputOutput.<String>println("Config File loaded"); | ||
97 | PrintWriter global_writer = null; | ||
98 | final String header = "domain, queries?,size,model?,timeout,measuredTime,TransformatonTime,SolverTime\n"; | ||
99 | if (GenerateFromConfig.GLOBAL_WRT) { | ||
100 | URI _workspaceURI = workspace.getWorkspaceURI(); | ||
101 | String _plus_2 = (_workspaceURI + "//_"); | ||
102 | String _plus_3 = (_plus_2 + GenerateFromConfig.DOMAIN); | ||
103 | String _plus_4 = (_plus_3 + Integer.valueOf(GenerateFromConfig.SIZE_LB)); | ||
104 | String _plus_5 = (_plus_4 + "to"); | ||
105 | String _plus_6 = (_plus_5 + Integer.valueOf(GenerateFromConfig.SIZE_UB)); | ||
106 | String _plus_7 = (_plus_6 + "x"); | ||
107 | String _plus_8 = (_plus_7 + Integer.valueOf(GenerateFromConfig.REPS)); | ||
108 | String _plus_9 = (_plus_8 + "q"); | ||
109 | String _plus_10 = (_plus_9 + GenerateFromConfig.q2t); | ||
110 | String _plus_11 = (_plus_10 + "-"); | ||
111 | String _plus_12 = (_plus_11 + formattedDate); | ||
112 | String _plus_13 = (_plus_12 + ".csv"); | ||
113 | PrintWriter _printWriter = new PrintWriter(_plus_13); | ||
114 | global_writer = _printWriter; | ||
115 | global_writer.append(header); | ||
116 | } | ||
117 | int NEXT_INC = GenerateFromConfig.SIZE_INC; | ||
118 | { | ||
119 | int size = GenerateFromConfig.SIZE_LB; | ||
120 | boolean _while = (size <= GenerateFromConfig.SIZE_UB); | ||
121 | while (_while) { | ||
122 | { | ||
123 | int _NEXT_INC = NEXT_INC; | ||
124 | NEXT_INC = (_NEXT_INC * GenerateFromConfig.SIZE_MUL); | ||
125 | PrintWriter indiv_writer = null; | ||
126 | if (GenerateFromConfig.INDIV_WRT) { | ||
127 | URI _workspaceURI_1 = workspace.getWorkspaceURI(); | ||
128 | String _plus_14 = (_workspaceURI_1 + "//__"); | ||
129 | String _plus_15 = (_plus_14 + GenerateFromConfig.DOMAIN); | ||
130 | String _plus_16 = (_plus_15 + "Sz"); | ||
131 | String _plus_17 = (_plus_16 + Integer.valueOf(size)); | ||
132 | String _plus_18 = (_plus_17 + "x"); | ||
133 | String _plus_19 = (_plus_18 + Integer.valueOf(GenerateFromConfig.REPS)); | ||
134 | String _plus_20 = (_plus_19 + "q"); | ||
135 | String _plus_21 = (_plus_20 + GenerateFromConfig.q2t); | ||
136 | String _plus_22 = (_plus_21 + "-"); | ||
137 | String _plus_23 = (_plus_22 + formattedDate); | ||
138 | String _plus_24 = (_plus_23 + | ||
139 | ".csv"); | ||
140 | PrintWriter _printWriter_1 = new PrintWriter(_plus_24); | ||
141 | indiv_writer = _printWriter_1; | ||
142 | indiv_writer.append(header); | ||
143 | } | ||
144 | InputOutput.println(); | ||
145 | InputOutput.<String>println((((("<<DOMAIN: " + GenerateFromConfig.DOMAIN) + ", SIZE=") + Integer.valueOf(size)) + ">>")); | ||
146 | final String outputPath = (((("output/" + formattedDate) + "/size") + Integer.valueOf(size)) + "/models/"); | ||
147 | final String debugPath = (((("output/" + formattedDate) + "/size") + Integer.valueOf(size)) + "/debug/"); | ||
148 | final String logPath = (debugPath + "log.txt"); | ||
149 | final String statsPath = (debugPath + "statistics.csv"); | ||
150 | Command _get = config.getCommands().get(0); | ||
151 | final GenerationTask genTask = ((GenerationTask) _get); | ||
152 | if ((!GenerateFromConfig.QUERIES)) { | ||
153 | genTask.setPatterns(null); | ||
154 | } | ||
155 | if ((!GenerateFromConfig.INITIAL)) { | ||
156 | genTask.setPartialModel(null); | ||
157 | } | ||
158 | genTask.setRuns(GenerateFromConfig.REPS); | ||
159 | Scope _scope = genTask.getScope(); | ||
160 | final ScopeSpecification scopeSpec = ((ScopeSpecification) _scope); | ||
161 | TypeScope _get_1 = scopeSpec.getScopes().get(0); | ||
162 | final ObjectTypeScope objScope = ((ObjectTypeScope) _get_1); | ||
163 | NumberSpecification _number = objScope.getNumber(); | ||
164 | final IntervallNumber interval = ((IntervallNumber) _number); | ||
165 | interval.setMin(size); | ||
166 | interval.setMaxUnlimited(true); | ||
167 | Config _config = genTask.getConfig(); | ||
168 | final ConfigSpecification configScope = ((ConfigSpecification) _config); | ||
169 | ConfigEntry _get_2 = configScope.getEntries().get(0); | ||
170 | final RuntimeEntry runtimeEntry = ((RuntimeEntry) _get_2); | ||
171 | runtimeEntry.setMillisecLimit(GenerateFromConfig.RUNTIME); | ||
172 | File _debugFolder = genTask.getDebugFolder(); | ||
173 | final FileSpecification debug = ((FileSpecification) _debugFolder); | ||
174 | debug.setPath(debugPath); | ||
175 | File _tagetFolder = genTask.getTagetFolder(); | ||
176 | final FileSpecification output = ((FileSpecification) _tagetFolder); | ||
177 | output.setPath(outputPath); | ||
178 | File _targetLogFile = genTask.getTargetLogFile(); | ||
179 | final FileSpecification log = ((FileSpecification) _targetLogFile); | ||
180 | log.setPath(logPath); | ||
181 | File _targetStatisticsFile = genTask.getTargetStatisticsFile(); | ||
182 | final FileSpecification stats = ((FileSpecification) _targetStatisticsFile); | ||
183 | stats.setPath(statsPath); | ||
184 | final long startTime = System.currentTimeMillis(); | ||
185 | NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor(); | ||
186 | executor.executeScript(config, _nullProgressMonitor); | ||
187 | long _currentTimeMillis_1 = System.currentTimeMillis(); | ||
188 | final long measuredTime = (_currentTimeMillis_1 - startTime); | ||
189 | InputOutput.<String>println((("<<END ->" + Double.valueOf((measuredTime / 1000.0))) + "s >>\n")); | ||
190 | if (GenerateFromConfig.INDIV_WRT) { | ||
191 | indiv_writer.close(); | ||
192 | } | ||
193 | } | ||
194 | int _size = size; | ||
195 | size = (_size + NEXT_INC); | ||
196 | _while = (size <= GenerateFromConfig.SIZE_UB); | ||
197 | } | ||
198 | } | ||
199 | if (GenerateFromConfig.GLOBAL_WRT) { | ||
200 | global_writer.close(); | ||
201 | } | ||
202 | } catch (Throwable _e) { | ||
203 | throw Exceptions.sneakyThrow(_e); | ||
204 | } | ||
205 | } | ||
206 | |||
207 | public static String writeStats(final LogicResult solution, final long time, final ViatraReasonerConfiguration config) { | ||
208 | String _xblockexpression = null; | ||
209 | { | ||
210 | final Statistics stats = solution.getStatistics(); | ||
211 | InputOutput.<String>println(" Statistics:"); | ||
212 | Object _xifexpression = null; | ||
213 | if ((config.typeScopes.maxNewElements == 2147483647)) { | ||
214 | _xifexpression = "*"; | ||
215 | } else { | ||
216 | _xifexpression = Integer.valueOf(config.typeScopes.maxNewElements); | ||
217 | } | ||
218 | String _plus = (((" #new nodes : [" + Integer.valueOf(config.typeScopes.minNewElements)) + "..") + _xifexpression); | ||
219 | String _plus_1 = (_plus + "]"); | ||
220 | InputOutput.<String>println(_plus_1); | ||
221 | _xblockexpression = InputOutput.<String>println(((" \"solve\" time: " + Double.valueOf((((double) time) / 1000))) + " s")); | ||
222 | } | ||
223 | return _xblockexpression; | ||
224 | } | ||
225 | } | ||
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 deleted file mode 100644 index 3ed8e047..00000000 --- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GeneratePledgeModels.java +++ /dev/null | |||
@@ -1,494 +0,0 @@ | |||
1 | package run; | ||
2 | |||
3 | import Taxation.TaxationPackage; | ||
4 | import com.google.common.base.Objects; | ||
5 | import com.google.common.collect.Iterables; | ||
6 | import familytree.FamilytreePackage; | ||
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.Ecore2Logic_Trace; | ||
10 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; | ||
11 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel; | ||
12 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicModelInterpretation; | ||
13 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput; | ||
14 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type; | ||
15 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem; | ||
16 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult; | ||
17 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult; | ||
18 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.Statistics; | ||
19 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.impl.ModelResultImpl; | ||
20 | import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore; | ||
21 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic; | ||
22 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration; | ||
23 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicTrace; | ||
24 | import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor; | ||
25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic; | ||
26 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation; | ||
27 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml; | ||
28 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation; | ||
29 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner; | ||
30 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration; | ||
31 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser; | ||
32 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace; | ||
33 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace; | ||
34 | import java.io.PrintWriter; | ||
35 | import java.math.BigDecimal; | ||
36 | import java.text.SimpleDateFormat; | ||
37 | import java.util.Collections; | ||
38 | import java.util.Date; | ||
39 | import java.util.HashMap; | ||
40 | import java.util.List; | ||
41 | import java.util.Map; | ||
42 | import java.util.Set; | ||
43 | import java.util.TreeSet; | ||
44 | import org.eclipse.emf.common.util.EList; | ||
45 | import org.eclipse.emf.common.util.URI; | ||
46 | import org.eclipse.emf.ecore.EAttribute; | ||
47 | import org.eclipse.emf.ecore.EClass; | ||
48 | import org.eclipse.emf.ecore.EEnum; | ||
49 | import org.eclipse.emf.ecore.EEnumLiteral; | ||
50 | import org.eclipse.emf.ecore.EObject; | ||
51 | import org.eclipse.emf.ecore.EPackage; | ||
52 | import org.eclipse.emf.ecore.EReference; | ||
53 | import org.eclipse.emf.ecore.EStructuralFeature; | ||
54 | import org.eclipse.emf.ecore.resource.Resource; | ||
55 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; | ||
56 | import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup; | ||
57 | import org.eclipse.viatra.query.runtime.api.IQueryGroup; | ||
58 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
59 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
60 | import org.eclipse.viatra.query.runtime.rete.matcher.ReteEngine; | ||
61 | import org.eclipse.xtend2.lib.StringConcatenation; | ||
62 | import org.eclipse.xtext.xbase.lib.CollectionExtensions; | ||
63 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; | ||
64 | import org.eclipse.xtext.xbase.lib.Exceptions; | ||
65 | import org.eclipse.xtext.xbase.lib.ExclusiveRange; | ||
66 | import org.eclipse.xtext.xbase.lib.Functions.Function0; | ||
67 | import org.eclipse.xtext.xbase.lib.Functions.Function1; | ||
68 | import org.eclipse.xtext.xbase.lib.InputOutput; | ||
69 | import org.eclipse.xtext.xbase.lib.IterableExtensions; | ||
70 | import org.eclipse.xtext.xbase.lib.ListExtensions; | ||
71 | import org.eclipse.xtext.xbase.lib.ObjectExtensions; | ||
72 | import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; | ||
73 | |||
74 | @SuppressWarnings("all") | ||
75 | public class GeneratePledgeModels { | ||
76 | private static final int SIZE_LB = 20; | ||
77 | |||
78 | private static final int SIZE_UB = 20; | ||
79 | |||
80 | private static final int SIZE_MUL = 1; | ||
81 | |||
82 | private static final int SIZE_INC = 5; | ||
83 | |||
84 | private static int REPS = 1; | ||
85 | |||
86 | private static final int RUNTIME = 600; | ||
87 | |||
88 | private static final String DOMAIN = "FamilyTree"; | ||
89 | |||
90 | private static final boolean QUERIES = false; | ||
91 | |||
92 | private static final boolean INDIV_WRT = true; | ||
93 | |||
94 | private static final boolean GLOBAL_WRT = true; | ||
95 | |||
96 | private static final String q2t = new Function0<String>() { | ||
97 | @Override | ||
98 | public String apply() { | ||
99 | String _xifexpression = null; | ||
100 | if (GeneratePledgeModels.QUERIES) { | ||
101 | _xifexpression = "Y"; | ||
102 | } else { | ||
103 | _xifexpression = "N"; | ||
104 | } | ||
105 | return _xifexpression; | ||
106 | } | ||
107 | }.apply(); | ||
108 | |||
109 | public static void main(final String[] args) { | ||
110 | try { | ||
111 | new EMFPatternLanguageStandaloneSetup().createInjectorAndDoEMFRegistration(); | ||
112 | Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); | ||
113 | XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); | ||
114 | _extensionToFactoryMap.put("xmi", _xMIResourceFactoryImpl); | ||
115 | Map<String, Object> _extensionToFactoryMap_1 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); | ||
116 | XMIResourceFactoryImpl _xMIResourceFactoryImpl_1 = new XMIResourceFactoryImpl(); | ||
117 | _extensionToFactoryMap_1.put("logicproblem", _xMIResourceFactoryImpl_1); | ||
118 | Map<String, Object> _extensionToFactoryMap_2 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); | ||
119 | XMIResourceFactoryImpl _xMIResourceFactoryImpl_2 = new XMIResourceFactoryImpl(); | ||
120 | _extensionToFactoryMap_2.put("partialmodel", _xMIResourceFactoryImpl_2); | ||
121 | ReteEngine.class.getClass(); | ||
122 | final Ecore2Logic ecore2Logic = new Ecore2Logic(); | ||
123 | final Logic2Ecore logic2Ecore = new Logic2Ecore(ecore2Logic); | ||
124 | final Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic); | ||
125 | final InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic(); | ||
126 | long _currentTimeMillis = System.currentTimeMillis(); | ||
127 | final Date date = new Date(_currentTimeMillis); | ||
128 | final SimpleDateFormat format = new SimpleDateFormat("dd-HHmm"); | ||
129 | final String formattedDate = format.format(date); | ||
130 | StringConcatenation _builder = new StringConcatenation(); | ||
131 | _builder.append("inputs/"); | ||
132 | final FileSystemWorkspace inputs = new FileSystemWorkspace(_builder.toString(), ""); | ||
133 | StringConcatenation _builder_1 = new StringConcatenation(); | ||
134 | _builder_1.append("output/"); | ||
135 | final FileSystemWorkspace dataws = new FileSystemWorkspace(_builder_1.toString(), ""); | ||
136 | StringConcatenation _builder_2 = new StringConcatenation(); | ||
137 | _builder_2.append("output/"); | ||
138 | String _plus = (_builder_2.toString() + formattedDate); | ||
139 | StringConcatenation _builder_3 = new StringConcatenation(); | ||
140 | _builder_3.append("/models/"); | ||
141 | String _plus_1 = (_plus + _builder_3); | ||
142 | final FileSystemWorkspace modelsws = new FileSystemWorkspace(_plus_1, ""); | ||
143 | StringConcatenation _builder_4 = new StringConcatenation(); | ||
144 | _builder_4.append("output/"); | ||
145 | String _plus_2 = (_builder_4.toString() + formattedDate); | ||
146 | StringConcatenation _builder_5 = new StringConcatenation(); | ||
147 | _builder_5.append("/"); | ||
148 | String _plus_3 = (_plus_2 + _builder_5); | ||
149 | final FileSystemWorkspace workspace = new FileSystemWorkspace(_plus_3, ""); | ||
150 | StringConcatenation _builder_6 = new StringConcatenation(); | ||
151 | _builder_6.append("output/"); | ||
152 | String _plus_4 = (_builder_6.toString() + GeneratePledgeModels.DOMAIN); | ||
153 | String _plus_5 = (_plus_4 + "-"); | ||
154 | String _plus_6 = (_plus_5 + formattedDate); | ||
155 | StringConcatenation _builder_7 = new StringConcatenation(); | ||
156 | _builder_7.append("/debug/"); | ||
157 | String _plus_7 = (_plus_6 + _builder_7); | ||
158 | final FileSystemWorkspace debug = new FileSystemWorkspace(_plus_7, ""); | ||
159 | workspace.initAndClear(); | ||
160 | modelsws.initAndClear(); | ||
161 | InputOutput.<String>println("Input and output workspaces are created"); | ||
162 | EcoreMetamodelDescriptor metamodel = null; | ||
163 | EList<EObject> partialModel = null; | ||
164 | ViatraQuerySetDescriptor queries = null; | ||
165 | final String DOMAIN = GeneratePledgeModels.DOMAIN; | ||
166 | if (DOMAIN != null) { | ||
167 | switch (DOMAIN) { | ||
168 | case "Taxation": | ||
169 | metamodel = GeneratePledgeModels.loadMetamodel(TaxationPackage.eINSTANCE); | ||
170 | partialModel = GeneratePledgeModels.loadPartialModel(inputs, "Household.xmi"); | ||
171 | break; | ||
172 | case "FamilyTree": | ||
173 | metamodel = GeneratePledgeModels.loadMetamodel(FamilytreePackage.eINSTANCE); | ||
174 | partialModel = GeneratePledgeModels.loadPartialModel(inputs, "FamilyTree.xmi"); | ||
175 | break; | ||
176 | default: | ||
177 | { | ||
178 | System.err.println("Unsupported Domain"); | ||
179 | throw new Exception(); | ||
180 | } | ||
181 | } | ||
182 | } else { | ||
183 | { | ||
184 | System.err.println("Unsupported Domain"); | ||
185 | throw new Exception(); | ||
186 | } | ||
187 | } | ||
188 | InputOutput.<String>println("DSL loaded"); | ||
189 | Ecore2LogicConfiguration _ecore2LogicConfiguration = new Ecore2LogicConfiguration(); | ||
190 | final TracedOutput<LogicProblem, Ecore2Logic_Trace> modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, _ecore2LogicConfiguration); | ||
191 | LogicProblem problem = modelGenerationProblem.getOutput(); | ||
192 | final TracedOutput<LogicProblem, Ecore2Logic_Trace> modelExtensionProblem = instanceModel2Logic.transform(modelGenerationProblem, partialModel); | ||
193 | problem = modelExtensionProblem.getOutput(); | ||
194 | if (GeneratePledgeModels.QUERIES) { | ||
195 | Viatra2LogicConfiguration _viatra2LogicConfiguration = new Viatra2LogicConfiguration(); | ||
196 | final TracedOutput<LogicProblem, Viatra2LogicTrace> validModelExtensionProblem = viatra2Logic.transformQueries(queries, modelExtensionProblem, _viatra2LogicConfiguration); | ||
197 | problem = validModelExtensionProblem.getOutput(); | ||
198 | } | ||
199 | InputOutput.<String>println("Problem created"); | ||
200 | PrintWriter global_writer = null; | ||
201 | final String header = "domain, queries?,size,model?,timeout,measuredTime,TransformatonTime,SolverTime\n"; | ||
202 | if (GeneratePledgeModels.GLOBAL_WRT) { | ||
203 | URI _workspaceURI = workspace.getWorkspaceURI(); | ||
204 | String _plus_8 = (_workspaceURI + "//_"); | ||
205 | String _plus_9 = (_plus_8 + GeneratePledgeModels.DOMAIN); | ||
206 | String _plus_10 = (_plus_9 + Integer.valueOf(GeneratePledgeModels.SIZE_LB)); | ||
207 | String _plus_11 = (_plus_10 + "to"); | ||
208 | String _plus_12 = (_plus_11 + Integer.valueOf(GeneratePledgeModels.SIZE_UB)); | ||
209 | String _plus_13 = (_plus_12 + "x"); | ||
210 | String _plus_14 = (_plus_13 + Integer.valueOf(GeneratePledgeModels.REPS)); | ||
211 | String _plus_15 = (_plus_14 + "q"); | ||
212 | String _plus_16 = (_plus_15 + GeneratePledgeModels.q2t); | ||
213 | String _plus_17 = (_plus_16 + "-"); | ||
214 | String _plus_18 = (_plus_17 + formattedDate); | ||
215 | String _plus_19 = (_plus_18 + ".csv"); | ||
216 | PrintWriter _printWriter = new PrintWriter(_plus_19); | ||
217 | global_writer = _printWriter; | ||
218 | global_writer.append(header); | ||
219 | } | ||
220 | int NEXT_INC = GeneratePledgeModels.SIZE_INC; | ||
221 | { | ||
222 | int size = GeneratePledgeModels.SIZE_LB; | ||
223 | boolean _while = (size <= GeneratePledgeModels.SIZE_UB); | ||
224 | while (_while) { | ||
225 | { | ||
226 | int _NEXT_INC = NEXT_INC; | ||
227 | NEXT_INC = (_NEXT_INC * GeneratePledgeModels.SIZE_MUL); | ||
228 | PrintWriter indiv_writer = null; | ||
229 | if (GeneratePledgeModels.INDIV_WRT) { | ||
230 | URI _workspaceURI_1 = workspace.getWorkspaceURI(); | ||
231 | String _plus_20 = (_workspaceURI_1 + "//__"); | ||
232 | String _plus_21 = (_plus_20 + GeneratePledgeModels.DOMAIN); | ||
233 | String _plus_22 = (_plus_21 + "Sz"); | ||
234 | String _plus_23 = (_plus_22 + Integer.valueOf(size)); | ||
235 | String _plus_24 = (_plus_23 + "x"); | ||
236 | String _plus_25 = (_plus_24 + Integer.valueOf(GeneratePledgeModels.REPS)); | ||
237 | String _plus_26 = (_plus_25 + "q"); | ||
238 | String _plus_27 = (_plus_26 + GeneratePledgeModels.q2t); | ||
239 | String _plus_28 = (_plus_27 + "-"); | ||
240 | String _plus_29 = (_plus_28 + formattedDate); | ||
241 | String _plus_30 = (_plus_29 + | ||
242 | ".csv"); | ||
243 | PrintWriter _printWriter_1 = new PrintWriter(_plus_30); | ||
244 | indiv_writer = _printWriter_1; | ||
245 | indiv_writer.append(header); | ||
246 | } | ||
247 | InputOutput.println(); | ||
248 | InputOutput.<String>println(((("DOMAIN: " + GeneratePledgeModels.DOMAIN) + ", SIZE=") + Integer.valueOf(size))); | ||
249 | for (int i = 0; (i < GeneratePledgeModels.REPS); i++) { | ||
250 | { | ||
251 | InputOutput.<String>print((("<<Run number " + Integer.valueOf(i)) + ">> : ")); | ||
252 | ViatraReasoner reasoner = new ViatraReasoner(); | ||
253 | final TreeSet<Integer> knownIntegers = new TreeSet<Integer>(); | ||
254 | CollectionExtensions.<Integer>addAll(knownIntegers, Integer.valueOf(0), Integer.valueOf(10), Integer.valueOf(20), Integer.valueOf(30), Integer.valueOf(40), Integer.valueOf(50)); | ||
255 | final TreeSet<BigDecimal> knownReals = new TreeSet<BigDecimal>(); | ||
256 | BigDecimal _bigDecimal = new BigDecimal("0.0"); | ||
257 | CollectionExtensions.<BigDecimal>addAll(knownReals, _bigDecimal); | ||
258 | final TreeSet<String> knownStrings = new TreeSet<String>(); | ||
259 | CollectionExtensions.<String>addAll(knownStrings, "r0", "r1", "r2", "r3", "r4", "r5", "r6"); | ||
260 | final int curSize = size; | ||
261 | ViatraReasonerConfiguration _viatraReasonerConfiguration = new ViatraReasonerConfiguration(); | ||
262 | final Procedure1<ViatraReasonerConfiguration> _function = (ViatraReasonerConfiguration it) -> { | ||
263 | it.documentationLevel = DocumentationLevel.NONE; | ||
264 | it.runtimeLimit = GeneratePledgeModels.RUNTIME; | ||
265 | it.typeScopes.minNewElements = curSize; | ||
266 | boolean _isEmpty = knownReals.isEmpty(); | ||
267 | boolean _not = (!_isEmpty); | ||
268 | if (_not) { | ||
269 | it.typeScopes.knownReals = knownReals; | ||
270 | } | ||
271 | }; | ||
272 | final ViatraReasonerConfiguration solverConfig = ObjectExtensions.<ViatraReasonerConfiguration>operator_doubleArrow(_viatraReasonerConfiguration, _function); | ||
273 | final long startTime = System.currentTimeMillis(); | ||
274 | LogicResult solution = reasoner.solve(problem, solverConfig, debug); | ||
275 | long _currentTimeMillis_1 = System.currentTimeMillis(); | ||
276 | final long measuredTime = (_currentTimeMillis_1 - startTime); | ||
277 | InputOutput.<String>print("<<END"); | ||
278 | Class<? extends LogicResult> _class = solution.getClass(); | ||
279 | String _string = Boolean.valueOf(Objects.equal(_class, ModelResultImpl.class)).toString(); | ||
280 | String _plus_31 = ((((((GeneratePledgeModels.DOMAIN + ",") + Boolean.valueOf(GeneratePledgeModels.QUERIES)) + ",") + Integer.valueOf(size)) + ",") + _string); | ||
281 | String _plus_32 = (_plus_31 + | ||
282 | ","); | ||
283 | String _plus_33 = (_plus_32 + Integer.valueOf(GeneratePledgeModels.RUNTIME)); | ||
284 | String _plus_34 = (_plus_33 + ","); | ||
285 | String _plus_35 = (_plus_34 + Double.valueOf((measuredTime / 1000.0))); | ||
286 | String _plus_36 = (_plus_35 + ","); | ||
287 | int _transformationTime = solution.getStatistics().getTransformationTime(); | ||
288 | double _divide = (_transformationTime / 1000.0); | ||
289 | String _plus_37 = (_plus_36 + Double.valueOf(_divide)); | ||
290 | String _plus_38 = (_plus_37 + | ||
291 | ","); | ||
292 | int _solverTime = solution.getStatistics().getSolverTime(); | ||
293 | double _divide_1 = (_solverTime / 1000.0); | ||
294 | String _plus_39 = (_plus_38 + Double.valueOf(_divide_1)); | ||
295 | final String toAddtoCSV = (_plus_39 + "\n"); | ||
296 | if (GeneratePledgeModels.GLOBAL_WRT) { | ||
297 | global_writer.append(toAddtoCSV); | ||
298 | } | ||
299 | if (GeneratePledgeModels.INDIV_WRT) { | ||
300 | indiv_writer.append(toAddtoCSV); | ||
301 | } | ||
302 | InputOutput.<String>println((("->" + Double.valueOf((measuredTime / 1000.0))) + "s")); | ||
303 | try { | ||
304 | if ((solution instanceof ModelResult)) { | ||
305 | String _plus_40 = (Integer.valueOf(size) + "_"); | ||
306 | String _plus_41 = (_plus_40 + Integer.valueOf(i)); | ||
307 | GeneratePledgeModels.writeInterpretation(solution, logic2Ecore, modelsws, _plus_41, reasoner, modelGenerationProblem); | ||
308 | InputOutput.<String>println(" (XMI Success)"); | ||
309 | } | ||
310 | } catch (final Throwable _t) { | ||
311 | if (_t instanceof Exception) { | ||
312 | final Exception e = (Exception)_t; | ||
313 | String _message = e.getMessage(); | ||
314 | String _plus_42 = (" (XMI Error)" + _message); | ||
315 | System.err.println(_plus_42); | ||
316 | } else { | ||
317 | throw Exceptions.sneakyThrow(_t); | ||
318 | } | ||
319 | } | ||
320 | try { | ||
321 | if ((solution instanceof ModelResult)) { | ||
322 | String _plus_40 = (Integer.valueOf(size) + "_"); | ||
323 | String _plus_41 = (_plus_40 + Integer.valueOf(i)); | ||
324 | GeneratePledgeModels.writeRepresentation(solution, modelsws, _plus_41); | ||
325 | InputOutput.<String>println(" (VIZ Success) >>"); | ||
326 | } | ||
327 | } catch (final Throwable _t) { | ||
328 | if (_t instanceof Exception) { | ||
329 | final Exception e = (Exception)_t; | ||
330 | String _message = e.getMessage(); | ||
331 | String _plus_42 = (" (VIZ Error)" + _message); | ||
332 | String _plus_43 = (_plus_42 + ">>"); | ||
333 | System.err.println(_plus_43); | ||
334 | } else { | ||
335 | throw Exceptions.sneakyThrow(_t); | ||
336 | } | ||
337 | } | ||
338 | InputOutput.println(); | ||
339 | final Runtime r = Runtime.getRuntime(); | ||
340 | r.gc(); | ||
341 | r.gc(); | ||
342 | r.gc(); | ||
343 | Thread.sleep(3000); | ||
344 | } | ||
345 | } | ||
346 | if (GeneratePledgeModels.INDIV_WRT) { | ||
347 | indiv_writer.close(); | ||
348 | } | ||
349 | } | ||
350 | int _size = size; | ||
351 | size = (_size + NEXT_INC); | ||
352 | _while = (size <= GeneratePledgeModels.SIZE_UB); | ||
353 | } | ||
354 | } | ||
355 | if (GeneratePledgeModels.GLOBAL_WRT) { | ||
356 | global_writer.close(); | ||
357 | } | ||
358 | } catch (Throwable _e) { | ||
359 | throw Exceptions.sneakyThrow(_e); | ||
360 | } | ||
361 | } | ||
362 | |||
363 | public static Map<Type, Integer> getTypeMap(final Map<Class, Integer> classMap, final EcoreMetamodelDescriptor metamodel, final Ecore2Logic e2l, final Ecore2Logic_Trace trace) { | ||
364 | final HashMap<Type, Integer> typeMap = new HashMap<Type, Integer>(); | ||
365 | final Function1<EClass, String> _function = (EClass s) -> { | ||
366 | return s.getName(); | ||
367 | }; | ||
368 | final Map<String, EClass> listMap = IterableExtensions.<String, EClass>toMap(metamodel.getClasses(), _function); | ||
369 | Set<Class> _keySet = classMap.keySet(); | ||
370 | for (final Class elem : _keySet) { | ||
371 | typeMap.put( | ||
372 | e2l.TypeofEClass(trace, | ||
373 | listMap.get(elem.getSimpleName())), classMap.get(elem)); | ||
374 | } | ||
375 | return typeMap; | ||
376 | } | ||
377 | |||
378 | public static EcoreMetamodelDescriptor loadMetamodel(final EPackage pckg) { | ||
379 | final List<EClass> classes = IterableExtensions.<EClass>toList(Iterables.<EClass>filter(pckg.getEClassifiers(), EClass.class)); | ||
380 | final List<EEnum> enums = IterableExtensions.<EEnum>toList(Iterables.<EEnum>filter(pckg.getEClassifiers(), EEnum.class)); | ||
381 | final Function1<EEnum, EList<EEnumLiteral>> _function = (EEnum it) -> { | ||
382 | return it.getELiterals(); | ||
383 | }; | ||
384 | final List<EEnumLiteral> literals = IterableExtensions.<EEnumLiteral>toList(Iterables.<EEnumLiteral>concat(ListExtensions.<EEnum, EList<EEnumLiteral>>map(enums, _function))); | ||
385 | final Function1<EClass, EList<EReference>> _function_1 = (EClass it) -> { | ||
386 | return it.getEReferences(); | ||
387 | }; | ||
388 | final List<EReference> references = IterableExtensions.<EReference>toList(Iterables.<EReference>concat(ListExtensions.<EClass, EList<EReference>>map(classes, _function_1))); | ||
389 | final Function1<EClass, EList<EAttribute>> _function_2 = (EClass it) -> { | ||
390 | return it.getEAttributes(); | ||
391 | }; | ||
392 | final List<EAttribute> attributes = IterableExtensions.<EAttribute>toList(Iterables.<EAttribute>concat(ListExtensions.<EClass, EList<EAttribute>>map(classes, _function_2))); | ||
393 | return new EcoreMetamodelDescriptor(classes, Collections.<EClass>unmodifiableSet(CollectionLiterals.<EClass>newHashSet()), false, enums, literals, references, attributes); | ||
394 | } | ||
395 | |||
396 | public static EList<EObject> loadPartialModel(final ReasonerWorkspace inputs, final String path) { | ||
397 | EList<EObject> _xblockexpression = null; | ||
398 | { | ||
399 | Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); | ||
400 | XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); | ||
401 | _extensionToFactoryMap.put("*", _xMIResourceFactoryImpl); | ||
402 | _xblockexpression = inputs.<EObject>readModel(EObject.class, path).eResource().getContents(); | ||
403 | } | ||
404 | return _xblockexpression; | ||
405 | } | ||
406 | |||
407 | public static ViatraQuerySetDescriptor loadQueries(final EcoreMetamodelDescriptor metamodel, final IQueryGroup i) { | ||
408 | final List<IQuerySpecification<?>> patterns = IterableExtensions.<IQuerySpecification<?>>toList(i.getSpecifications()); | ||
409 | final Function1<IQuerySpecification<?>, Boolean> _function = (IQuerySpecification<?> it) -> { | ||
410 | final Function1<PAnnotation, Boolean> _function_1 = (PAnnotation it_1) -> { | ||
411 | String _name = it_1.getName(); | ||
412 | return Boolean.valueOf(Objects.equal(_name, "Constraint")); | ||
413 | }; | ||
414 | return Boolean.valueOf(IterableExtensions.<PAnnotation>exists(it.getAllAnnotations(), _function_1)); | ||
415 | }; | ||
416 | final Set<IQuerySpecification<?>> wfPatterns = IterableExtensions.<IQuerySpecification<?>>toSet(IterableExtensions.<IQuerySpecification<?>>filter(patterns, _function)); | ||
417 | final Map<IQuerySpecification<?>, EStructuralFeature> derivedFeatures = CollectionLiterals.<IQuerySpecification<?>, EStructuralFeature>emptyMap(); | ||
418 | final ViatraQuerySetDescriptor res = new ViatraQuerySetDescriptor(patterns, wfPatterns, derivedFeatures); | ||
419 | return res; | ||
420 | } | ||
421 | |||
422 | public static void writeInterpretation(final LogicResult solution, final Logic2Ecore logic2Ecore, final ReasonerWorkspace workspace, final String id, final ViatraReasoner reasoner, final TracedOutput<LogicProblem, Ecore2Logic_Trace> mgProb) { | ||
423 | final List<? extends LogicModelInterpretation> interpretations = reasoner.getInterpretations(((ModelResult) solution)); | ||
424 | int _size = interpretations.size(); | ||
425 | ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true); | ||
426 | for (final Integer interpIndex : _doubleDotLessThan) { | ||
427 | { | ||
428 | final LogicModelInterpretation interpretation = interpretations.get((interpIndex).intValue()); | ||
429 | final EObject model = logic2Ecore.transformInterpretation(interpretation, mgProb.getTrace()); | ||
430 | StringConcatenation _builder = new StringConcatenation(); | ||
431 | _builder.append("sol-"); | ||
432 | _builder.append(id); | ||
433 | _builder.append("_"); | ||
434 | _builder.append(interpIndex); | ||
435 | _builder.append(".xmi"); | ||
436 | workspace.writeModel(model, _builder.toString()); | ||
437 | } | ||
438 | } | ||
439 | } | ||
440 | |||
441 | public static void writeRepresentation(final LogicResult solution, final ReasonerWorkspace workspace, final String id) { | ||
442 | final EList<Object> representations = solution.getRepresentation(); | ||
443 | int _size = representations.size(); | ||
444 | ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true); | ||
445 | for (final Integer representationIndex : _doubleDotLessThan) { | ||
446 | { | ||
447 | final Object representation = representations.get((representationIndex).intValue()); | ||
448 | if ((representation instanceof PartialInterpretation)) { | ||
449 | final String gml = new PartialInterpretation2Gml().transform(((PartialInterpretation)representation)); | ||
450 | StringConcatenation _builder = new StringConcatenation(); | ||
451 | _builder.append("sol-"); | ||
452 | _builder.append(id); | ||
453 | _builder.append("_"); | ||
454 | _builder.append(representationIndex); | ||
455 | _builder.append(".gml"); | ||
456 | workspace.writeText(_builder.toString(), gml); | ||
457 | final PartialInterpretationVisualisation png = new GraphvizVisualiser().visualiseConcretization(((PartialInterpretation)representation)); | ||
458 | StringConcatenation _builder_1 = new StringConcatenation(); | ||
459 | _builder_1.append("sol-"); | ||
460 | _builder_1.append(id); | ||
461 | _builder_1.append("_"); | ||
462 | _builder_1.append(representationIndex); | ||
463 | _builder_1.append(".png"); | ||
464 | png.writeToFile(workspace, _builder_1.toString()); | ||
465 | } else { | ||
466 | StringConcatenation _builder_2 = new StringConcatenation(); | ||
467 | _builder_2.append("sol-"); | ||
468 | _builder_2.append(representationIndex); | ||
469 | _builder_2.append(".txt"); | ||
470 | workspace.writeText(_builder_2.toString(), representation.toString()); | ||
471 | } | ||
472 | } | ||
473 | } | ||
474 | } | ||
475 | |||
476 | public static String writeStats(final LogicResult solution, final long time, final ViatraReasonerConfiguration config) { | ||
477 | String _xblockexpression = null; | ||
478 | { | ||
479 | final Statistics stats = solution.getStatistics(); | ||
480 | InputOutput.<String>println(" Statistics:"); | ||
481 | Object _xifexpression = null; | ||
482 | if ((config.typeScopes.maxNewElements == 2147483647)) { | ||
483 | _xifexpression = "*"; | ||
484 | } else { | ||
485 | _xifexpression = Integer.valueOf(config.typeScopes.maxNewElements); | ||
486 | } | ||
487 | String _plus = (((" #new nodes : [" + Integer.valueOf(config.typeScopes.minNewElements)) + "..") + _xifexpression); | ||
488 | String _plus_1 = (_plus + "]"); | ||
489 | InputOutput.<String>println(_plus_1); | ||
490 | _xblockexpression = InputOutput.<String>println(((" \"solve\" time: " + Double.valueOf((((double) time) / 1000))) + " s")); | ||
491 | } | ||
492 | return _xblockexpression; | ||
493 | } | ||
494 | } | ||