-
Notifications
You must be signed in to change notification settings - Fork 0
/
exercise3.lst
285 lines (213 loc) · 9.38 KB
/
exercise3.lst
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 09/14/22 14:13:09 Page 1
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
C o m p i l a t i o n
Laboratorio 2 - MOS
Ejercicio 3
Realizado por:
Juan Andrés Romero C - 202013449
Juan Sebastián Alegría - 202011282
9
10 Sets i 'Zones' /i1*i12/
11 alias(j,i);
12
13 Parameter edges(i,j) 'Graph edges';
14
15 * Connections from node 1
16 edges('i1','i2') = 1;
17 edges('i1','i3') = 1;
18 edges('i1','i5') = 1;
19 * Connections from node 2
20 edges('i2','i5') = 1;
21 * Connections from node 3
22 edges('i3','i6') = 1;
23 edges('i3','i4') = 1;
24 edges('i3','i5') = 1;
25 edges('i3','i7') = 1;
26 edges('i3','i8') = 1;
27 * Connections from node 4
28 edges('i4','i5') = 1;
29 edges('i4','i6') = 1;
30 edges('i4','i11') = 1;
31 * Connections from node 5
32 edges('i5','i10') = 1;
33 edges('i5','i11') = 1;
34 * Connections from node 6
35 edges('i6','i8') = 1;
36 edges('i6','i11') = 1;
37 * Connections from node 7
38 edges('i7','i8') = 1;
39 edges('i7','i12') = 1;
40 * Connections from node 8
41 edges('i8','i9') = 1;
42 edges('i8','i11') = 1;
43 edges('i8','i12') = 1;
44 * Connections from node 9
45 edges('i9','i10') = 1;
46 edges('i9','i11') = 1;
47 edges('i9','i12') = 1;
48 * Connections from node 10
49 edges('i10','i11') = 1;
50
51 * Since it's an undirected graph there are bidirectional connections
52 loop((i,j),
53 if (edges(i,j) = 1,
54 edges(j,i) = 1
55 );
56 );
57
58 * Indicate the coverage of the zone where the antenna is installed.
59 loop((i),
60 edges(i,i) = 1;
61 );
62
63 Variables x(i) 'Node selected'
64 z 'Target function';
65
66 Binary Variable x;
67
68 Equations targetFunc 'Target Function'
69 coverage(i) 'All nodes must be covered';
70
71 targetFunc.. z =e= sum(i, x(i));
72 coverage(i).. sum((j), x(j)*edges(i,j)) =g= 1;
73
74 Model Exercise3 /all/ ;
75 option mip=cplex
76 Solve Exercise3 using mip minimizing z;
77 Display x.l;
COMPILATION TIME = 0.002 SECONDS 3 MB 40.1.0 93c2a77b DEX-DEG
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 09/14/22 14:13:09 Page 2
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Equation Listing SOLVE Exercise3 Using MIP From line 76
---- targetFunc =E= Target Function
targetFunc.. - x(i1) - x(i2) - x(i3) - x(i4) - x(i5) - x(i6) - x(i7) - x(i8) - x(i9) - x(i10) - x(i11) - x(i12) + z =E= 0 ; (LHS = 0)
---- coverage =G= All nodes must be covered
coverage(i1).. x(i1) + x(i2) + x(i3) + x(i5) =G= 1 ; (LHS = 0, INFES = 1 ****)
coverage(i2).. x(i1) + x(i2) + x(i5) =G= 1 ; (LHS = 0, INFES = 1 ****)
coverage(i3).. x(i1) + x(i3) + x(i4) + x(i5) + x(i6) + x(i7) + x(i8) =G= 1 ; (LHS = 0, INFES = 1 ****)
REMAINING 9 ENTRIES SKIPPED
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 09/14/22 14:13:09 Page 3
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Column Listing SOLVE Exercise3 Using MIP From line 76
---- x Node selected
x(i1)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-1 targetFunc
1 coverage(i1)
1 coverage(i2)
1 coverage(i3)
1 coverage(i5)
x(i2)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-1 targetFunc
1 coverage(i1)
1 coverage(i2)
1 coverage(i5)
x(i3)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-1 targetFunc
1 coverage(i1)
1 coverage(i3)
1 coverage(i4)
1 coverage(i5)
1 coverage(i6)
1 coverage(i7)
1 coverage(i8)
REMAINING 9 ENTRIES SKIPPED
---- z Target function
z
(.LO, .L, .UP, .M = -INF, 0, +INF, 0)
1 targetFunc
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 09/14/22 14:13:09 Page 4
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Range Statistics SOLVE Exercise3 Using MIP From line 76
RANGE STATISTICS (ABSOLUTE NON-ZERO FINITE VALUES)
RHS [min, max] : [ 1.000E+00, 1.000E+00] - Zero values observed as well
Bound [min, max] : [ 1.000E+00, 1.000E+00] - Zero values observed as well
Matrix [min, max] : [ 1.000E+00, 1.000E+00]
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 09/14/22 14:13:09 Page 5
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Model Statistics SOLVE Exercise3 Using MIP From line 76
MODEL STATISTICS
BLOCKS OF EQUATIONS 2 SINGLE EQUATIONS 13
BLOCKS OF VARIABLES 2 SINGLE VARIABLES 13
NON ZERO ELEMENTS 75 DISCRETE VARIABLES 12
GENERATION TIME = 0.012 SECONDS 4 MB 40.1.0 93c2a77b DEX-DEG
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 09/14/22 14:13:09 Page 6
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Solution Report SOLVE Exercise3 Using MIP From line 76
S O L V E S U M M A R Y
MODEL Exercise3 OBJECTIVE z
TYPE MIP DIRECTION MINIMIZE
SOLVER CPLEX FROM LINE 76
**** SOLVER STATUS 1 Normal Completion
**** MODEL STATUS 1 Optimal
**** OBJECTIVE VALUE 2.0000
RESOURCE USAGE, LIMIT 0.038 10000000000.000
ITERATION COUNT, LIMIT 0 2147483647
--- *** This solver runs with a community license. No commercial use.
--- GMO setup time: 0.00s
--- GMO memory 0.50 Mb (peak 0.50 Mb)
--- Dictionary memory 0.00 Mb
--- Cplex 22.1.0.0 link memory 0.00 Mb (peak 0.00 Mb)
--- Starting Cplex
--- MIP status (101): integer optimal solution.
--- Cplex Time: 0.01sec (det. 0.03 ticks)
--- Fixing integer variables and solving final LP...
--- Fixed MIP status (1): optimal.
--- Cplex Time: 0.00sec (det. 0.01 ticks)
Proven optimal solution
MIP Solution: 2.000000 (0 iterations, 0 nodes)
Final Solve: 2.000000 (0 iterations)
Best possible: 2.000000
Absolute gap: 0.000000
Relative gap: 0.000000
LOWER LEVEL UPPER MARGINAL
---- EQU targetFunc . . . 1.0000
targetFunc Target Function
---- EQU coverage All nodes must be covered
LOWER LEVEL UPPER MARGINAL
i1 1.0000 1.0000 +INF .
i2 1.0000 1.0000 +INF .
i3 1.0000 2.0000 +INF .
i4 1.0000 1.0000 +INF .
i5 1.0000 1.0000 +INF .
i6 1.0000 1.0000 +INF .
i7 1.0000 1.0000 +INF .
i8 1.0000 1.0000 +INF .
i9 1.0000 1.0000 +INF .
i10 1.0000 1.0000 +INF .
i11 1.0000 2.0000 +INF .
i12 1.0000 1.0000 +INF .
---- VAR x Node selected
LOWER LEVEL UPPER MARGINAL
i1 . . 1.0000 1.0000
i2 . . 1.0000 1.0000
i3 . . 1.0000 1.0000
i4 . . 1.0000 1.0000
i5 . 1.0000 1.0000 1.0000
i6 . . 1.0000 1.0000
i7 . . 1.0000 1.0000
i8 . 1.0000 1.0000 1.0000
i9 . . 1.0000 1.0000
i10 . . 1.0000 1.0000
i11 . . 1.0000 1.0000
i12 . . 1.0000 1.0000
LOWER LEVEL UPPER MARGINAL
---- VAR z -INF 2.0000 +INF .
z Target function
**** REPORT SUMMARY : 0 NONOPT
0 INFEASIBLE
0 UNBOUNDED
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 09/14/22 14:13:09 Page 7
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
E x e c u t i o n
---- 77 VARIABLE x.L Node selected
i5 1.000, i8 1.000
EXECUTION TIME = 0.082 SECONDS 4 MB 40.1.0 93c2a77b DEX-DEG
USER: GAMS Community License for Juan Alegria G220811|0002AO-GEN
Universidad de los Andes, CL3634
License for teaching and research at degree granting institutions
**** FILE SUMMARY
Input /Users/zejiran/hack/uniandes/MSO/laboratory-02/exercise3.gms
Output /Users/zejiran/hack/uniandes/MSO/laboratory-02/exercise3.lst