-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExercise1.lst
305 lines (217 loc) · 11.1 KB
/
Exercise1.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
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 10/14/22 20:25:26 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 1
Realizado por:
Juan Andrés Romero C - 202013449
Juan Sebastián Alegría - 202011282
9
10 Sets i 'Players' /i1*i7/
11 rolePerformance 'Role performance' /BallControl, Shooting, Rebounds, Defense/
12 position 'Available positions' /Attack, Center, Defense/;
13
14 Table Performance(i, rolePerformance)
15
16 BallControl Shooting Rebounds Defense
17 i1 3 3 1 3
18 i2 2 1 3 2
19 i3 2 3 2 2
20 i4 1 3 3 1
21 i5 3 3 3 3
22 i6 3 1 2 3
23 i7 3 2 2 1;
24
25 Parameter positions(i, position);
26
27 positions('i1', 'Attack') = 1;
28 positions('i2', 'Center') = 1;
29 positions('i3', 'Attack') = 1;
30 positions('i3', 'Defense') = 1;
31 positions('i4', 'Center') = 1;
32 positions('i4', 'Defense') = 1;
33 positions('i5', 'Attack') = 1;
34 positions('i5', 'Defense') = 1;
35 positions('i6', 'Center') = 1;
36 positions('i6', 'Defense') = 1;
37 positions('i7', 'Defense') = 1;
38 positions('i7', 'Attack') = 1;
39
40 Variables x(i) 'Indicates if said player is chosen'
41 z 'Objective function';
42
43 Binary Variable x;
44
45 Equations targetFunc 'Target function'
46 amountPlayers 'Amount of players'
47 defenseConstraint 'Defense position constraint'
48 attackingConstraint 'Attacking position constraint'
49 centerConstraint 'Center position constraint'
50 ballControlConstraint 'Ball control constraint'
51 shootingConstraint 'Shooting constraint'
52 reboundsConstraint 'Rebounds constraint'
53 player2or3 'Player 2 or 3 chosen';
54
55 targetFunc.. z =e= sum(i, x(i)*Performance(i, 'Defense'));
56 amountPlayers.. sum(i, x(i)) =e= 5;
57 defenseConstraint.. sum(i, x(i)*positions(i, 'Defense')) =g= 4;
58 attackingConstraint.. sum(i, x(i)*positions(i, 'Attack')) =g= 2;
59 centerConstraint.. sum(i, x(i)*positions(i, 'Center')) =g= 1;
60 ballControlConstraint.. sum(i, x(i)*Performance(i, 'BallControl'))/5 =g= 2;
61 shootingConstraint.. sum(i, x(i)*Performance(i, 'Shooting'))/5 =g= 2;
62 reboundsConstraint.. sum(i, x(i)*Performance(i, 'Rebounds'))/5 =g= 2;
63 player2or3.. x('i2') + x('i3') =e= 1;
64
65 Model exercise1 /all/;
66 option mip=cplex
67 Solve exercise1 using mip maximizing z;
68 Display x.l, z.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:25:26 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 exercise1 Using MIP From line 67
---- targetFunc =E= Target function
targetFunc.. - 3*x(i1) - 2*x(i2) - 2*x(i3) - x(i4) - 3*x(i5) - 3*x(i6) - x(i7) + z =E= 0 ; (LHS = 0)
---- amountPlayers =E= Amount of players
amountPlayers.. x(i1) + x(i2) + x(i3) + x(i4) + x(i5) + x(i6) + x(i7) =E= 5 ; (LHS = 0, INFES = 5 ****)
---- defenseConstraint =G= Defense position constraint
defenseConstraint.. x(i3) + x(i4) + x(i5) + x(i6) + x(i7) =G= 4 ; (LHS = 0, INFES = 4 ****)
---- attackingConstraint =G= Attacking position constraint
attackingConstraint.. x(i1) + x(i3) + x(i5) + x(i7) =G= 2 ; (LHS = 0, INFES = 2 ****)
---- centerConstraint =G= Center position constraint
centerConstraint.. x(i2) + x(i4) + x(i6) =G= 1 ; (LHS = 0, INFES = 1 ****)
---- ballControlConstraint =G= Ball control constraint
ballControlConstraint.. 0.6*x(i1) + 0.4*x(i2) + 0.4*x(i3) + 0.2*x(i4) + 0.6*x(i5) + 0.6*x(i6) + 0.6*x(i7) =G= 2 ; (LHS = 0, INFES = 2 ****)
---- shootingConstraint =G= Shooting constraint
shootingConstraint.. 0.6*x(i1) + 0.2*x(i2) + 0.6*x(i3) + 0.6*x(i4) + 0.6*x(i5) + 0.2*x(i6) + 0.4*x(i7) =G= 2 ; (LHS = 0, INFES = 2 ****)
---- reboundsConstraint =G= Rebounds constraint
reboundsConstraint.. 0.2*x(i1) + 0.6*x(i2) + 0.4*x(i3) + 0.6*x(i4) + 0.6*x(i5) + 0.4*x(i6) + 0.4*x(i7) =G= 2 ; (LHS = 0, INFES = 2 ****)
---- player2or3 =E= Player 2 or 3 chosen
player2or3.. x(i2) + x(i3) =E= 1 ; (LHS = 0, INFES = 1 ****)
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 10/14/22 20:25:26 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 exercise1 Using MIP From line 67
---- x Indicates if said player is chosen
x(i1)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-3 targetFunc
1 amountPlayers
1 attackingConstraint
0.6 ballControlConstraint
0.6 shootingConstraint
0.2 reboundsConstraint
x(i2)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-2 targetFunc
1 amountPlayers
1 centerConstraint
0.4 ballControlConstraint
0.2 shootingConstraint
0.6 reboundsConstraint
1 player2or3
x(i3)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-2 targetFunc
1 amountPlayers
1 defenseConstraint
1 attackingConstraint
0.4 ballControlConstraint
0.6 shootingConstraint
0.4 reboundsConstraint
1 player2or3
REMAINING 4 ENTRIES SKIPPED
---- z Objective 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:25:26 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 exercise1 Using MIP From line 67
RANGE STATISTICS (ABSOLUTE NON-ZERO FINITE VALUES)
RHS [min, max] : [ 1.000E+00, 5.000E+00] - Zero values observed as well
Bound [min, max] : [ 1.000E+00, 1.000E+00] - Zero values observed as well
Matrix [min, max] : [ 2.000E-01, 3.000E+00]
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 10/14/22 20:25:26 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 exercise1 Using MIP From line 67
MODEL STATISTICS
BLOCKS OF EQUATIONS 9 SINGLE EQUATIONS 9
BLOCKS OF VARIABLES 2 SINGLE VARIABLES 8
NON ZERO ELEMENTS 50 DISCRETE VARIABLES 7
GENERATION TIME = 0.013 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:25:26 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 exercise1 Using MIP From line 67
S O L V E S U M M A R Y
MODEL exercise1 OBJECTIVE z
TYPE MIP DIRECTION MAXIMIZE
SOLVER CPLEX FROM LINE 67
**** SOLVER STATUS 1 Normal Completion
**** MODEL STATUS 1 Optimal
**** OBJECTIVE VALUE 12.0000
RESOURCE USAGE, LIMIT 0.065 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: 12.000000 (0 iterations, 0 nodes)
Final Solve: 12.000000 (0 iterations)
Best possible: 12.000000
Absolute gap: 0.000000
Relative gap: 0.000000
LOWER LEVEL UPPER MARGINAL
---- EQU targetFunc . . . 1.0000
---- EQU amountPla~ 5.0000 5.0000 5.0000 .
---- EQU defenseCo~ 4.0000 4.0000 +INF .
---- EQU attacking~ 2.0000 3.0000 +INF .
---- EQU centerCon~ 1.0000 2.0000 +INF .
---- EQU ballContr~ 2.0000 2.4000 +INF .
---- EQU shootingC~ 2.0000 2.6000 +INF .
---- EQU reboundsC~ 2.0000 2.2000 +INF .
---- EQU player2or3 1.0000 1.0000 1.0000 .
targetFunc Target function
amountPlayers Amount of players
defenseConstraint Defense position constraint
attackingConstraint Attacking position constraint
centerConstraint Center position constraint
ballControlConstraint Ball control constraint
shootingConstraint Shooting constraint
reboundsConstraint Rebounds constraint
player2or3 Player 2 or 3 chosen
---- VAR x Indicates if said player is chosen
LOWER LEVEL UPPER MARGINAL
i1 . 1.0000 1.0000 3.0000
i2 . . 1.0000 2.0000
i3 . 1.0000 1.0000 2.0000
i4 . 1.0000 1.0000 1.0000
i5 . 1.0000 1.0000 3.0000
i6 . 1.0000 1.0000 3.0000
i7 . . 1.0000 1.0000
LOWER LEVEL UPPER MARGINAL
---- VAR z -INF 12.0000 +INF .
z Objective 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:25:26 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
---- 68 VARIABLE x.L Indicates if said player is chosen
i1 1.000, i3 1.000, i4 1.000, i5 1.000, i6 1.000
---- 68 VARIABLE z.L = 12.000 Objective function
EXECUTION TIME = 0.112 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/exercise1.gms
Output /Users/zejiran/hack/uniandes/MSO/laboratory-03/exercise1.lst