This repository has been archived by the owner on Nov 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModel.gipsl
190 lines (169 loc) · 7.12 KB
/
Model.gipsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
package "org.gips.examples.incrementalp2p.gips.incrementaldistribution"
import "http://www.eclipse.org/emf/2002/Ecore"
import "platform:/resource/LectureStudioModel/model/LectureStudioModel.ecore"
from "../org.gips.examples.incrementalp2p.gips.incrementaldistribution/src/gipsl/Rules.gt" import connectLectureStudioStreamClient
from "../org.gips.examples.incrementalp2p.gips.incrementaldistribution/src/gipsl/Rules.gt" import connectRelayClient
from "../org.gips.examples.incrementalp2p.gips.incrementaldistribution/src/gipsl/Rules.gt" import connectRelayStreamClient
from "../org.gips.examples.incrementalp2p.gips.incrementaldistribution/src/gipsl/Patterns.gt" import findCurrentLectureStudioConnection
from "../org.gips.examples.incrementalp2p.gips.incrementaldistribution/src/gipsl/Patterns.gt" import findCurrentRelayConnection
from "../org.gips.examples.incrementalp2p.gips.incrementaldistribution/src/gipsl/Patterns.gt" import findCurrentStreamingClientLS
from "../org.gips.examples.incrementalp2p.gips.incrementaldistribution/src/gipsl/Patterns.gt" import findAnyClient
from "../org.gips.examples.incrementalp2p.gips.incrementaldistribution/src/gipsl/Patterns.gt" import findWaitingClient
from "../org.gips.examples.incrementalp2p.gips.incrementaldistribution/src/gipsl/Patterns.gt" import findLectureStudioServer
from "../org.gips.examples.incrementalp2p.gips.incrementaldistribution/src/gipsl/Patterns.gt" import findAnyConnectionData
from "../org.gips.examples.incrementalp2p.gips.incrementaldistribution/src/gipsl/Patterns.gt" import findAnyClientAndLsData
config {
solver := GLPK [home:="fu", license:="bar"];
launchConfig := true [main := "lectureStudio.gipsl"];
timeLimit := true [value := 120.0];
randomSeed := true [value := 0];
presolve := true;
debugOutput := false;
}
mapping currentLectureStudioConnections with findCurrentLectureStudioConnection;
mapping currentRelayConnections with findCurrentRelayConnection;
mapping currentStreamingClientLS with findCurrentStreamingClientLS;
mapping streamingClientLS with connectLectureStudioStreamClient;
mapping relayClient with connectRelayClient;
mapping streamingClientRC with connectRelayStreamClient;
// Current LS clients
constraint -> pattern::findCurrentLectureStudioConnection {
mappings.currentLectureStudioConnections
-> filter(m| m.nodes().lectureStudioConnection == self.nodes().lectureStudioConnection)
-> count()
== 1
}
// Current relay clients
constraint -> pattern::findCurrentRelayConnection {
mappings.currentRelayConnections
-> filter(m |
m.nodes(). lectureStudioConnection == self.nodes().lectureStudioConnection &
m.nodes().relayConnection == self.nodes().relayConnection
)
-> count()
== 1
}
// Current StreamingClientLS
constraint-> pattern::findCurrentStreamingClientLS {
mappings.currentStreamingClientLS
-> filter(m | m.nodes().lectureStudioConnection.client.id == self.nodes().relayClient.id)
-> count()
>=
mappings.currentLectureStudioConnections
-> filter(m | m.nodes().lectureStudioConnection.client.id == self.nodes().relayClient.id)
-> count()
-
mappings.streamingClientRC
-> filter(m | m.nodes().connectionData.serverId == self.nodes().relayClient.id)
-> count()
}
constraint-> pattern::findAnyConnectionData {
mappings.currentStreamingClientLS
-> filter(m | m.nodes().lectureStudioConnection.client.id == self.nodes().connectionData.serverId)
-> count()
+
mappings.streamingClientRC
-> filter(m | m.nodes().connectionData == self.nodes().connectionData)
-> count()
<=
mappings.currentLectureStudioConnections
-> filter(m | m.nodes().lectureStudioConnection.client.id == self.nodes().connectionData.serverId)
-> count()
}
// Clients mapped once
constraint-> pattern::findWaitingClient {
mappings.streamingClientLS
-> filter(m | m.nodes().client == self.nodes().node)
-> count()
+
mappings.relayClient
-> filter(m | m.nodes().client == self.nodes().node)
-> count()
+
mappings.streamingClientRC
-> filter(m | m.nodes().client == self.nodes().node)
-> count()
== 1
}
// Every relay client has client(s) => rc != lsStream
constraint-> pattern::findWaitingClient {
mappings.relayClient
-> filter(m | m.nodes().client == self.nodes().node)
-> count()
<=
mappings.streamingClientRC
-> filter(m | m.nodes().server == self.nodes().node)
-> count()
}
// Every rcStream has a RC
constraint-> pattern::findAnyConnectionData {
mappings.streamingClientRC
-> filter(m | m.nodes().connectionData == self.nodes().connectionData)
-> count()
<=
mappings.relayClient
-> filter(m | m.nodes().client.id == self.nodes().connectionData.serverId)
-> count()
+
mappings.currentLectureStudioConnections
-> filter(m | m.nodes().lectureStudioConnection.client.id == self.nodes().connectionData.serverId)
-> count()
}
// Send to LSStream >= sendToRCStream
constraint -> pattern::findAnyClientAndLsData {
mappings.currentStreamingClientLS
-> filter(m | m.nodes().lectureStudioConnection.server == self.nodes().lsNode)
-> sum(m | self.nodes().lsData.size / m.nodes().lectureStudioConnection.server.sendBandwidth)
+
mappings.streamingClientLS
-> sum(m | self.nodes().lsData.size / m.nodes().server.sendBandwidth)
>=
mappings.streamingClientRC
-> filter(m | m.nodes().connectionData.serverId == self.nodes().node.id)
->sum(m | self.nodes().lsData.size / m.nodes().server.sendBandwidth)
+
mappings.currentRelayConnections
-> filter(m | m.nodes().relayConnection.server == self.nodes().node)
-> sum(m | self.nodes().lsData.size / m.nodes().relayConnection.server.sendBandwidth)
}
constraint -> pattern::findAnyClientAndLsData {
mappings.currentStreamingClientLS
-> filter(m | m.nodes().lectureStudioConnection.server == self.nodes().lsNode)
-> sum(m | self.nodes().lsData.size / m.nodes().lectureStudioConnection.transferRate)
+
mappings.streamingClientLS
-> sum(m | self.nodes().lsData.size / m.nodes().connectionData.bandwidth)
>=
mappings.streamingClientRC
-> filter(m | m.nodes().server == self.nodes().node)
->sum(m | self.nodes().lsData.size / m.nodes().connectionData.bandwidth)
+
mappings.currentRelayConnections
-> filter(m | m.nodes().relayConnection.server == self.nodes().node)
-> sum(m | self.nodes().lsData.size / m.nodes().relayConnection.transferRate)
}
objective minStreamLsSendBandwidth->class::LectureStudioServer {
mappings.currentLectureStudioConnections
-> filter(m | m.nodes().lectureStudioConnection.server == self.lsNode)
-> sum(m | self.data.size / m.nodes().lectureStudioConnection.server.sendBandwidth)
+
mappings.streamingClientLS
-> sum(m | self.data.size / m.nodes().server.sendBandwidth)
+
mappings.relayClient
-> sum(m | self.data.size / m.nodes().server.sendBandwidth)
}
objective minStreamLsConnectionBandwidth->class::LectureStudioServer {
mappings.currentLectureStudioConnections
-> filter(m | m.nodes().lectureStudioConnection.server == self.lsNode)
-> sum(m | self.data.size / m.nodes().lectureStudioConnection.transferRate)
+
mappings.streamingClientLS
-> sum(m | self.data.size / m.nodes().connectionData.bandwidth)
+
mappings.relayClient
-> sum(m | self.data.size / m.nodes().connectionData.bandwidth)
}
global objective : min {
minStreamLsSendBandwidth + minStreamLsConnectionBandwidth
}