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/run/GenerateFromConfig.java | |
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/run/GenerateFromConfig.java')
-rw-r--r-- | Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GenerateFromConfig.java | 225 |
1 files changed, 0 insertions, 225 deletions
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 | } | ||