-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exercise3.lst
359 lines (250 loc) · 11.9 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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 10/14/22 20:48:00 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 3 - MOS
Ejercicio 3
Realizado por:
Juan Andrés Romero C - 202013449
Juan Sebastián Alegría - 202011282
9
10 Sets i 'Songs' /i1*i8/
11 genre 'Song genres' /BluesRock, RockAndRoll/;
12
13 Parameter songGenres(i, genre);
14
15 songGenres('i1', 'BluesRock') = 1;
16 songGenres('i2', 'RockAndRoll') = 1;
17 songGenres('i3', 'BluesRock') = 1;
18 songGenres('i4', 'RockAndRoll') = 1;
19 songGenres('i5', 'BluesRock') = 1;
20 songGenres('i6', 'RockAndRoll') = 1;
21 songGenres('i8', 'RockAndRoll') = 1;
22 songGenres('i8', 'BluesRock') = 1;
23
24 Parameter duration(i) 'Song durations' /i1 4, i2 5, i3 3, i4 2, i5 4, i6 3, i7 5, i8 4/;
25
26 Variables a(i) 'Song selected (Side A)'
27 b(i) 'Song selected (Side B)'
28 z 'Target function';
29
30 Binary Variables a
31 b;
32
33 Equations targetFunc
34 minDurationA
35 maxDurationA
36 minDurationB
37 maxDurationB
38 minBluesA
39 minBluesB
40 minRockNRoll
41 conditionalX
42 conditionalY
43 organization;
44
45 targetFunc.. z =e= sum(i, a(i)+b(i));
46 minDurationA.. sum(i, a(i)*duration(i)) =g= 14;
47 maxDurationA.. sum(i, a(i)*duration(i)) =l= 16;
48 minDurationB.. sum(i, b(i)*duration(i)) =g= 14;
49 maxDurationB.. sum(i, b(i)*duration(i)) =l= 16;
50 minBluesA.. sum(i, a(i)*songGenres(i,'BluesRock')) =e= 2;
51 minBluesB.. sum(i, b(i)*songGenres(i,'BluesRock')) =e= 2;
52 minRockNRoll.. sum(i, a(i)*songGenres(i,'RockAndRoll')) =g= 3;
53 conditionalX.. 1-a('i1') =g= a('i5');
54 conditionalY.. a('i2') + a('i4') =l= b('i1')+1;
55 organization(i).. 1-a(i) =g= b(i);
56
57 Model exercise3 /all/;
58 option mip=cplex
59 Solve exercise3 using mip minimizing z;
60 Display a.l;
61 Display b.l;
COMPILATION TIME = 0.004 SECONDS 3 MB 40.1.0 93c2a77b DEX-DEG
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 10/14/22 20:48:00 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 59
---- targetFunc =E=
targetFunc.. - a(i1) - a(i2) - a(i3) - a(i4) - a(i5) - a(i6) - a(i7) - a(i8) - b(i1) - b(i2) - b(i3) - b(i4) - b(i5) - b(i6) - b(i7) - b(i8) + z =E= 0 ; (LHS = 0)
---- minDurationA =G=
minDurationA.. 4*a(i1) + 5*a(i2) + 3*a(i3) + 2*a(i4) + 4*a(i5) + 3*a(i6) + 5*a(i7) + 4*a(i8) =G= 14 ; (LHS = 0, INFES = 14 ****)
---- maxDurationA =L=
maxDurationA.. 4*a(i1) + 5*a(i2) + 3*a(i3) + 2*a(i4) + 4*a(i5) + 3*a(i6) + 5*a(i7) + 4*a(i8) =L= 16 ; (LHS = 0)
---- minDurationB =G=
minDurationB.. 4*b(i1) + 5*b(i2) + 3*b(i3) + 2*b(i4) + 4*b(i5) + 3*b(i6) + 5*b(i7) + 4*b(i8) =G= 14 ; (LHS = 0, INFES = 14 ****)
---- maxDurationB =L=
maxDurationB.. 4*b(i1) + 5*b(i2) + 3*b(i3) + 2*b(i4) + 4*b(i5) + 3*b(i6) + 5*b(i7) + 4*b(i8) =L= 16 ; (LHS = 0)
---- minBluesA =E=
minBluesA.. a(i1) + a(i3) + a(i5) + a(i8) =E= 2 ; (LHS = 0, INFES = 2 ****)
---- minBluesB =E=
minBluesB.. b(i1) + b(i3) + b(i5) + b(i8) =E= 2 ; (LHS = 0, INFES = 2 ****)
---- minRockNRoll =G=
minRockNRoll.. a(i2) + a(i4) + a(i6) + a(i8) =G= 3 ; (LHS = 0, INFES = 3 ****)
---- conditionalX =G=
conditionalX.. - a(i1) - a(i5) =G= -1 ; (LHS = 0)
---- conditionalY =L=
conditionalY.. a(i2) + a(i4) - b(i1) =L= 1 ; (LHS = 0)
---- organization =G=
organization(i1).. - a(i1) - b(i1) =G= -1 ; (LHS = 0)
organization(i2).. - a(i2) - b(i2) =G= -1 ; (LHS = 0)
organization(i3).. - a(i3) - b(i3) =G= -1 ; (LHS = 0)
REMAINING 5 ENTRIES SKIPPED
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 10/14/22 20:48:00 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 59
---- a Song selected (Side A)
a(i1)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-1 targetFunc
4 minDurationA
4 maxDurationA
1 minBluesA
-1 conditionalX
-1 organization(i1)
a(i2)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-1 targetFunc
5 minDurationA
5 maxDurationA
1 minRockNRoll
1 conditionalY
-1 organization(i2)
a(i3)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-1 targetFunc
3 minDurationA
3 maxDurationA
1 minBluesA
-1 organization(i3)
REMAINING 5 ENTRIES SKIPPED
---- b Song selected (Side B)
b(i1)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-1 targetFunc
4 minDurationB
4 maxDurationB
1 minBluesB
-1 conditionalY
-1 organization(i1)
b(i2)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-1 targetFunc
5 minDurationB
5 maxDurationB
-1 organization(i2)
b(i3)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-1 targetFunc
3 minDurationB
3 maxDurationB
1 minBluesB
-1 organization(i3)
REMAINING 5 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 - 10/14/22 20:48:00 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 59
RANGE STATISTICS (ABSOLUTE NON-ZERO FINITE VALUES)
RHS [min, max] : [ 1.000E+00, 1.600E+01] - 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, 5.000E+00]
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 10/14/22 20:48:00 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 59
MODEL STATISTICS
BLOCKS OF EQUATIONS 11 SINGLE EQUATIONS 18
BLOCKS OF VARIABLES 3 SINGLE VARIABLES 17
NON ZERO ELEMENTS 82 DISCRETE VARIABLES 16
GENERATION TIME = 0.011 SECONDS 4 MB 40.1.0 93c2a77b DEX-DEG
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 10/14/22 20:48:00 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 59
S O L V E S U M M A R Y
MODEL exercise3 OBJECTIVE z
TYPE MIP DIRECTION MINIMIZE
SOLVER CPLEX FROM LINE 59
**** SOLVER STATUS 1 Normal Completion
**** MODEL STATUS 1 Optimal
**** OBJECTIVE VALUE 8.0000
RESOURCE USAGE, LIMIT 0.043 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.08 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: 8.000000 (0 iterations, 0 nodes)
Final Solve: 8.000000 (0 iterations)
Best possible: 8.000000
Absolute gap: 0.000000
Relative gap: 0.000000
LOWER LEVEL UPPER MARGINAL
---- EQU targetFunc . . . 1.0000
---- EQU minDurati~ 14.0000 16.0000 +INF .
---- EQU maxDurati~ -INF 16.0000 16.0000 .
---- EQU minDurati~ 14.0000 14.0000 +INF .
---- EQU maxDurati~ -INF 14.0000 16.0000 .
---- EQU minBluesA 2.0000 2.0000 2.0000 .
---- EQU minBluesB 2.0000 2.0000 2.0000 .
---- EQU minRockNR~ 3.0000 3.0000 +INF .
---- EQU condition~ -1.0000 -1.0000 +INF .
---- EQU condition~ -INF 1.0000 1.0000 .
---- EQU organization
LOWER LEVEL UPPER MARGINAL
i1 -1.0000 -1.0000 +INF .
i2 -1.0000 -1.0000 +INF .
i3 -1.0000 -1.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 .
---- VAR a Song selected (Side A)
LOWER LEVEL UPPER MARGINAL
i1 . 1.0000 1.0000 1.0000
i2 . 1.0000 1.0000 1.0000
i3 . . 1.0000 1.0000
i4 . . 1.0000 1.0000
i5 . . 1.0000 1.0000
i6 . 1.0000 1.0000 1.0000
i7 . . 1.0000 1.0000
i8 . 1.0000 1.0000 1.0000
---- VAR b Song selected (Side B)
LOWER LEVEL UPPER MARGINAL
i1 . . 1.0000 1.0000
i2 . . 1.0000 1.0000
i3 . 1.0000 1.0000 1.0000
i4 . 1.0000 1.0000 1.0000
i5 . 1.0000 1.0000 1.0000
i6 . . 1.0000 1.0000
i7 . 1.0000 1.0000 1.0000
i8 . . 1.0000 1.0000
LOWER LEVEL UPPER MARGINAL
---- VAR z -INF 8.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 - 10/14/22 20:48:00 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
---- 60 VARIABLE a.L Song selected (Side A)
i1 1.000, i2 1.000, i6 1.000, i8 1.000
---- 61 VARIABLE b.L Song selected (Side B)
i3 1.000, i4 1.000, i5 1.000, i7 1.000
EXECUTION TIME = 0.087 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-03/exercise3.gms
Output /Users/zejiran/hack/uniandes/MSO/laboratory-03/exercise3.lst