aboutsummaryrefslogtreecommitdiffstats
path: root/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend')
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend123
1 files changed, 123 insertions, 0 deletions
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend
new file mode 100644
index 00000000..c2ad68f5
--- /dev/null
+++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/src/run/RunGeneratorConfig.xtend
@@ -0,0 +1,123 @@
1package run
2
3import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigSpecification
4import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript
5import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.FileSpecification
6import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.GenerationTask
7import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.IntervallNumber
8import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ObjectTypeScope
9import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.RuntimeEntry
10import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ScopeSpecification
11import hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor
12import hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor
13import java.text.SimpleDateFormat
14import java.util.Date
15import org.apache.commons.cli.CommandLine
16import org.apache.commons.cli.CommandLineParser
17import org.apache.commons.cli.HelpFormatter
18import org.apache.commons.cli.Option
19import org.apache.commons.cli.Options
20import org.apache.commons.cli.ParseException
21import org.eclipse.core.runtime.NullProgressMonitor
22import org.apache.commons.cli.BasicParser
23
24class RunGeneratorConfig {
25 static var SIZE = 20
26
27 static var RUNS = 10
28 static var RUNTIME = 600
29
30 static var DOMAIN = "FamilyTree" // "FamilyTree", "Taxation", "Satellite"
31 static val QUERIES = true
32 static val INITIAL = true
33
34 def static void main(String[] args) {
35
36 val options = new Options()
37
38 val s = new Option("s", "size", true, "generated model Lower bound")
39 options.addOption(s)
40
41 val n = new Option("n", "numRuns", true, "number of runs")
42 options.addOption(n)
43
44 val rt = new Option("rt", "runtime", true, "runtime limit")
45 options.addOption(rt)
46
47 val d = new Option("d", "domain", true, "domain")
48 options.addOption(d)
49
50 val CommandLineParser parser = new BasicParser
51 val formatter = new HelpFormatter()
52 var CommandLine cmd
53
54 try {
55 cmd = parser.parse(options, args)
56 } catch (ParseException e) {
57 System.out.println(e.getMessage())
58 formatter.printHelp("utility-name", options)
59 System.exit(1)
60 }
61
62 val sIn = cmd.getOptionValue("size")
63 if(sIn !== null) SIZE = Integer.parseInt(sIn)
64 val nIn = cmd.getOptionValue("numRuns")
65 if(nIn !== null) RUNS = Integer.parseInt(nIn)
66 val rtIn = cmd.getOptionValue("runtime")
67 if(rtIn !== null) RUNTIME = Integer.parseInt(rtIn)
68 val dIn = cmd.getOptionValue("domain")
69 if(dIn !== null) DOMAIN = dIn
70
71 // Workspace setup
72 val Date date = new Date(System.currentTimeMillis)
73 val SimpleDateFormat format = new SimpleDateFormat("dd-HHmm")
74 val formattedDate = format.format(date)
75
76 val executor = new ScriptExecutor
77 val path = "config//generic" + DOMAIN + ".vsconfig"
78 var ConfigurationScript config = StandaloneScriptExecutor.loadScript(path)
79
80 // /////////////////////////
81 // BEGIN RUN
82 println("<<DOMAIN: " + DOMAIN + ", SIZE=" + SIZE + ",Runs=" + RUNS + ",Runtime=" + RUNTIME+">>\n")
83
84 val outputPath = "measurements/" + "models/"+ DOMAIN + "/size" + SIZE + "_" + formattedDate
85 val debugPath = "measurements/" + "debug/" + DOMAIN + "/size" + SIZE + "_" + formattedDate
86 val logPath = debugPath + "/log.txt"
87 val statsPath = "measurements/" + "stats/" + DOMAIN + "/size" + SIZE + "x" + RUNS + "stats_" + formattedDate + ".csv"
88
89 // Basic Adjustments
90 val genTask = config.commands.get(1) as GenerationTask
91 if(!QUERIES) genTask.patterns = null
92 if(!INITIAL) genTask.partialModel = null
93 genTask.runs = RUNS
94
95 // Size
96 val scopeSpec = genTask.scope as ScopeSpecification
97 val objScope = scopeSpec.scopes.get(0) as ObjectTypeScope
98 val interval = objScope.number as IntervallNumber
99 interval.min = SIZE
100 interval.maxUnlimited = true
101
102 // Runtime
103 val configScope = genTask.config as ConfigSpecification
104 val runtimeEntry = configScope.entries.get(0) as RuntimeEntry
105 runtimeEntry.millisecLimit = RUNTIME
106
107 // Output locations
108 val debug = genTask.debugFolder as FileSpecification
109 debug.path = debugPath
110 val output = genTask.tagetFolder as FileSpecification
111 output.path = outputPath
112 val log = genTask.targetLogFile as FileSpecification
113 log.path = logPath
114 val stats = genTask.targetStatisticsFile as FileSpecification
115 stats.path = statsPath
116
117 // Run Generator
118 executor.executeScript(config, new NullProgressMonitor)
119
120 println()
121 }
122
123}