diff options
Diffstat (limited to 'Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run')
-rw-r--r-- | Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunVampireConfig.xtend | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunVampireConfig.xtend b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunVampireConfig.xtend new file mode 100644 index 00000000..879abc33 --- /dev/null +++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunVampireConfig.xtend | |||
@@ -0,0 +1,115 @@ | |||
1 | package run | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigSpecification | ||
4 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript | ||
5 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.FileSpecification | ||
6 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.GenerationTask | ||
7 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.IntervallNumber | ||
8 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ModelEntry | ||
9 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ObjectTypeScope | ||
10 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.PartialModelSpecification | ||
11 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.RuntimeEntry | ||
12 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ScopeSpecification | ||
13 | import hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor | ||
14 | import hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor | ||
15 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace | ||
16 | import java.text.SimpleDateFormat | ||
17 | import java.util.Date | ||
18 | import org.apache.commons.cli.BasicParser | ||
19 | import org.apache.commons.cli.CommandLine | ||
20 | import org.apache.commons.cli.CommandLineParser | ||
21 | import org.apache.commons.cli.HelpFormatter | ||
22 | import org.apache.commons.cli.Option | ||
23 | import org.apache.commons.cli.Options | ||
24 | import org.apache.commons.cli.ParseException | ||
25 | import org.eclipse.core.runtime.NullProgressMonitor | ||
26 | import org.eclipse.emf.ecore.resource.Resource | ||
27 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | ||
28 | |||
29 | class RunVampireConfig { | ||
30 | static var SIZE_LB = 10 | ||
31 | static var SIZE_UB = -1 | ||
32 | |||
33 | static var RUNS = 3 | ||
34 | static var MODELS = 3 | ||
35 | static var RUNTIME = 300 | ||
36 | |||
37 | static var DOMAIN = "Yakindu-Vampire" // "FamilyTree", "Satellite", "Taxation" | ||
38 | static val QUERIES = false | ||
39 | static val INITIAL = true | ||
40 | |||
41 | def static void main(String[] args) { | ||
42 | // Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("xmi", new XMIResourceFactoryImpl) | ||
43 | // val workspace = new FileSystemWorkspace('''x/''', "") | ||
44 | // workspace.initAndClear | ||
45 | |||
46 | // Workspace setup | ||
47 | val Date date = new Date(System.currentTimeMillis) | ||
48 | val SimpleDateFormat format = new SimpleDateFormat("dd-HHmm") | ||
49 | val formattedDate = format.format(date) | ||
50 | |||
51 | val executor = new ScriptExecutor | ||
52 | val path = "config//genericVampire.vsconfig" | ||
53 | var ConfigurationScript config = StandaloneScriptExecutor.loadScript(path) | ||
54 | |||
55 | // ///////////////////////// | ||
56 | // BEGIN RUN | ||
57 | println( | ||
58 | "<<DOMAIN: " + DOMAIN + ", SIZE=" + SIZE_LB + "to" + SIZE_UB + ", Runs=" + RUNS + ", ModelsPerRun=" + | ||
59 | MODELS + ", Runtime=" + RUNTIME + ">>") | ||
60 | |||
61 | var naming = "size" + toStr(SIZE_LB) + "to" + toStr(SIZE_UB) + "r" + RUNS + "n" + MODELS + "rt" + RUNTIME | ||
62 | val outputPath = "output-Vampire/" + naming + "_" + formattedDate + "/models" | ||
63 | val debugPath = "output-Vampire/" + naming + "_" + formattedDate + "/debug" | ||
64 | val logPath = debugPath + "/log.txt" | ||
65 | val statsPath = "output-Vampire/" + naming + "_" + formattedDate + "/stats.csv" | ||
66 | |||
67 | // Basic Adjustments | ||
68 | val genTask = config.commands.get(0) as GenerationTask | ||
69 | if(!QUERIES) genTask.patterns = null | ||
70 | if(!INITIAL) genTask.partialModel = null | ||
71 | genTask.runs = RUNS | ||
72 | genTask.number = MODELS | ||
73 | |||
74 | // Size | ||
75 | val scopeSpec = genTask.scope as ScopeSpecification | ||
76 | val objScope = scopeSpec.scopes.get(0) as ObjectTypeScope | ||
77 | val interval = objScope.number as IntervallNumber | ||
78 | interval.min = SIZE_LB | ||
79 | if (SIZE_UB == -1) | ||
80 | interval.maxUnlimited = true | ||
81 | else { | ||
82 | interval.maxUnlimited = false | ||
83 | interval.maxNumber = SIZE_UB | ||
84 | } | ||
85 | |||
86 | // workspace.writeModel(config, '''x.xmi''') | ||
87 | // Runtime | ||
88 | val configScope = genTask.config as ConfigSpecification | ||
89 | val runtimeEntry = configScope.entries.get(0) as RuntimeEntry | ||
90 | runtimeEntry.millisecLimit = RUNTIME | ||
91 | |||
92 | // Output locations | ||
93 | val debug = genTask.debugFolder as FileSpecification | ||
94 | debug.path = debugPath | ||
95 | val output = genTask.tagetFolder as FileSpecification | ||
96 | output.path = outputPath | ||
97 | val log = genTask.targetLogFile as FileSpecification | ||
98 | log.path = logPath | ||
99 | val stats = genTask.targetStatisticsFile as FileSpecification | ||
100 | stats.path = statsPath | ||
101 | |||
102 | // Run Generator | ||
103 | println() | ||
104 | executor.executeScript(config, new NullProgressMonitor) | ||
105 | |||
106 | println() | ||
107 | } | ||
108 | |||
109 | static def String toStr(int i) { | ||
110 | var toAdd = "" | ||
111 | if(i < 100 && i != -1) toAdd = "0" | ||
112 | return toAdd + i | ||
113 | } | ||
114 | |||
115 | } | ||