-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworkshop1.lst
235 lines (160 loc) · 7.74 KB
/
workshop1.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
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 09/01/22 11:12:47 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
Workshop 1 - MOS
Made by:
Juan Andrés Romero C - 202013449
Juan Sebastián Alegría - 202011282
8
9 Sets i 'Foods' /C, A, L, P/
10 j 'Food Properties' /Cal, Prot, Sugar, Fat, Carbs/;
11
12 Parameter Price(i) /C 3000, A 1000, L 600, P 700/;
13 Parameter Limit(j) /Cal 1500, Prot 63, Sugar 25, Fat 50, Carbs 200/;
14
15 Table t(j, i) 'Properties of each food'
16
17 C A L P
18 Cal 287 204 146 245
19 Prot 26 4.2 8 6
20 Sugar 0 0.01 13 35
21 Fat 19.3 0.5 8 0.8
22 Carbs 0 44.1 11 55;
23
24
25 Variables z 'Target function'
26 x(i) 'Amount of a food';
27
28 Positive Variable x;
29
30 Equations targetFunc 'Target function'
31 gtConstraint 'Minimum properties restriction'
32 ltConstraint 'Maximum properties restriction';
33
34 targetFunc.. z =e= sum((i), Price(i)*x(i));
35 gtConstraint(j)$(ord(j)=1 or ord(j) = 2).. sum((i), t(j,i)*x(i)) =g= Limit(j);
36 ltConstraint(j)$(ord(j)=3 or ord(j)=4 or ord(j)=5).. sum((i), t(j,i)*x(i)) =l= Limit(j);
37
38 Model workshop1 /all/;
39 option lp=CPLEX;
40 Solve workshop1 using lp minimizing z;
41 Display x.l;
42 Display z.l;
COMPILATION TIME = 0.005 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/01/22 11:12:47 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 workshop1 Using LP From line 40
---- targetFunc =E= Target function
targetFunc.. z - 3000*x(C) - 1000*x(A) - 600*x(L) - 700*x(P) =E= 0 ; (LHS = 0)
---- gtConstraint =G= Minimum properties restriction
gtConstraint(Cal).. 287*x(C) + 204*x(A) + 146*x(L) + 245*x(P) =G= 1500 ; (LHS = 0, INFES = 1500 ****)
gtConstraint(Prot).. 26*x(C) + 4.2*x(A) + 8*x(L) + 6*x(P) =G= 63 ; (LHS = 0, INFES = 63 ****)
---- ltConstraint =L= Maximum properties restriction
ltConstraint(Sugar).. 0.01*x(A) + 13*x(L) + 35*x(P) =L= 25 ; (LHS = 0)
ltConstraint(Fat).. 19.3*x(C) + 0.5*x(A) + 8*x(L) + 0.8*x(P) =L= 50 ; (LHS = 0)
ltConstraint(Carbs).. 44.1*x(A) + 11*x(L) + 55*x(P) =L= 200 ; (LHS = 0)
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 09/01/22 11:12:47 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 workshop1 Using LP From line 40
---- z Target function
z
(.LO, .L, .UP, .M = -INF, 0, +INF, 0)
1 targetFunc
---- x Amount of a food
x(C)
(.LO, .L, .UP, .M = 0, 0, +INF, 0)
-3000 targetFunc
287 gtConstraint(Cal)
26 gtConstraint(Prot)
19.3 ltConstraint(Fat)
x(A)
(.LO, .L, .UP, .M = 0, 0, +INF, 0)
-1000 targetFunc
204 gtConstraint(Cal)
4.2 gtConstraint(Prot)
0.01 ltConstraint(Sugar)
0.5 ltConstraint(Fat)
44.1 ltConstraint(Carbs)
x(L)
(.LO, .L, .UP, .M = 0, 0, +INF, 0)
-600 targetFunc
146 gtConstraint(Cal)
8 gtConstraint(Prot)
13 ltConstraint(Sugar)
8 ltConstraint(Fat)
11 ltConstraint(Carbs)
REMAINING ENTRY SKIPPED
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 09/01/22 11:12:47 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 workshop1 Using LP From line 40
RANGE STATISTICS (ABSOLUTE NON-ZERO FINITE VALUES)
RHS [min, max] : [ 2.500E+01, 1.500E+03] - Zero values observed as well
Bound [min, max] : [ NA, NA] - Zero values observed as well
Matrix [min, max] : [ 1.000E-02, 3.000E+03]
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 09/01/22 11:12:47 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 workshop1 Using LP From line 40
MODEL STATISTICS
BLOCKS OF EQUATIONS 3 SINGLE EQUATIONS 6
BLOCKS OF VARIABLES 2 SINGLE VARIABLES 5
NON ZERO ELEMENTS 23
GENERATION TIME = 0.016 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/01/22 11:12:47 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 workshop1 Using LP From line 40
S O L V E S U M M A R Y
MODEL workshop1 OBJECTIVE z
TYPE LP DIRECTION MINIMIZE
SOLVER CPLEX FROM LINE 40
**** SOLVER STATUS 1 Normal Completion
**** MODEL STATUS 1 Optimal
**** OBJECTIVE VALUE 9307.9977
RESOURCE USAGE, LIMIT 0.057 10000000000.000
ITERATION COUNT, LIMIT 4 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
--- LP status (1): optimal.
--- Cplex Time: 0.01sec (det. 0.01 ticks)
Optimal solution found
Objective: 9307.997731
LOWER LEVEL UPPER MARGINAL
---- EQU targetFunc . . . 1.0000
targetFunc Target function
---- EQU gtConstraint Minimum properties restriction
LOWER LEVEL UPPER MARGINAL
Cal 1500.0000 1500.0000 +INF 10.4530
Prot 63.0000 67.9273 +INF .
---- EQU ltConstraint Maximum properties restriction
LOWER LEVEL UPPER MARGINAL
Sugar -INF 25.0000 25.0000 -49.5228
Fat -INF 43.7630 50.0000 .
Carbs -INF 200.0000 200.0000 -25.6669
LOWER LEVEL UPPER MARGINAL
---- VAR z -INF 9307.9977 +INF .
z Target function
---- VAR x Amount of a food
LOWER LEVEL UPPER MARGINAL
C . 1.3666 +INF .
A . 4.0562 +INF .
L . 1.9200 +INF .
P . . +INF 1284.0014
**** REPORT SUMMARY : 0 NONOPT
0 INFEASIBLE
0 UNBOUNDED
GAMS 40.1.0 93c2a77b Aug 1, 2022 DEX-DEG x86 64bit/Mac OS X - 09/01/22 11:12:47 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
---- 41 VARIABLE x.L Amount of a food
C 1.367, A 4.056, L 1.920
---- 42 VARIABLE z.L = 9307.998 Target function
EXECUTION TIME = 0.125 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/workshop-01/workshop1.gms
Output /Users/zejiran/hack/uniandes/MSO/workshop-01/workshop1.lst