diff options
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite')
21 files changed, 727 insertions, 248 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite_fixup.henshin b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite_fixup.henshin index 5cc76605..224ced8f 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite_fixup.henshin +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite_fixup.henshin | |||
@@ -20,4 +20,42 @@ | |||
20 | </rhs> | 20 | </rhs> |
21 | <mappings xmi:id="_Qn4G0X9EEemiUoPdWqOlQg" origin="_Qn3fwH9EEemiUoPdWqOlQg" image="_Qn4G0H9EEemiUoPdWqOlQg"/> | 21 | <mappings xmi:id="_Qn4G0X9EEemiUoPdWqOlQg" origin="_Qn3fwH9EEemiUoPdWqOlQg" image="_Qn4G0H9EEemiUoPdWqOlQg"/> |
22 | </units> | 22 | </units> |
23 | <units xsi:type="henshin:Rule" xmi:id="_kgBHMH9KEemiUoPdWqOlQg" name="addCubeSat6U"> | ||
24 | <lhs xmi:id="_kgHN0H9KEemiUoPdWqOlQg" name="Lhs"> | ||
25 | <nodes xmi:id="_obHq0H9KEemiUoPdWqOlQg"> | ||
26 | <type href="http://www.example.org/satellite#//InterferometryMission"/> | ||
27 | </nodes> | ||
28 | </lhs> | ||
29 | <rhs xmi:id="_kgIb8H9KEemiUoPdWqOlQg" name="Rhs"> | ||
30 | <nodes xmi:id="_obIR4H9KEemiUoPdWqOlQg" outgoing="_skabcH9KEemiUoPdWqOlQg"> | ||
31 | <type href="http://www.example.org/satellite#//InterferometryMission"/> | ||
32 | </nodes> | ||
33 | <nodes xmi:id="_qHno4H9KEemiUoPdWqOlQg" incoming="_skabcH9KEemiUoPdWqOlQg"> | ||
34 | <type href="http://www.example.org/satellite#//CubeSat6U"/> | ||
35 | </nodes> | ||
36 | <edges xmi:id="_skabcH9KEemiUoPdWqOlQg" source="_obIR4H9KEemiUoPdWqOlQg" target="_qHno4H9KEemiUoPdWqOlQg"> | ||
37 | <type href="http://www.example.org/satellite#//ConstellationMission/spacecraft"/> | ||
38 | </edges> | ||
39 | </rhs> | ||
40 | <mappings xmi:id="_obIR4X9KEemiUoPdWqOlQg" origin="_obHq0H9KEemiUoPdWqOlQg" image="_obIR4H9KEemiUoPdWqOlQg"/> | ||
41 | </units> | ||
42 | <units xsi:type="henshin:Rule" xmi:id="_xFdIQH9LEemiUoPdWqOlQg" name="addSmallSat"> | ||
43 | <lhs xmi:id="_xFiAwH9LEemiUoPdWqOlQg" name="Lhs"> | ||
44 | <nodes xmi:id="_a7r_UH9MEemiUoPdWqOlQg"> | ||
45 | <type href="http://www.example.org/satellite#//InterferometryMission"/> | ||
46 | </nodes> | ||
47 | </lhs> | ||
48 | <rhs xmi:id="_xFjO4H9LEemiUoPdWqOlQg" name="Rhs"> | ||
49 | <nodes xmi:id="_a7w30H9MEemiUoPdWqOlQg" outgoing="_hORXsH9MEemiUoPdWqOlQg"> | ||
50 | <type href="http://www.example.org/satellite#//InterferometryMission"/> | ||
51 | </nodes> | ||
52 | <nodes xmi:id="_dt0vwH9MEemiUoPdWqOlQg" incoming="_hORXsH9MEemiUoPdWqOlQg"> | ||
53 | <type href="http://www.example.org/satellite#//SmallSat"/> | ||
54 | </nodes> | ||
55 | <edges xmi:id="_hORXsH9MEemiUoPdWqOlQg" source="_a7w30H9MEemiUoPdWqOlQg" target="_dt0vwH9MEemiUoPdWqOlQg"> | ||
56 | <type href="http://www.example.org/satellite#//ConstellationMission/spacecraft"/> | ||
57 | </edges> | ||
58 | </rhs> | ||
59 | <mappings xmi:id="_a7xe4H9MEemiUoPdWqOlQg" origin="_a7r_UH9MEemiUoPdWqOlQg" image="_a7w30H9MEemiUoPdWqOlQg"/> | ||
60 | </units> | ||
23 | </henshin:Module> | 61 | </henshin:Module> |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml index 8c9f4be1..a8146d37 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml | |||
@@ -15,6 +15,9 @@ | |||
15 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.threeUCubeSatWithNonUhfCrossLink"/> | 15 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.threeUCubeSatWithNonUhfCrossLink"/> |
16 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.cubeSatWithKaAntenna"/> | 16 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.cubeSatWithKaAntenna"/> |
17 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.smallSat"/> | 17 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.smallSat"/> |
18 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.coverageMetric"/> | ||
19 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.timeMetric"/> | ||
20 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.costMetric"/> | ||
18 | </group> | 21 | </group> |
19 | </extension> | 22 | </extension> |
20 | </plugin> | 23 | </plugin> |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java index 9025d93a..d7326877 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java | |||
@@ -5,6 +5,8 @@ package hu.bme.mit.inf.dslreasoner.domains.satellite.queries; | |||
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement; | 6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement; |
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop; | 7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop; |
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna; | 10 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna; |
9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand; | 11 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand; |
10 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation; | 12 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation; |
@@ -12,6 +14,7 @@ import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGro | |||
12 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads; | 14 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads; |
13 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; | 15 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; |
14 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink; | 16 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink; |
17 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric; | ||
15 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | 18 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; |
16 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | 19 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; |
17 | 20 | ||
@@ -32,6 +35,9 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | |||
32 | * <li>threeUCubeSatWithNonUhfCrossLink</li> | 35 | * <li>threeUCubeSatWithNonUhfCrossLink</li> |
33 | * <li>cubeSatWithKaAntenna</li> | 36 | * <li>cubeSatWithKaAntenna</li> |
34 | * <li>smallSat</li> | 37 | * <li>smallSat</li> |
38 | * <li>coverageMetric</li> | ||
39 | * <li>timeMetric</li> | ||
40 | * <li>costMetric</li> | ||
35 | * </ul> | 41 | * </ul> |
36 | * | 42 | * |
37 | * @see IQueryGroup | 43 | * @see IQueryGroup |
@@ -65,6 +71,9 @@ public final class SatelliteQueries extends BaseGeneratedPatternGroup { | |||
65 | querySpecifications.add(ThreeUCubeSatWithNonUhfCrossLink.instance()); | 71 | querySpecifications.add(ThreeUCubeSatWithNonUhfCrossLink.instance()); |
66 | querySpecifications.add(CubeSatWithKaAntenna.instance()); | 72 | querySpecifications.add(CubeSatWithKaAntenna.instance()); |
67 | querySpecifications.add(SmallSat.instance()); | 73 | querySpecifications.add(SmallSat.instance()); |
74 | querySpecifications.add(CoverageMetric.instance()); | ||
75 | querySpecifications.add(TimeMetric.instance()); | ||
76 | querySpecifications.add(CostMetric.instance()); | ||
68 | } | 77 | } |
69 | 78 | ||
70 | public CommunicationLinkDoesNotStartAtContainingElement getCommunicationLinkDoesNotStartAtContainingElement() { | 79 | public CommunicationLinkDoesNotStartAtContainingElement getCommunicationLinkDoesNotStartAtContainingElement() { |
@@ -138,4 +147,28 @@ public final class SatelliteQueries extends BaseGeneratedPatternGroup { | |||
138 | public SmallSat.Matcher getSmallSat(final ViatraQueryEngine engine) { | 147 | public SmallSat.Matcher getSmallSat(final ViatraQueryEngine engine) { |
139 | return SmallSat.Matcher.on(engine); | 148 | return SmallSat.Matcher.on(engine); |
140 | } | 149 | } |
150 | |||
151 | public CoverageMetric getCoverageMetric() { | ||
152 | return CoverageMetric.instance(); | ||
153 | } | ||
154 | |||
155 | public CoverageMetric.Matcher getCoverageMetric(final ViatraQueryEngine engine) { | ||
156 | return CoverageMetric.Matcher.on(engine); | ||
157 | } | ||
158 | |||
159 | public TimeMetric getTimeMetric() { | ||
160 | return TimeMetric.instance(); | ||
161 | } | ||
162 | |||
163 | public TimeMetric.Matcher getTimeMetric(final ViatraQueryEngine engine) { | ||
164 | return TimeMetric.Matcher.on(engine); | ||
165 | } | ||
166 | |||
167 | public CostMetric getCostMetric() { | ||
168 | return CostMetric.instance(); | ||
169 | } | ||
170 | |||
171 | public CostMetric.Matcher getCostMetric(final ViatraQueryEngine engine) { | ||
172 | return CostMetric.Matcher.on(engine); | ||
173 | } | ||
141 | } | 174 | } |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore index 58443486..2f9ae41d 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore | |||
@@ -67,3 +67,4 @@ | |||
67 | /.CubeSat6U.java._trace | 67 | /.CubeSat6U.java._trace |
68 | /.MatchingCommSubsystem.java._trace | 68 | /.MatchingCommSubsystem.java._trace |
69 | /.TransmittingCommSubsystem.java._trace | 69 | /.TransmittingCommSubsystem.java._trace |
70 | /.SpacecraftOfKindCount.java._trace | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java index 4093e2b2..0235dbec 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java | |||
@@ -5,6 +5,8 @@ package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; | |||
5 | 5 | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement; | 6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement; |
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop; | 7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop; |
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric; | ||
9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CoverageMetric; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna; | 10 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna; |
9 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand; | 11 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand; |
10 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation; | 12 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation; |
@@ -12,18 +14,33 @@ import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoPotentialLinkToGro | |||
12 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads; | 14 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads; |
13 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; | 15 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; |
14 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink; | 16 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink; |
17 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.TimeMetric; | ||
18 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AdditionalCommSubsystemCost; | ||
15 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AtLeastTwoInterferometryPayloads; | 19 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AtLeastTwoInterferometryPayloads; |
20 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.BasePrice; | ||
16 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf; | 21 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf; |
17 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat3U; | 22 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat3U; |
18 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat6U; | 23 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat6U; |
19 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.DirectCommunicationLink; | 24 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.DirectCommunicationLink; |
20 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork; | 25 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork; |
26 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IncomingData; | ||
21 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink; | 27 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink; |
22 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectLinkAllowed; | 28 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectLinkAllowed; |
29 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.InterferometryPayloadCost; | ||
23 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.LinkAllowed; | 30 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.LinkAllowed; |
24 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingAntenna; | 31 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingAntenna; |
25 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem; | 32 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem; |
33 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCost; | ||
34 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionCoverage; | ||
35 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MissionTime; | ||
36 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.ScienceData; | ||
37 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftCost; | ||
38 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftOfKindCount; | ||
39 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftUplink; | ||
26 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload; | 40 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload; |
41 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithTwoCommSubsystems; | ||
42 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitRate; | ||
43 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmitTime; | ||
27 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmittingCommSubsystem; | 44 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.TransmittingCommSubsystem; |
28 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | 45 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; |
29 | 46 | ||
@@ -55,6 +72,23 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; | |||
55 | * <li>groundStationNetwork</li> | 72 | * <li>groundStationNetwork</li> |
56 | * <li>cubeSatWithKaAntenna</li> | 73 | * <li>cubeSatWithKaAntenna</li> |
57 | * <li>smallSat</li> | 74 | * <li>smallSat</li> |
75 | * <li>coverageMetric</li> | ||
76 | * <li>missionCoverage</li> | ||
77 | * <li>timeMetric</li> | ||
78 | * <li>missionTime</li> | ||
79 | * <li>transmitTime</li> | ||
80 | * <li>incomingData</li> | ||
81 | * <li>scienceData</li> | ||
82 | * <li>transmitRate</li> | ||
83 | * <li>spacecraftUplink</li> | ||
84 | * <li>costMetric</li> | ||
85 | * <li>missionCost</li> | ||
86 | * <li>spacecraftCost</li> | ||
87 | * <li>spacecraftOfKindCount</li> | ||
88 | * <li>basePrice</li> | ||
89 | * <li>interferometryPayloadCost</li> | ||
90 | * <li>additionalCommSubsystemCost</li> | ||
91 | * <li>spacecraftWithTwoCommSubsystems</li> | ||
58 | * </ul> | 92 | * </ul> |
59 | * | 93 | * |
60 | * @see IQueryGroup | 94 | * @see IQueryGroup |
@@ -101,5 +135,22 @@ public final class SatelliteQueriesAll extends BaseGeneratedPatternGroup { | |||
101 | querySpecifications.add(GroundStationNetwork.instance()); | 135 | querySpecifications.add(GroundStationNetwork.instance()); |
102 | querySpecifications.add(CubeSatWithKaAntenna.instance()); | 136 | querySpecifications.add(CubeSatWithKaAntenna.instance()); |
103 | querySpecifications.add(SmallSat.instance()); | 137 | querySpecifications.add(SmallSat.instance()); |
138 | querySpecifications.add(CoverageMetric.instance()); | ||
139 | querySpecifications.add(MissionCoverage.instance()); | ||
140 | querySpecifications.add(TimeMetric.instance()); | ||
141 | querySpecifications.add(MissionTime.instance()); | ||
142 | querySpecifications.add(TransmitTime.instance()); | ||
143 | querySpecifications.add(IncomingData.instance()); | ||
144 | querySpecifications.add(ScienceData.instance()); | ||
145 | querySpecifications.add(TransmitRate.instance()); | ||
146 | querySpecifications.add(SpacecraftUplink.instance()); | ||
147 | querySpecifications.add(CostMetric.instance()); | ||
148 | querySpecifications.add(MissionCost.instance()); | ||
149 | querySpecifications.add(SpacecraftCost.instance()); | ||
150 | querySpecifications.add(SpacecraftOfKindCount.instance()); | ||
151 | querySpecifications.add(BasePrice.instance()); | ||
152 | querySpecifications.add(InterferometryPayloadCost.instance()); | ||
153 | querySpecifications.add(AdditionalCommSubsystemCost.instance()); | ||
154 | querySpecifications.add(SpacecraftWithTwoCommSubsystems.instance()); | ||
104 | } | 155 | } |
105 | } | 156 | } |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftOfKindCount.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftOfKindCount.java new file mode 100644 index 00000000..3c4f9244 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftOfKindCount.java | |||
@@ -0,0 +1,189 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SmallSat; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat3U; | ||
8 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CubeSat6U; | ||
9 | import java.util.Arrays; | ||
10 | import java.util.LinkedHashSet; | ||
11 | import java.util.List; | ||
12 | import java.util.Set; | ||
13 | import org.eclipse.emf.ecore.EClass; | ||
14 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
15 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; | ||
16 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
17 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
21 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
22 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
23 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; | ||
24 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | ||
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
26 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
30 | |||
31 | /** | ||
32 | * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. | ||
33 | * | ||
34 | * <p>Original source: | ||
35 | * <code><pre> | ||
36 | * private pattern spacecraftOfKindCount(Sat : Spacecraft, Count : java Integer) { | ||
37 | * CubeSat3U(Sat); | ||
38 | * Count == count find cubeSat3U(_); | ||
39 | * } or { | ||
40 | * CubeSat6U(Sat); | ||
41 | * Count == count find cubeSat6U(_); | ||
42 | * } or { | ||
43 | * SmallSat(Sat); | ||
44 | * Count == count find smallSat(_); | ||
45 | * } | ||
46 | * </pre></code> | ||
47 | * | ||
48 | * @see GenericPatternMatcher | ||
49 | * @see GenericPatternMatch | ||
50 | * | ||
51 | */ | ||
52 | @SuppressWarnings("all") | ||
53 | public final class SpacecraftOfKindCount extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { | ||
54 | private SpacecraftOfKindCount() { | ||
55 | super(GeneratedPQuery.INSTANCE); | ||
56 | } | ||
57 | |||
58 | /** | ||
59 | * @return the singleton instance of the query specification | ||
60 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
61 | * | ||
62 | */ | ||
63 | public static SpacecraftOfKindCount instance() { | ||
64 | try{ | ||
65 | return LazyHolder.INSTANCE; | ||
66 | } catch (ExceptionInInitializerError err) { | ||
67 | throw processInitializerError(err); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftOfKindCount (visibility: PUBLIC, simpleName: SpacecraftOfKindCount, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftOfKindCount, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created | ||
73 | * <b>not</b> at the class load time of the outer class, | ||
74 | * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftOfKindCount (visibility: PUBLIC, simpleName: SpacecraftOfKindCount, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftOfKindCount, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
75 | * | ||
76 | * <p> This workaround is required e.g. to support recursion. | ||
77 | * | ||
78 | */ | ||
79 | private static class LazyHolder { | ||
80 | private static final SpacecraftOfKindCount INSTANCE = new SpacecraftOfKindCount(); | ||
81 | |||
82 | /** | ||
83 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
84 | * This initialization order is required to support indirect recursion. | ||
85 | * | ||
86 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
87 | * | ||
88 | */ | ||
89 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
90 | |||
91 | public static Object ensureInitialized() { | ||
92 | INSTANCE.ensureInitializedInternal(); | ||
93 | return null; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
98 | private static final SpacecraftOfKindCount.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
99 | |||
100 | private final PParameter parameter_Sat = new PParameter("Sat", "satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT); | ||
101 | |||
102 | private final PParameter parameter_Count = new PParameter("Count", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); | ||
103 | |||
104 | private final List<PParameter> parameters = Arrays.asList(parameter_Sat, parameter_Count); | ||
105 | |||
106 | private GeneratedPQuery() { | ||
107 | super(PVisibility.PRIVATE); | ||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public String getFullyQualifiedName() { | ||
112 | return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftOfKindCount"; | ||
113 | } | ||
114 | |||
115 | @Override | ||
116 | public List<String> getParameterNames() { | ||
117 | return Arrays.asList("Sat","Count"); | ||
118 | } | ||
119 | |||
120 | @Override | ||
121 | public List<PParameter> getParameters() { | ||
122 | return parameters; | ||
123 | } | ||
124 | |||
125 | @Override | ||
126 | public Set<PBody> doGetContainedBodies() { | ||
127 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
128 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
129 | { | ||
130 | PBody body = new PBody(this); | ||
131 | PVariable var_Sat = body.getOrCreateVariableByName("Sat"); | ||
132 | PVariable var_Count = body.getOrCreateVariableByName("Count"); | ||
133 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
134 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
135 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Count), new JavaTransitiveInstancesKey(java.lang.Integer.class)); | ||
136 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
137 | new ExportedParameter(body, var_Sat, parameter_Sat), | ||
138 | new ExportedParameter(body, var_Count, parameter_Count) | ||
139 | )); | ||
140 | // CubeSat3U(Sat) | ||
141 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U"))); | ||
142 | // Count == count find cubeSat3U(_) | ||
143 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
144 | new PatternMatchCounter(body, Tuples.flatTupleOf(var___0_), CubeSat3U.instance().getInternalQueryRepresentation(), var__virtual_0_); | ||
145 | new Equality(body, var_Count, var__virtual_0_); | ||
146 | bodies.add(body); | ||
147 | } | ||
148 | { | ||
149 | PBody body = new PBody(this); | ||
150 | PVariable var_Sat = body.getOrCreateVariableByName("Sat"); | ||
151 | PVariable var_Count = body.getOrCreateVariableByName("Count"); | ||
152 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
153 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
154 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Count), new JavaTransitiveInstancesKey(java.lang.Integer.class)); | ||
155 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
156 | new ExportedParameter(body, var_Sat, parameter_Sat), | ||
157 | new ExportedParameter(body, var_Count, parameter_Count) | ||
158 | )); | ||
159 | // CubeSat6U(Sat) | ||
160 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat6U"))); | ||
161 | // Count == count find cubeSat6U(_) | ||
162 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
163 | new PatternMatchCounter(body, Tuples.flatTupleOf(var___0_), CubeSat6U.instance().getInternalQueryRepresentation(), var__virtual_0_); | ||
164 | new Equality(body, var_Count, var__virtual_0_); | ||
165 | bodies.add(body); | ||
166 | } | ||
167 | { | ||
168 | PBody body = new PBody(this); | ||
169 | PVariable var_Sat = body.getOrCreateVariableByName("Sat"); | ||
170 | PVariable var_Count = body.getOrCreateVariableByName("Count"); | ||
171 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
172 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft"))); | ||
173 | new TypeFilterConstraint(body, Tuples.flatTupleOf(var_Count), new JavaTransitiveInstancesKey(java.lang.Integer.class)); | ||
174 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
175 | new ExportedParameter(body, var_Sat, parameter_Sat), | ||
176 | new ExportedParameter(body, var_Count, parameter_Count) | ||
177 | )); | ||
178 | // SmallSat(Sat) | ||
179 | new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "SmallSat"))); | ||
180 | // Count == count find smallSat(_) | ||
181 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
182 | new PatternMatchCounter(body, Tuples.flatTupleOf(var___0_), SmallSat.instance().getInternalQueryRepresentation(), var__virtual_0_); | ||
183 | new Equality(body, var_Count, var__virtual_0_); | ||
184 | bodies.add(body); | ||
185 | } | ||
186 | return bodies; | ||
187 | } | ||
188 | } | ||
189 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/CostObjective.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/CostObjective.xtend index 43b2902f..3a8688e9 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/CostObjective.xtend +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/CostObjective.xtend | |||
@@ -1,13 +1,13 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo | 1 | package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo |
2 | 2 | ||
3 | //import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric | 3 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric |
4 | // | 4 | |
5 | //class CostObjective extends MetricBasedGuidanceFunction { | 5 | class CostObjective extends MetricBasedGuidanceFunction { |
6 | // new() { | 6 | new() { |
7 | // super(CostMetric.instance) | 7 | super(CostMetric.instance) |
8 | // } | 8 | } |
9 | // | 9 | |
10 | // override getName() { | 10 | override getName() { |
11 | // "Cost" | 11 | "Cost" |
12 | // } | 12 | } |
13 | //} | 13 | } |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/ExcludedOptimisationInterpreter.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/ExcludedOptimisationInterpreter.xtend deleted file mode 100644 index ddf5748e..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/ExcludedOptimisationInterpreter.xtend +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo | ||
2 | |||
3 | import java.util.Properties | ||
4 | import org.moeaframework.Executor | ||
5 | import org.moeaframework.Instrumenter | ||
6 | import org.moeaframework.algorithm.PeriodicAction | ||
7 | import org.moeaframework.core.TerminationCondition | ||
8 | import org.moeaframework.core.spi.AlgorithmFactory | ||
9 | import uk.ac.kcl.inf.mdeoptimiser.interfaces.cli.Run | ||
10 | import uk.ac.kcl.inf.mdeoptimiser.languages.mopt.Optimisation | ||
11 | import uk.ac.kcl.inf.mdeoptimiser.languages.mopt.SolverSpec | ||
12 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.OptimisationInterpreter | ||
13 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.executor.SolutionGenerator | ||
14 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.moea.MoeaOptimisation | ||
15 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.moea.algorithms.MoeaOptimisationAlgorithmProvider | ||
16 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.moea.instrumentation.PopulationCollector | ||
17 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.moea.problem.MoeaOptimisationProblem | ||
18 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.operators.adaptation.MutationStepSizeStrategyFactory | ||
19 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.output.MDEOBatch | ||
20 | |||
21 | class ExcludedMoeaOptimisation extends MoeaOptimisation { | ||
22 | SolutionGenerator solutionGenerator | ||
23 | Instrumenter algorithmStepSizeInstrumenter | ||
24 | |||
25 | override execute(SolverSpec solverSpec, SolutionGenerator solutionGenerator) { | ||
26 | this.solutionGenerator = solutionGenerator | ||
27 | super.execute(solverSpec, solutionGenerator) | ||
28 | } | ||
29 | |||
30 | override Instrumenter runOptimisation(SolverSpec solverSpec, Properties optimisationProperties) { | ||
31 | val algorithmFactory = new AlgorithmFactory | ||
32 | algorithmFactory.addProvider(new MoeaOptimisationAlgorithmProvider) | ||
33 | |||
34 | algorithmStepSizeInstrumenter = new Instrumenter().addExcludedPackage("org.eclipse").withProblemClass( | ||
35 | MoeaOptimisationProblem, solutionGenerator).attachApproximationSetCollector().attachElapsedTimeCollector(). | ||
36 | attachPopulationSizeCollector.attach(new PopulationCollector()).withFrequency(1).withFrequencyType( | ||
37 | PeriodicAction.FrequencyType.STEPS) | ||
38 | |||
39 | var stepSizeStrategy = new MutationStepSizeStrategyFactory(solverSpec.algorithm, algorithmStepSizeInstrumenter). | ||
40 | strategy | ||
41 | |||
42 | solutionGenerator.setMutationStepSizeStrategy(stepSizeStrategy) | ||
43 | |||
44 | // TODO: Place this in a better location. | ||
45 | // Exclude JDK packages from Instrumenter | ||
46 | this.algorithmStepSizeInstrumenter.addExcludedPackage("jdk") | ||
47 | |||
48 | new Executor().usingAlgorithmFactory(algorithmFactory).withAlgorithm(solverSpec.algorithm.name) // Initialize problem with our solution generator | ||
49 | .withProblemClass(MoeaOptimisationProblem, solutionGenerator).withProperties(optimisationProperties). | ||
50 | withInstrumenter(algorithmStepSizeInstrumenter).withTerminationCondition( | ||
51 | optimisationProperties.get("terminationCondition") as TerminationCondition).run() | ||
52 | |||
53 | return algorithmStepSizeInstrumenter | ||
54 | } | ||
55 | } | ||
56 | |||
57 | class ExcludedOptimisationInterpreter extends OptimisationInterpreter { | ||
58 | val Optimisation model | ||
59 | |||
60 | new(String projectPath, Optimisation model) { | ||
61 | super(projectPath, model) | ||
62 | this.model = model | ||
63 | } | ||
64 | |||
65 | override start() { | ||
66 | // This model provider loads the model given by the user in the DSL | ||
67 | var solutionGenerator = new SolutionGenerator(model, getBreedingOperators, getMutationOperators, | ||
68 | getModelProvider, getMetamodel); | ||
69 | |||
70 | return new ExcludedMoeaOptimisation().execute(model.solver, solutionGenerator) | ||
71 | } | ||
72 | |||
73 | } | ||
74 | |||
75 | class ExcludedRun extends Run { | ||
76 | override runBatch(String moptProjectPath, Optimisation optimisationModel, Integer batch, boolean singleBatch) { | ||
77 | val optimisationInterpreter = new ExcludedOptimisationInterpreter(moptProjectPath, optimisationModel); | ||
78 | val startTime = System.nanoTime(); | ||
79 | val optimisationOutcome = optimisationInterpreter.start(); | ||
80 | val endTime = System.nanoTime(); | ||
81 | val experimentDuration = ((endTime - startTime) / 1000000); | ||
82 | val generatedRules = optimisationInterpreter.getRulegenOperators(); | ||
83 | return new MDEOBatch(batch, experimentDuration, optimisationOutcome, generatedRules, singleBatch); | ||
84 | } | ||
85 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.xtend index c5a30f94..58034c43 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.xtend +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.xtend | |||
@@ -9,7 +9,7 @@ import org.eclipse.emf.ecore.EPackage | |||
9 | import org.eclipse.emf.ecore.resource.Resource | 9 | import org.eclipse.emf.ecore.resource.Resource |
10 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl | 10 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl |
11 | import satellite.SatellitePackage | 11 | import satellite.SatellitePackage |
12 | import uk.ac.kcl.inf.mdeoptimiser.languages.MoptStandaloneSetup | 12 | import uk.ac.kcl.inf.mdeoptimiser.interfaces.cli.Run |
13 | 13 | ||
14 | class SatelliteMdeOptimiserMain { | 14 | class SatelliteMdeOptimiserMain { |
15 | static val PROJECT_PATH = "." | 15 | static val PROJECT_PATH = "." |
@@ -25,8 +25,7 @@ class SatelliteMdeOptimiserMain { | |||
25 | EPackage.Registry.INSTANCE.put(SatellitePackage.eNS_URI, SatellitePackage.eINSTANCE) | 25 | EPackage.Registry.INSTANCE.put(SatellitePackage.eNS_URI, SatellitePackage.eINSTANCE) |
26 | fixupHenshinModel("model/satellite.henshin", "model/satellite_fixup.henshin", | 26 | fixupHenshinModel("model/satellite.henshin", "model/satellite_fixup.henshin", |
27 | #{"satellite.ecore" -> SatellitePackage.eNS_URI}) | 27 | #{"satellite.ecore" -> SatellitePackage.eNS_URI}) |
28 | val injector = new MoptStandaloneSetup().createInjectorAndDoEMFRegistration(); | 28 | Run.main(#["-p", PROJECT_PATH, "-m", MOPT_PATH]) |
29 | injector.getInstance(ExcludedRun).run(PROJECT_PATH, MOPT_PATH) | ||
30 | } | 29 | } |
31 | 30 | ||
32 | private def static void fixupHenshinModel(String originalPath, String outputPath, Map<String, String> remapMap) { | 31 | private def static void fixupHenshinModel(String originalPath, String outputPath, Map<String, String> remapMap) { |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/satellite.mopt b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/satellite.mopt index 138ea309..e9bd1a64 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/satellite.mopt +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/satellite.mopt | |||
@@ -10,13 +10,14 @@ goal { | |||
10 | } | 10 | } |
11 | 11 | ||
12 | search { | 12 | search { |
13 | mutate using <satellite_fixup.henshin> unit "addCubeSat3U" | 13 | // mutate using <satellite_fixup.henshin> unit "addCubeSat3U" |
14 | // mutate { "CubeSat3U" } | 14 | mutate { "CubeSat3U" } |
15 | // mutate { "CubeSat6U" } | 15 | mutate { "CubeSat6U" } |
16 | // mutate { "SmallSat" } | 16 | mutate { "SmallSat" } |
17 | // mutate { "InterferometryPayload" } | 17 | mutate { "InterferometryPayload" } |
18 | // mutate { "CommSubsystem" } | 18 | mutate { "UHFCommSubsystem" } |
19 | // mutate { "DirectedCommunicationLink" } | 19 | mutate { "XCommSubsystem" } |
20 | mutate { "KaCommSubsystem" } | ||
20 | } | 21 | } |
21 | 22 | ||
22 | solver { | 23 | solver { |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql index bdda6ec7..711c7ce6 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql | |||
@@ -158,147 +158,146 @@ pattern smallSat(Sat : SmallSat) { | |||
158 | SmallSat(Sat); | 158 | SmallSat(Sat); |
159 | } | 159 | } |
160 | 160 | ||
161 | //// | ||
162 | //// Metrics | ||
163 | //// | ||
164 | // | 161 | // |
165 | //// Coverage | 162 | // Metrics |
166 | // | 163 | // |
167 | //pattern coverageMetric(Coverage : java Double) { | 164 | |
168 | // Coverage == sum find missionCoverage(_, #_); | 165 | // Coverage |
169 | //} | 166 | |
170 | // | 167 | pattern coverageMetric(Coverage : java Double) { |
171 | //private pattern missionCoverage(Mission : InterferometryMission, Coverage : java Double) { | 168 | Coverage == sum find missionCoverage(_, #_); |
172 | // InterferometryMission.observationTime(Mission, ObservationTime); | 169 | } |
173 | // ObserverCount == count find spacecraftWithInterferometryPayload(Mission, _); | 170 | |
174 | // Coverage == eval(Math.pow(1 - 2.0 / ObserverCount, 1 + 9 * (1.0 / ObservationTime)) + 0.05 * ObservationTime / 3); | 171 | private pattern missionCoverage(Mission : InterferometryMission, Coverage : java Double) { |
175 | //} | 172 | InterferometryMission.observationTime(Mission, ObservationTime); |
176 | // | 173 | ObserverCount == count find spacecraftWithInterferometryPayload(Mission, _); |
177 | //// Time | 174 | Coverage == eval(Math.pow(1 - 2.0 / ObserverCount, 1 + 9 * (1.0 / ObservationTime)) + 0.05 * ObservationTime / 3); |
178 | // | 175 | } |
179 | //pattern timeMetric(Time : java Double) { | 176 | |
180 | // Time == sum find missionTime(_, #_); | 177 | // Time |
181 | //} | 178 | |
182 | // | 179 | pattern timeMetric(Time : java Double) { |
183 | //private pattern missionTime(Mission : InterferometryMission, Time : java Double) { | 180 | Time == sum find missionTime(_, #_); |
184 | // InterferometryMission.observationTime(Mission, ObservationTime); | 181 | } |
185 | // TrasmitTime == sum find transmitTime(Mission, _, #_); | 182 | |
186 | // Time == eval(TrasmitTime + 60.0 * ObservationTime); | 183 | private pattern missionTime(Mission : InterferometryMission, Time : java Double) { |
187 | //} | 184 | InterferometryMission.observationTime(Mission, ObservationTime); |
188 | // | 185 | TrasmitTime == sum find transmitTime(Mission, _, #_); |
189 | //private pattern transmitTime(Mission : InterferometryMission, Spacecraft : Spacecraft, TransmitTime : java Double) { | 186 | Time == eval(TrasmitTime + 60.0 * ObservationTime); |
190 | // ConstellationMission.spacecraft(Mission, Spacecraft); | 187 | } |
191 | // find scienceData(Spacecraft, ScienceData); | 188 | |
192 | // IncomingData == sum find incomingData(Spacecraft, _, #_); | 189 | private pattern transmitTime(Mission : InterferometryMission, Spacecraft : Spacecraft, TransmitTime : java Double) { |
193 | // find transmitRate(Spacecraft, TransmitRate); | 190 | ConstellationMission.spacecraft(Mission, Spacecraft); |
194 | // TransmitTime == eval((ScienceData + IncomingData) / (7.5 * TransmitRate)); | 191 | find scienceData(Spacecraft, ScienceData); |
195 | //} | 192 | IncomingData == sum find incomingData(Spacecraft, _, #_); |
196 | // | 193 | find transmitRate(Spacecraft, TransmitRate); |
197 | //private pattern incomingData(Spacecraft : Spacecraft, Source : Spacecraft, Data : java Double) { | 194 | TransmitTime == eval((ScienceData + IncomingData) / (7.5 * TransmitRate)); |
198 | // find indirectCommunicationLink(Source, Spacecraft); | 195 | } |
199 | // find scienceData(Source, Data); | 196 | |
200 | //} | 197 | private pattern incomingData(Spacecraft : Spacecraft, Source : Spacecraft, Data : java Double) { |
201 | // | 198 | find indirectCommunicationLink(Source, Spacecraft); |
202 | //private pattern scienceData(Spacecraft : Spacecraft, Data : java Double) { | 199 | find scienceData(Source, Data); |
203 | // ConstellationMission.spacecraft(Mission, Spacecraft); | 200 | } |
204 | // InterferometryMission.observationTime(Mission, ObservationTime); | 201 | |
205 | // Data == eval(12.0 * ObservationTime); | 202 | private pattern scienceData(Spacecraft : Spacecraft, Data : java Double) { |
206 | //} | 203 | ConstellationMission.spacecraft(Mission, Spacecraft); |
207 | // | 204 | InterferometryMission.observationTime(Mission, ObservationTime); |
208 | //private pattern transmitRate(Spacecraft : Spacecraft, TransmitRate : java Double) { | 205 | Data == eval(12.0 * ObservationTime); |
209 | // find spacecraftUplink(Spacecraft, Comm, Target); | 206 | } |
210 | // UHFCommSubsystem(Comm); | 207 | |
211 | // Spacecraft(Target); | 208 | private pattern transmitRate(Spacecraft : Spacecraft, TransmitRate : java Double) { |
212 | // TransmitRate == 5.0; | 209 | find spacecraftUplink(Spacecraft, Comm, Target); |
213 | //} or { | 210 | UHFCommSubsystem(Comm); |
214 | // find spacecraftUplink(Spacecraft, Comm, Target); | 211 | Spacecraft(Target); |
215 | // XCommSubsystem(Comm); | 212 | TransmitRate == 5.0; |
216 | // Spacecraft(Target); | 213 | } or { |
217 | // TransmitRate == 1.6; | 214 | find spacecraftUplink(Spacecraft, Comm, Target); |
218 | //} or { | 215 | XCommSubsystem(Comm); |
219 | // find spacecraftUplink(Spacecraft, Comm, Target); | 216 | Spacecraft(Target); |
220 | // XCommSubsystem(Comm); | 217 | TransmitRate == 1.6; |
221 | // GroundStationNetwork(Target); | 218 | } or { |
222 | // TransmitRate == 0.7; | 219 | find spacecraftUplink(Spacecraft, Comm, Target); |
223 | //} or { | 220 | XCommSubsystem(Comm); |
224 | // find spacecraftUplink(Spacecraft, Comm, Target); | 221 | GroundStationNetwork(Target); |
225 | // KaCommSubsystem(Comm); | 222 | TransmitRate == 0.7; |
226 | // Spacecraft(Target); | 223 | } or { |
227 | // TransmitRate == 220.0; | 224 | find spacecraftUplink(Spacecraft, Comm, Target); |
228 | //} or { | 225 | KaCommSubsystem(Comm); |
229 | // find spacecraftUplink(Spacecraft, Comm, Target); | 226 | Spacecraft(Target); |
230 | // KaCommSubsystem(Comm); | 227 | TransmitRate == 220.0; |
231 | // GroundStationNetwork(Target); | 228 | } or { |
232 | // TransmitRate == 80.0; | 229 | find spacecraftUplink(Spacecraft, Comm, Target); |
233 | //} | 230 | KaCommSubsystem(Comm); |
234 | // | 231 | GroundStationNetwork(Target); |
235 | //private pattern spacecraftUplink(Spacecraft : Spacecraft, TargetSubsystem : CommSubsystem, Target : CommunicatingElement) { | 232 | TransmitRate == 80.0; |
236 | // CommunicatingElement.communicationLink(Spacecraft, Link); | 233 | } |
237 | // DirectedCommunicationLink.target(Link, TargetSubsystem); | 234 | |
238 | // CommunicatingElement.commSubsystem(Target, TargetSubsystem); | 235 | private pattern spacecraftUplink(Spacecraft : Spacecraft, TargetSubsystem : CommSubsystem, Target : CommunicatingElement) { |
239 | //} | 236 | CommunicatingElement.commSubsystem.target(Spacecraft, TargetSubsystem); |
240 | // | 237 | CommunicatingElement.commSubsystem(Target, TargetSubsystem); |
241 | //// Cost | 238 | } |
242 | // | 239 | |
243 | //pattern costMetric(Cost : java Double) { | 240 | // Cost |
244 | // Cost == sum find missionCost(_, #_); | 241 | |
245 | //} | 242 | pattern costMetric(Cost : java Double) { |
246 | // | 243 | Cost == sum find missionCost(_, #_); |
247 | //private pattern missionCost(Mission : InterferometryMission, Cost : java Double) { | 244 | } |
248 | // InterferometryMission.observationTime(Mission, ObservationTime); | 245 | |
249 | // SpacecraftCost == sum find spacecraftCost(Mission, _, #_); | 246 | private pattern missionCost(Mission : InterferometryMission, Cost : java Double) { |
250 | // Cost == eval(SpacecraftCost + 100000.0 * ObservationTime); | 247 | InterferometryMission.observationTime(Mission, ObservationTime); |
251 | //} | 248 | SpacecraftCost == sum find spacecraftCost(Mission, _, #_); |
252 | // | 249 | Cost == eval(SpacecraftCost + 100000.0 * ObservationTime); |
253 | //private pattern spacecraftCost(Mission : InterferometryMission, Spacecraft : Spacecraft, Cost : java Double) { | 250 | } |
254 | // ConstellationMission.spacecraft(Mission, Spacecraft); | 251 | |
255 | // find spacecraftOfKindCount(Spacecraft, KindCount); | 252 | private pattern spacecraftCost(Mission : InterferometryMission, Spacecraft : Spacecraft, Cost : java Double) { |
256 | // find basePrice(Spacecraft, BasePrice); | 253 | ConstellationMission.spacecraft(Mission, Spacecraft); |
257 | // find interferometryPayloadCost(Spacecraft, InterferometryPayloadCost); | 254 | find spacecraftOfKindCount(Spacecraft, KindCount); |
258 | // find additionalCommSubsystemCost(Spacecraft, AdditionalCommSubsystemCost); | 255 | find basePrice(Spacecraft, BasePrice); |
259 | // Cost == eval(BasePrice * Math.pow(KindCount, -0.25) + InterferometryPayloadCost + AdditionalCommSubsystemCost); | 256 | find interferometryPayloadCost(Spacecraft, InterferometryPayloadCost); |
260 | //} | 257 | find additionalCommSubsystemCost(Spacecraft, AdditionalCommSubsystemCost); |
261 | // | 258 | Cost == eval(BasePrice * Math.pow(KindCount, -0.25) + InterferometryPayloadCost + AdditionalCommSubsystemCost); |
262 | //private pattern spacecraftOfKindCount(Sat : Spacecraft, Count : java Integer) { | 259 | } |
263 | // CubeSat3U(Sat); | 260 | |
264 | // Count == count find cubeSat3U(_); | 261 | private pattern spacecraftOfKindCount(Sat : Spacecraft, Count : java Integer) { |
265 | //} or { | 262 | CubeSat3U(Sat); |
266 | // CubeSat6U(Sat); | 263 | Count == count find cubeSat3U(_); |
267 | // Count == count find cubeSat6U(_); | 264 | } or { |
268 | //} or { | 265 | CubeSat6U(Sat); |
269 | // SmallSat(Sat); | 266 | Count == count find cubeSat6U(_); |
270 | // Count == count find smallSat(_); | 267 | } or { |
271 | //} | 268 | SmallSat(Sat); |
272 | // | 269 | Count == count find smallSat(_); |
273 | //private pattern basePrice(Spacecraft : Spacecraft, BasePrice : java Double) { | 270 | } |
274 | // CubeSat3U(Spacecraft); | 271 | |
275 | // BasePrice == 250000.0; | 272 | private pattern basePrice(Spacecraft : Spacecraft, BasePrice : java Double) { |
276 | //} or { | 273 | CubeSat3U(Spacecraft); |
277 | // CubeSat6U(Spacecraft); | 274 | BasePrice == 250000.0; |
278 | // BasePrice == 750000.0; | 275 | } or { |
279 | //} or { | 276 | CubeSat6U(Spacecraft); |
280 | // SmallSat(Spacecraft); | 277 | BasePrice == 750000.0; |
281 | // BasePrice == 3000000.0; | 278 | } or { |
282 | //} | 279 | SmallSat(Spacecraft); |
283 | // | 280 | BasePrice == 3000000.0; |
284 | //private pattern interferometryPayloadCost(Spacecraft : Spacecraft, Cost : java Double) { | 281 | } |
285 | // find spacecraftWithInterferometryPayload(_, Spacecraft); | 282 | |
286 | // Cost == 50000.0; | 283 | private pattern interferometryPayloadCost(Spacecraft : Spacecraft, Cost : java Double) { |
287 | //} or { | 284 | find spacecraftWithInterferometryPayload(_, Spacecraft); |
288 | // neg find spacecraftWithInterferometryPayload(_, Spacecraft); | 285 | Cost == 50000.0; |
289 | // Cost == 0.0; | 286 | } or { |
290 | //} | 287 | neg find spacecraftWithInterferometryPayload(_, Spacecraft); |
291 | // | 288 | Cost == 0.0; |
292 | //private pattern additionalCommSubsystemCost(Spacecraft : Spacecraft, Cost : java Double) { | 289 | } |
293 | // find spacecraftWithTwoCommSubsystems(Spacecraft); | 290 | |
294 | // Cost == 100000.0; | 291 | private pattern additionalCommSubsystemCost(Spacecraft : Spacecraft, Cost : java Double) { |
295 | //} or { | 292 | find spacecraftWithTwoCommSubsystems(Spacecraft); |
296 | // neg find spacecraftWithTwoCommSubsystems(Spacecraft); | 293 | Cost == 100000.0; |
297 | // Cost == 0.0; | 294 | } or { |
298 | //} | 295 | neg find spacecraftWithTwoCommSubsystems(Spacecraft); |
299 | // | 296 | Cost == 0.0; |
300 | //private pattern spacecraftWithTwoCommSubsystems(Spacecraft : Spacecraft) { | 297 | } |
301 | // Spacecraft.commSubsystem(Spacecraft, Subsystem1); | 298 | |
302 | // Spacecraft.commSubsystem(Spacecraft, Subsystem2); | 299 | private pattern spacecraftWithTwoCommSubsystems(Spacecraft : Spacecraft) { |
303 | // Subsystem1 != Subsystem2; | 300 | Spacecraft.commSubsystem(Spacecraft, Subsystem1); |
304 | //} \ No newline at end of file | 301 | Spacecraft.commSubsystem(Spacecraft, Subsystem2); |
302 | Subsystem1 != Subsystem2; | ||
303 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.CostObjective.xtendbin b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.CostObjective.xtendbin new file mode 100644 index 00000000..9d4649e5 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.CostObjective.xtendbin | |||
Binary files differ | |||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.LocalSearchEngineManager.xtendbin b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.LocalSearchEngineManager.xtendbin new file mode 100644 index 00000000..9c013962 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.LocalSearchEngineManager.xtendbin | |||
Binary files differ | |||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.MetricBasedGuidanceFunction.xtendbin b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.MetricBasedGuidanceFunction.xtendbin new file mode 100644 index 00000000..456c7785 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.MetricBasedGuidanceFunction.xtendbin | |||
Binary files differ | |||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.PatternMatchConstraint.xtendbin b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.PatternMatchConstraint.xtendbin new file mode 100644 index 00000000..4eaa04bd --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.PatternMatchConstraint.xtendbin | |||
Binary files differ | |||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.SatelliteMdeOptimiserMain.xtendbin b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.SatelliteMdeOptimiserMain.xtendbin new file mode 100644 index 00000000..11cbad32 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/.SatelliteMdeOptimiserMain.xtendbin | |||
Binary files differ | |||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/CostObjective.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/CostObjective.java new file mode 100644 index 00000000..8659913c --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/CostObjective.java | |||
@@ -0,0 +1,16 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo; | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo.MetricBasedGuidanceFunction; | ||
4 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric; | ||
5 | |||
6 | @SuppressWarnings("all") | ||
7 | public class CostObjective extends MetricBasedGuidanceFunction { | ||
8 | public CostObjective() { | ||
9 | super(CostMetric.instance()); | ||
10 | } | ||
11 | |||
12 | @Override | ||
13 | public String getName() { | ||
14 | return "Cost"; | ||
15 | } | ||
16 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/LocalSearchEngineManager.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/LocalSearchEngineManager.java new file mode 100644 index 00000000..18708a37 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/LocalSearchEngineManager.java | |||
@@ -0,0 +1,39 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo; | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SatelliteQueries; | ||
4 | import java.util.WeakHashMap; | ||
5 | import java.util.function.Function; | ||
6 | import org.eclipse.emf.ecore.EObject; | ||
7 | import org.eclipse.viatra.query.runtime.api.AdvancedViatraQueryEngine; | ||
8 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
9 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineOptions; | ||
10 | import org.eclipse.viatra.query.runtime.emf.EMFScope; | ||
11 | import org.eclipse.viatra.query.runtime.localsearch.matcher.integration.LocalSearchHints; | ||
12 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
13 | |||
14 | @SuppressWarnings("all") | ||
15 | public class LocalSearchEngineManager { | ||
16 | public static final LocalSearchEngineManager INSTANCE = new LocalSearchEngineManager(); | ||
17 | |||
18 | private final WeakHashMap<EObject, ViatraQueryEngine> engineMap = new WeakHashMap<EObject, ViatraQueryEngine>(); | ||
19 | |||
20 | private LocalSearchEngineManager() { | ||
21 | } | ||
22 | |||
23 | public ViatraQueryEngine getEngine(final EObject eObject) { | ||
24 | final Function<EObject, ViatraQueryEngine> _function = (EObject it) -> { | ||
25 | ViatraQueryEngine _xblockexpression = null; | ||
26 | { | ||
27 | final EMFScope scope = new EMFScope(it); | ||
28 | final QueryEvaluationHint localSearchHints = LocalSearchHints.getDefault().build(); | ||
29 | final ViatraQueryEngineOptions options = ViatraQueryEngineOptions.defineOptions().withDefaultHint(localSearchHints).withDefaultBackend( | ||
30 | localSearchHints.getQueryBackendFactory()).build(); | ||
31 | final ViatraQueryEngine engine = AdvancedViatraQueryEngine.on(scope, options); | ||
32 | SatelliteQueries.instance().prepare(engine); | ||
33 | _xblockexpression = engine; | ||
34 | } | ||
35 | return _xblockexpression; | ||
36 | }; | ||
37 | return this.engineMap.computeIfAbsent(eObject, _function); | ||
38 | } | ||
39 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/MetricBasedGuidanceFunction.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/MetricBasedGuidanceFunction.java new file mode 100644 index 00000000..f3dae715 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/MetricBasedGuidanceFunction.java | |||
@@ -0,0 +1,72 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo; | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo.LocalSearchEngineManager; | ||
4 | import java.util.Iterator; | ||
5 | import org.eclipse.emf.ecore.EObject; | ||
6 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
7 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
8 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
9 | import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher; | ||
10 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction; | ||
11 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution; | ||
12 | |||
13 | @SuppressWarnings("all") | ||
14 | public abstract class MetricBasedGuidanceFunction implements IGuidanceFunction { | ||
15 | private final IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>> querySpecification; | ||
16 | |||
17 | protected MetricBasedGuidanceFunction(final IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>> querySpecification) { | ||
18 | this.querySpecification = querySpecification; | ||
19 | int _size = querySpecification.getParameters().size(); | ||
20 | boolean _notEquals = (_size != 1); | ||
21 | if (_notEquals) { | ||
22 | throw new IllegalArgumentException("Metric must have a single parameter"); | ||
23 | } | ||
24 | } | ||
25 | |||
26 | @Override | ||
27 | public double computeFitness(final Solution model) { | ||
28 | double _xblockexpression = (double) 0; | ||
29 | { | ||
30 | final double value = this.getMetricValue(model); | ||
31 | _xblockexpression = this.computeFitness(value); | ||
32 | } | ||
33 | return _xblockexpression; | ||
34 | } | ||
35 | |||
36 | protected double computeFitness(final double metricValue) { | ||
37 | return metricValue; | ||
38 | } | ||
39 | |||
40 | private double getMetricValue(final Solution solution) { | ||
41 | double _xblockexpression = (double) 0; | ||
42 | { | ||
43 | final EObject model = solution.getModel(); | ||
44 | final ViatraQueryEngine queryEngine = LocalSearchEngineManager.INSTANCE.getEngine(model); | ||
45 | final ViatraQueryMatcher<? extends IPatternMatch> matcher = this.querySpecification.getMatcher(queryEngine); | ||
46 | final Iterator<? extends IPatternMatch> iterator = matcher.getAllMatches().iterator(); | ||
47 | boolean _hasNext = iterator.hasNext(); | ||
48 | boolean _not = (!_hasNext); | ||
49 | if (_not) { | ||
50 | throw new IllegalStateException("Too few matches"); | ||
51 | } | ||
52 | final Object objectValue = iterator.next().get(0); | ||
53 | double _xifexpression = (double) 0; | ||
54 | if ((objectValue instanceof Number)) { | ||
55 | double _xblockexpression_1 = (double) 0; | ||
56 | { | ||
57 | final double doubleValue = ((Number)objectValue).doubleValue(); | ||
58 | boolean _hasNext_1 = iterator.hasNext(); | ||
59 | if (_hasNext_1) { | ||
60 | throw new IllegalStateException("Too many matches"); | ||
61 | } | ||
62 | _xblockexpression_1 = doubleValue; | ||
63 | } | ||
64 | _xifexpression = _xblockexpression_1; | ||
65 | } else { | ||
66 | throw new IllegalStateException("Metric value must be a number"); | ||
67 | } | ||
68 | _xblockexpression = _xifexpression; | ||
69 | } | ||
70 | return _xblockexpression; | ||
71 | } | ||
72 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/PatternMatchConstraint.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/PatternMatchConstraint.java new file mode 100644 index 00000000..f089d469 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/PatternMatchConstraint.java | |||
@@ -0,0 +1,54 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo; | ||
2 | |||
3 | import com.google.common.base.Objects; | ||
4 | import com.google.common.collect.ImmutableList; | ||
5 | import hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo.LocalSearchEngineManager; | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SatelliteQueries; | ||
7 | import org.eclipse.emf.ecore.EObject; | ||
8 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
9 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
10 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
11 | import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher; | ||
12 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
13 | import org.eclipse.xtext.xbase.lib.Functions.Function1; | ||
14 | import org.eclipse.xtext.xbase.lib.IterableExtensions; | ||
15 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction; | ||
16 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution; | ||
17 | |||
18 | @SuppressWarnings("all") | ||
19 | public class PatternMatchConstraint implements IGuidanceFunction { | ||
20 | private static final String CONSTRAINT_ANNOTATION_NAME = "Constraint"; | ||
21 | |||
22 | private final ImmutableList<IQuerySpecification<?>> queries = ImmutableList.<IQuerySpecification<?>>copyOf(IterableExtensions.<IQuerySpecification<?>>filter(SatelliteQueries.instance().getSpecifications(), ((Function1<IQuerySpecification<?>, Boolean>) (IQuerySpecification<?> it) -> { | ||
23 | final Function1<PAnnotation, Boolean> _function = (PAnnotation it_1) -> { | ||
24 | String _name = it_1.getName(); | ||
25 | return Boolean.valueOf(Objects.equal(_name, PatternMatchConstraint.CONSTRAINT_ANNOTATION_NAME)); | ||
26 | }; | ||
27 | return Boolean.valueOf(IterableExtensions.<PAnnotation>exists(it.getAllAnnotations(), _function)); | ||
28 | }))); | ||
29 | |||
30 | @Override | ||
31 | public String getName() { | ||
32 | return "PatternMatch"; | ||
33 | } | ||
34 | |||
35 | @Override | ||
36 | public double computeFitness(final Solution solution) { | ||
37 | int _xblockexpression = (int) 0; | ||
38 | { | ||
39 | final EObject model = solution.getModel(); | ||
40 | final ViatraQueryEngine queryEngine = LocalSearchEngineManager.INSTANCE.getEngine(model); | ||
41 | int matchCount = 0; | ||
42 | for (final IQuerySpecification<?> query : this.queries) { | ||
43 | { | ||
44 | final ViatraQueryMatcher<? extends IPatternMatch> matcher = query.getMatcher(queryEngine); | ||
45 | int _matchCount = matchCount; | ||
46 | int _countMatches = matcher.countMatches(); | ||
47 | matchCount = (_matchCount + _countMatches); | ||
48 | } | ||
49 | } | ||
50 | _xblockexpression = matchCount; | ||
51 | } | ||
52 | return _xblockexpression; | ||
53 | } | ||
54 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.java new file mode 100644 index 00000000..6cbb08fc --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.java | |||
@@ -0,0 +1,69 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo; | ||
2 | |||
3 | import java.io.BufferedReader; | ||
4 | import java.io.BufferedWriter; | ||
5 | import java.io.FileReader; | ||
6 | import java.io.FileWriter; | ||
7 | import java.util.Collections; | ||
8 | import java.util.Map; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EPackage; | ||
11 | import org.eclipse.emf.ecore.resource.Resource; | ||
12 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; | ||
13 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; | ||
14 | import org.eclipse.xtext.xbase.lib.Exceptions; | ||
15 | import org.eclipse.xtext.xbase.lib.Pair; | ||
16 | import satellite.SatellitePackage; | ||
17 | import uk.ac.kcl.inf.mdeoptimiser.interfaces.cli.Run; | ||
18 | |||
19 | @SuppressWarnings("all") | ||
20 | public class SatelliteMdeOptimiserMain { | ||
21 | private static final String PROJECT_PATH = "."; | ||
22 | |||
23 | private static final String MOPT_PATH = "src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/satellite.mopt"; | ||
24 | |||
25 | private SatelliteMdeOptimiserMain() { | ||
26 | new IllegalStateException("This is a static utility class and should not be instantiated directly."); | ||
27 | } | ||
28 | |||
29 | public static void main(final String[] args) { | ||
30 | Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); | ||
31 | XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); | ||
32 | _extensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, _xMIResourceFactoryImpl); | ||
33 | EPackage.Registry.INSTANCE.put(SatellitePackage.eNS_URI, SatellitePackage.eINSTANCE); | ||
34 | Pair<String, String> _mappedTo = Pair.<String, String>of("satellite.ecore", SatellitePackage.eNS_URI); | ||
35 | SatelliteMdeOptimiserMain.fixupHenshinModel("model/satellite.henshin", "model/satellite_fixup.henshin", | ||
36 | Collections.<String, String>unmodifiableMap(CollectionLiterals.<String, String>newHashMap(_mappedTo))); | ||
37 | Run.main(new String[] { "-p", SatelliteMdeOptimiserMain.PROJECT_PATH, "-m", SatelliteMdeOptimiserMain.MOPT_PATH }); | ||
38 | } | ||
39 | |||
40 | private static void fixupHenshinModel(final String originalPath, final String outputPath, final Map<String, String> remapMap) { | ||
41 | try { | ||
42 | FileReader _fileReader = new FileReader(originalPath); | ||
43 | final BufferedReader reader = new BufferedReader(_fileReader); | ||
44 | try { | ||
45 | FileWriter _fileWriter = new FileWriter(outputPath); | ||
46 | final BufferedWriter writer = new BufferedWriter(_fileWriter); | ||
47 | try { | ||
48 | String line = null; | ||
49 | while (((line = reader.readLine()) != null)) { | ||
50 | { | ||
51 | Set<Map.Entry<String, String>> _entrySet = remapMap.entrySet(); | ||
52 | for (final Map.Entry<String, String> entry : _entrySet) { | ||
53 | line = line.replace(entry.getKey(), entry.getValue()); | ||
54 | } | ||
55 | writer.write(line); | ||
56 | writer.write("\n"); | ||
57 | } | ||
58 | } | ||
59 | } finally { | ||
60 | writer.close(); | ||
61 | } | ||
62 | } finally { | ||
63 | reader.close(); | ||
64 | } | ||
65 | } catch (Throwable _e) { | ||
66 | throw Exceptions.sneakyThrow(_e); | ||
67 | } | ||
68 | } | ||
69 | } | ||