diff options
Diffstat (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run')
6 files changed, 49 insertions, 45 deletions
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemHint.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemHint.xtend new file mode 100644 index 00000000..8d6523b1 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemHint.xtend | |||
@@ -0,0 +1,32 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.run | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic | ||
4 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace | ||
5 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeExpressionBuilderFactory | ||
6 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGenerator | ||
7 | |||
8 | class FileSystemHint extends Ecore2LogicTraceBasedHint { | ||
9 | static val REMAINING_CONTENTS_ROOT = "hint_root" | ||
10 | |||
11 | new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { | ||
12 | super(ecore2Logic, trace) | ||
13 | } | ||
14 | |||
15 | override getAdditionalPatterns(PatternGenerator it) ''' | ||
16 | pattern «REMAINING_CONTENTS_ROOT»(problem:LogicProblem, interpretation:PartialInterpretation, remainingContents:java Integer) { | ||
17 | find interpretation(problem, interpretation); | ||
18 | remainingContents == sum find remainingContents_root_reference_Dir_helper(problem, interpretation, _, #_) | ||
19 | } | ||
20 | ''' | ||
21 | |||
22 | override createConstraintUpdater(LinearTypeExpressionBuilderFactory it) { | ||
23 | val dirCount = createBuilder.add(1, "Dir".type).build | ||
24 | |||
25 | val remainingContentsRootMatcher = createMatcher(REMAINING_CONTENTS_ROOT) | ||
26 | |||
27 | return [ p | | ||
28 | dirCount.tightenLowerBound(remainingContentsRootMatcher.getCount(p)) | ||
29 | ] | ||
30 | } | ||
31 | |||
32 | } | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemInconsistencyDetector.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemInconsistencyDetector.xtend index e79a6261..f4f36951 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemInconsistencyDetector.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemInconsistencyDetector.xtend | |||
@@ -35,11 +35,11 @@ class FileSystemInconsistencyDetector extends ModelGenerationMethodBasedGlobalCo | |||
35 | 35 | ||
36 | override checkGlobalConstraint(ThreadContext context) { | 36 | override checkGlobalConstraint(ThreadContext context) { |
37 | var requiredNewObjects = | 37 | var requiredNewObjects = |
38 | filesystem.countMatches*2 + | 38 | root.countMatches*2 + |
39 | root.countMatches | 39 | filesystem.countMatches |
40 | val availableNewObjects = partialInterpretation.maxNewElements | 40 | val availableNewObjects = partialInterpretation.maxNewElements |
41 | val res = availableNewObjects >= requiredNewObjects | 41 | val res = availableNewObjects >= requiredNewObjects |
42 | //println('''[«availableNewObjects» >= «requiredNewObjects»] = «res»''') | 42 | println('''[«availableNewObjects» >= «requiredNewObjects»] = «res»''') |
43 | return res | 43 | return res |
44 | } | 44 | } |
45 | 45 | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend index 54724226..4b0791d4 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend | |||
@@ -195,8 +195,9 @@ class YakinduLoader extends MetamodelLoader { | |||
195 | this.workspace.readModel(EObject, "Yakindu.xmi").eResource.allContents.toList | 195 | this.workspace.readModel(EObject, "Yakindu.xmi").eResource.allContents.toList |
196 | } | 196 | } |
197 | 197 | ||
198 | override additionalConstraints() { // #[] | 198 | override additionalConstraints() { |
199 | #[[method|new SGraphInconsistencyDetector(method)]] | 199 | //#[[method|new SGraphInconsistencyDetector(method)]] |
200 | emptyList | ||
200 | } | 201 | } |
201 | 202 | ||
202 | override getTypeQuantiles() { | 203 | override getTypeQuantiles() { |
@@ -260,9 +261,17 @@ class FileSystemLoader extends MetamodelLoader { | |||
260 | } | 261 | } |
261 | 262 | ||
262 | override additionalConstraints() { | 263 | override additionalConstraints() { |
263 | #[[method|new FileSystemInconsistencyDetector(method)]] | 264 | //#[[method|new FileSystemInconsistencyDetector(method)]] |
265 | emptyList | ||
264 | } | 266 | } |
265 | 267 | ||
268 | override getTypeQuantiles() { | ||
269 | #{ | ||
270 | "Filesystem" -> new TypeQuantiles(0, 0.05), | ||
271 | "Dir" -> new TypeQuantiles(0.15, 0.3), | ||
272 | "File" -> new TypeQuantiles(0.25, 0.85) | ||
273 | } | ||
274 | } | ||
266 | } | 275 | } |
267 | 276 | ||
268 | class EcoreLoader extends MetamodelLoader { | 277 | class EcoreLoader extends MetamodelLoader { |
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend index e95c0c64..ef5b779e 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend | |||
@@ -9,8 +9,6 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGene | |||
9 | class SatelliteHint extends Ecore2LogicTraceBasedHint { | 9 | class SatelliteHint extends Ecore2LogicTraceBasedHint { |
10 | static val INTERFEROMETY_PAYLOAD = "hint_interferometryPayload" | 10 | static val INTERFEROMETY_PAYLOAD = "hint_interferometryPayload" |
11 | static val REMAINING_CONTENTS_KA_COMM_SUBSYSTEM = "hint_kaCommSubsystem" | 11 | static val REMAINING_CONTENTS_KA_COMM_SUBSYSTEM = "hint_kaCommSubsystem" |
12 | static val HINT_SPACECRAFT_UHF_POSSIBLE_LINK = "hint_spacecraftWithUhfPossibleLink" | ||
13 | static val HINT_SPACECRAFT_UHF_ONLY_NO_LINK = "hint_spacecraftUhfOnlyNoLink" | ||
14 | 12 | ||
15 | new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { | 13 | new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { |
16 | super(ecore2Logic, trace) | 14 | super(ecore2Logic, trace) |
@@ -32,54 +30,19 @@ class SatelliteHint extends Ecore2LogicTraceBasedHint { | |||
32 | find interpretation(problem, interpretation); | 30 | find interpretation(problem, interpretation); |
33 | remainingContents == sum find «REMAINING_CONTENTS_KA_COMM_SUBSYSTEM»_helper(problem, interpretation, _, #_); | 31 | remainingContents == sum find «REMAINING_CONTENTS_KA_COMM_SUBSYSTEM»_helper(problem, interpretation, _, #_); |
34 | } | 32 | } |
35 | |||
36 | private pattern hint_spacecraftNotUhfOnly(problem:LogicProblem, interpretation:PartialInterpretation, spacecraft:DefinedElement) { | ||
37 | find interpretation(problem, interpretation); | ||
38 | find mustExist(problem, interpretation, spacecraft); | ||
39 | «typeIndexer.referInstanceOf("Spacecraft".type, Modality.MUST, "spacecraft")» | ||
40 | «relationDeclarationIndexer.referRelation("CommunicatingElement".relation("commSubsystem"), "spacecraft", "comm", Modality.MAY)» | ||
41 | neg «typeIndexer.referInstanceOf("UHFCommSubsystem".type, Modality.MUST, "comm")» | ||
42 | } | ||
43 | |||
44 | private pattern hint_spacecraftWithUhf(problem:LogicProblem, interpretation:PartialInterpretation, spacecraft:DefinedElement) { | ||
45 | find interpretation(problem, interpretation); | ||
46 | find mustExist(problem, interpretation, spacecraft); | ||
47 | «typeIndexer.referInstanceOf("Spacecraft".type, Modality.MUST, "spacecraft")» | ||
48 | «relationDeclarationIndexer.referRelation("CommunicatingElement".relation("commSubsystem"), "spacecraft", "comm", Modality.MUST)» | ||
49 | «typeIndexer.referInstanceOf("UHFCommSubsystem".type, Modality.MUST, "comm")» | ||
50 | } | ||
51 | |||
52 | pattern «HINT_SPACECRAFT_UHF_POSSIBLE_LINK»(problem:LogicProblem, interpretation:PartialInterpretation) { | ||
53 | find hint_spacecraftWithUhf(problem, interpretation, spacecraft); | ||
54 | find hint_spacecraftNotUhfOnly(problem, interpretation, spacecraft); | ||
55 | } | ||
56 | |||
57 | pattern «HINT_SPACECRAFT_UHF_ONLY_NO_LINK»(problem:LogicProblem, interpretation:PartialInterpretation) { | ||
58 | find interpretation(problem, interpretation); | ||
59 | find mustExist(problem, interpretation, spacecraft); | ||
60 | «typeIndexer.referInstanceOf("Spacecraft".type, Modality.MUST, "spacecraft")» | ||
61 | neg find hint_spacecraftNotUhfOnly(problem, interpretation, spacecraft); | ||
62 | find currentInRelation_pattern_hu_bme_mit_inf_dslreasoner_domains_satellite_queries_noLinkToGroundStation(problem, interpretation, spacecraft); | ||
63 | } | ||
64 | ''' | 33 | ''' |
65 | 34 | ||
66 | override createConstraintUpdater(LinearTypeExpressionBuilderFactory it) { | 35 | override createConstraintUpdater(LinearTypeExpressionBuilderFactory it) { |
67 | val interferometryPayloadCount = createBuilder.add(1, "InterferometryPayload".type).build | 36 | val interferometryPayloadCount = createBuilder.add(1, "InterferometryPayload".type).build |
68 | val kaCommSubsystemWithoutSmallSatCount = createBuilder.add(1, "KaCommSubsystem".type).add(-2, "SmallSat".type). | 37 | val kaCommSubsystemWithoutSmallSatCount = createBuilder.add(1, "KaCommSubsystem".type).add(-2, "SmallSat".type). |
69 | build | 38 | build |
70 | val uhfCommSubsystemCount = createBuilder.add(1, "UHFCommSubsystem".type).build | ||
71 | 39 | ||
72 | val interferometryPayloadMatcher = createMatcher(INTERFEROMETY_PAYLOAD) | 40 | val interferometryPayloadMatcher = createMatcher(INTERFEROMETY_PAYLOAD) |
73 | val kaCommSubsystemRemainingContentsMatcher = createMatcher(REMAINING_CONTENTS_KA_COMM_SUBSYSTEM) | 41 | val kaCommSubsystemRemainingContentsMatcher = createMatcher(REMAINING_CONTENTS_KA_COMM_SUBSYSTEM) |
74 | val uhfPossibleLinkMatcher = createMatcher(HINT_SPACECRAFT_UHF_POSSIBLE_LINK) | ||
75 | val uhfNoLinkMatcher = createMatcher(HINT_SPACECRAFT_UHF_ONLY_NO_LINK) | ||
76 | 42 | ||
77 | return [ p | | 43 | return [ p | |
78 | interferometryPayloadCount.tightenLowerBound(2 - interferometryPayloadMatcher.countMatches(p)) | 44 | interferometryPayloadCount.tightenLowerBound(2 - interferometryPayloadMatcher.countMatches(p)) |
79 | kaCommSubsystemWithoutSmallSatCount.tightenUpperBound(kaCommSubsystemRemainingContentsMatcher.getCount(p)) | 45 | kaCommSubsystemWithoutSmallSatCount.tightenUpperBound(kaCommSubsystemRemainingContentsMatcher.getCount(p)) |
80 | if (uhfPossibleLinkMatcher.countMatches(p) == 0 && uhfNoLinkMatcher.countMatches(p) >= 1) { | ||
81 | uhfCommSubsystemCount.tightenLowerBound(1) | ||
82 | } | ||
83 | ] | 46 | ] |
84 | } | 47 | } |
85 | 48 | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend index 5abff962..56a65091 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend | |||
@@ -22,7 +22,7 @@ class MeasurementScript { | |||
22 | ScopeHeuristic scopeHeuristic | 22 | ScopeHeuristic scopeHeuristic |
23 | 23 | ||
24 | def toCsvHeader() { | 24 | def toCsvHeader() { |
25 | '''«domain»,«scope»,«solver»,«scopePropagator ?: "NULL"»,«propagatedConstraints ?: "NULL"»,«polyhedronSolver ?: "NULL"»''' | 25 | '''«domain»,«scope»,«solver»,«scopePropagator ?: "NULL"»,«propagatedConstraints ?: "NULL"»,«polyhedronSolver ?: "NULL"»,«scopeHeuristic ?: "NULL"»''' |
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend index 48e750cb..bfbbf329 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend | |||
@@ -68,7 +68,7 @@ class MeasurementScriptRunner { | |||
68 | this.script = script | 68 | this.script = script |
69 | inputWorkspace = new FileSystemWorkspace(script.inputPath + "/", "") | 69 | inputWorkspace = new FileSystemWorkspace(script.inputPath + "/", "") |
70 | outputWorkspace = new FileSystemWorkspace(script.outputPath + | 70 | outputWorkspace = new FileSystemWorkspace(script.outputPath + |
71 | "/", '''«script.domain»_«script.solver»_«script.scope»_«script.scopePropagator ?: "na"»_«script.propagatedConstraints ?: "na"»_«script.polyhedronSolver ?: "na"»_''') | 71 | "/", '''«script.domain»_«script.solver»_«script.scope»_«script.scopePropagator ?: "na"»_«script.propagatedConstraints ?: "na"»_«script.polyhedronSolver ?: "na"»_«script.scopeHeuristic ?: "na"»_''') |
72 | metamodelLoader = switch (script.domain) { | 72 | metamodelLoader = switch (script.domain) { |
73 | case fs: new FileSystemLoader(inputWorkspace) | 73 | case fs: new FileSystemLoader(inputWorkspace) |
74 | case ecore: new EcoreLoader(inputWorkspace) | 74 | case ecore: new EcoreLoader(inputWorkspace) |