-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexercise1.lst
204 lines (137 loc) · 6.56 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
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 08/31/22 07:47:35 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
Laboratory 1 - MOS
Exercise 1
Made by:
Juan Andrés Romero C - 202013449
Juan Sebastián Alegría - 202011282
9
10 Sets i 'articles' /a1, a2, a3, a4, a5/;
11
12 Parameter v(i) 'Value of each article' /a1 12, a2 5, a3 9, a4 6, a5 4/;
13 Parameter p(i) 'Weigth of each article' /a1 9, a2 2, a3 2, a4 1, a5 3/;
14
15 Scalar LIMIT 'Maximum weight that the backpack can carry' /10/;
16
17 Variables x(i) 'Indicates if the article is included or not'
18 z 'Target function';
19
20 Binary Variable x;
21
22 Equations targetFunc 'Target function'
23 constraint 'Restriction';
24
25 targetFunc.. z =e= sum((i), v(i)*x(i));
26 constraint.. sum((i), p(i)*x(i)) =l= LIMIT;
27
28 Model exercise1 /all/;
29 option mip=CPLEX;
30 Solve exercise1 using mip maximizing z;
31
32 Display x.l;
33 Display z.l;
COMPILATION TIME = 0.003 SECONDS 3 MB 40.1.0 93c2a77b DEX-DEG
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 08/31/22 07:47:35 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 30
---- targetFunc =E= Target function
targetFunc.. - 12*x(a1) - 5*x(a2) - 9*x(a3) - 6*x(a4) - 4*x(a5) + z =E= 0 ; (LHS = 0)
---- constraint =L= Restriction
constraint.. 9*x(a1) + 2*x(a2) + 2*x(a3) + x(a4) + 3*x(a5) =L= 10 ; (LHS = 0)
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 08/31/22 07:47:35 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 30
---- x Indicates if the article is included or not
x(a1)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-12 targetFunc
9 constraint
x(a2)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-5 targetFunc
2 constraint
x(a3)
(.LO, .L, .UP, .M = 0, 0, 1, 0)
-9 targetFunc
2 constraint
REMAINING 2 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 - 08/31/22 07:47:35 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 30
RANGE STATISTICS (ABSOLUTE NON-ZERO FINITE VALUES)
RHS [min, max] : [ 1.000E+01, 1.000E+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, 1.200E+01]
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 08/31/22 07:47:35 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 30
MODEL STATISTICS
BLOCKS OF EQUATIONS 2 SINGLE EQUATIONS 2
BLOCKS OF VARIABLES 2 SINGLE VARIABLES 6
NON ZERO ELEMENTS 11 DISCRETE VARIABLES 5
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 - 08/31/22 07:47:35 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 30
S O L V E S U M M A R Y
MODEL exercise1 OBJECTIVE z
TYPE MIP DIRECTION MAXIMIZE
SOLVER CPLEX FROM LINE 30
**** SOLVER STATUS 1 Normal Completion
**** MODEL STATUS 1 Optimal
**** OBJECTIVE VALUE 24.0000
RESOURCE USAGE, LIMIT 0.052 10000000000.000
ITERATION COUNT, LIMIT 1 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.02sec (det. 0.03 ticks)
--- Fixing integer variables and solving final LP...
--- Fixed MIP status (1): optimal.
--- Cplex Time: 0.00sec (det. 0.00 ticks)
Proven optimal solution
MIP Solution: 24.000000 (1 iterations, 0 nodes)
Final Solve: 24.000000 (0 iterations)
Best possible: 24.000000
Absolute gap: 0.000000
Relative gap: 0.000000
LOWER LEVEL UPPER MARGINAL
---- EQU targetFunc . . . 1.0000
---- EQU constraint -INF 8.0000 10.0000 .
targetFunc Target function
constraint Restriction
---- VAR x Indicates if the article is included or not
LOWER LEVEL UPPER MARGINAL
a1 . . 1.0000 12.0000
a2 . 1.0000 1.0000 5.0000
a3 . 1.0000 1.0000 9.0000
a4 . 1.0000 1.0000 6.0000
a5 . 1.0000 1.0000 4.0000
LOWER LEVEL UPPER MARGINAL
---- VAR z -INF 24.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 - 08/31/22 07:47:35 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
---- 32 VARIABLE x.L Indicates if the article is included or not
a2 1.000, a3 1.000, a4 1.000, a5 1.000
---- 33 VARIABLE z.L = 24.000 Target function
EXECUTION TIME = 0.092 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-01/exercise1.gms
Output /Users/zejiran/hack/uniandes/MSO/laboratory-01/exercise1.lst