diff options
author | Kristóf Marussy <kris7topher@gmail.com> | 2019-08-15 15:36:05 +0200 |
---|---|---|
committer | Kristóf Marussy <kris7topher@gmail.com> | 2019-08-15 15:36:05 +0200 |
commit | 110268c8e8937df8d67075caebd6d31460d0f81a (patch) | |
tree | f52bd65d0cc8516e5fb1f68c5cdf1e89d6390ebd /Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend | |
parent | Measurements WIP (diff) | |
download | VIATRA-Generator-110268c8e8937df8d67075caebd6d31460d0f81a.tar.gz VIATRA-Generator-110268c8e8937df8d67075caebd6d31460d0f81a.tar.zst VIATRA-Generator-110268c8e8937df8d67075caebd6d31460d0f81a.zip |
Measurements WIP
Diffstat (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend')
-rw-r--r-- | Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend | 37 |
1 files changed, 0 insertions, 37 deletions
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 | ||