Mighty Steel example 09/22/01 13:28:12 PAGE 1 GAMS Rev 121 Linux/Intel 2 3 option limcol=0; 4 5 set months/Jul, Aug, Sep, Oct, Nov, Dec/; 6 7 parameter 8 sales(months) / Jul 4, Aug 8, Sep 16, Oct 12, Nov 6, Dec 4/; 9 10 * scale to get units instead of thousands units 11 sales(months) = 1000 * sales(months); 12 13 14 scalar 15 increaseProduction "cost per unit to increase production" /0.50/ 16 decreaseProduction "cost per unit to decrease production" /0.25/ 17 initialProduction "production in June" /4000/ 18 initialInventory "inventory at end of June" /2000/ 19 maxInventory "maximum inventory level" /10000/ ; 20 21 variable 22 production(months) "production in each month" 23 productionIncrease(months) "increase in production over previous month" 24 productionDecrease(months) "decrease in production over previous month" 25 inventory(months) " inventory at end of month" 26 cost ; 27 28 positive variables production, productionIncrease, productionDecrease; 29 30 equation 31 EQincrease(months) "define production increase" 32 EQdecrease(months) "define production decrease" 33 EQinventory(months) "define inventory at end of month" 34 objective "define cost"; 35 36 EQincrease(months).. 37 productionIncrease(months) =g= 38 production(months) - production(months-1) - 39 initialProduction$(ord(months)=1); 40 41 EQdecrease(months).. 42 productionDecrease(months) =g= 43 production(months-1) + initialProduction$(ord(months)=1) 44 - production(months); 45 46 EQinventory(months).. 47 inventory(months) =e= 48 inventory(months-1) + initialInventory$(ord(months)=1) 49 + production(months) - sales(months); 50 51 objective.. 52 cost =e= sum(months, productionIncrease(months)*increaseProduction) 53 + sum(months, productionDecrease(months)*decreaseProduction); 54 55 * set upper and lower bounds on inventory 56 inventory.lo(months) = 0; 57 inventory.up(months) = maxInventory; 58 59 model mightysteel/EQincrease, EQdecrease, EQinventory, objective/; 60 61 solve mightysteel using lp minimizing cost; 62 63 COMPILATION TIME = 0.000 SECONDS 0.7 Mb LNX200-121 Mighty Steel example 09/22/01 13:28:12 PAGE 2 Equation Listing SOLVE mightysteel USING LP FROM LINE 61 GAMS Rev 121 Linux/Intel ---- EQincrease =G= define production increase EQincrease(Jul).. - production(Jul) + productionIncrease(Jul) =G= -4000 ; (LHS = 0) EQincrease(Aug).. production(Jul) - production(Aug) + productionIncrease(Aug) =G= 0 ; (LHS = 0) EQincrease(Sep).. production(Aug) - production(Sep) + productionIncrease(Sep) =G= 0 ; (LHS = 0) REMAINING 3 ENTRIES SKIPPED ---- EQdecrease =G= define production decrease EQdecrease(Jul).. production(Jul) + productionDecrease(Jul) =G= 4000 ; (LHS = 0, INFES = 4000 ***) EQdecrease(Aug).. - production(Jul) + production(Aug) + productionDecrease(Aug) =G= 0 ; (LHS = 0) EQdecrease(Sep).. - production(Aug) + production(Sep) + productionDecrease(Sep) =G= 0 ; (LHS = 0) REMAINING 3 ENTRIES SKIPPED ---- EQinventory =E= define inventory at end of month EQinventory(Jul).. - production(Jul) + inventory(Jul) =E= -2000 ; (LHS = 0, INFES = 2000 ***) EQinventory(Aug).. - production(Aug) - inventory(Jul) + inventory(Aug) =E= -8000 ; (LHS = 0, INFES = 8000 ***) EQinventory(Sep).. - production(Sep) - inventory(Aug) + inventory(Sep) =E= -16000 ; (LHS = 0, INFES = 16000 ***) REMAINING 3 ENTRIES SKIPPED ---- objective =E= define cost objective.. - 0.5*productionIncrease(Jul) - 0.5*productionIncrease(Aug) - 0.5*productionIncrease(Sep) - 0.5*productionIncrease(Oct) - 0.5*productionIncrease(Nov) - 0.5*productionIncrease(Dec) - 0.25*productionDecrease(Jul) - 0.25*productionDecrease(Aug) - 0.25*productionDecrease(Sep) - 0.25*productionDecrease(Oct) - 0.25*productionDecrease(Nov) - 0.25*productionDecrease(Dec) + cost =E= 0 ; (LHS = 0) Mighty Steel example 09/22/01 13:28:12 PAGE 3 Model Statistics SOLVE mightysteel USING LP FROM LINE 61 GAMS Rev 121 Linux/Intel MODEL STATISTICS BLOCKS OF EQUATIONS 4 SINGLE EQUATIONS 19 BLOCKS OF VARIABLES 5 SINGLE VARIABLES 25 NON ZERO ELEMENTS 64 GENERATION TIME = 0.010 SECONDS 1.3 Mb LNX200-121 EXECUTION TIME = 0.010 SECONDS 1.3 Mb LNX200-121 Mighty Steel example 09/22/01 13:28:12 PAGE 4 GAMS Rev 121 Linux/Intel S O L V E S U M M A R Y MODEL mightysteel OBJECTIVE cost TYPE LP DIRECTION MINIMIZE SOLVER CPLEX FROM LINE 61 **** SOLVER STATUS 1 NORMAL COMPLETION **** MODEL STATUS 1 OPTIMAL **** OBJECTIVE VALUE 2750.0000 RESOURCE USAGE, LIMIT 0.010 1000.000 ITERATION COUNT, LIMIT 8 10000 GAMS/Cplex Mar 21, 2001 LNX.CP.CL 20.0 019.019.039.LNX For Cplex 7.0 Cplex 7.0.0, GAMS Link 19 Optimal solution found. Objective : 2750.000000 ---- EQU EQincrease define production increase LOWER LEVEL UPPER MARGINAL Jul -4000.0000 -4000.0000 +INF 0.5000 Aug . . +INF 0.3750 Sep . . +INF 0.2500 Oct . . +INF 0.1250 Nov . . +INF EPS Dec . . +INF EPS ---- EQU EQdecrease define production decrease LOWER LEVEL UPPER MARGINAL Jul 4000.0000 9500.0000 +INF . Aug . . +INF . Sep . . +INF . Oct . . +INF . Nov . . +INF . Dec . . +INF . ---- EQU EQinventory define inventory at end of month LOWER LEVEL UPPER MARGINAL Jul -2000.0000 -2000.0000 -2000.0000 -0.1250 Aug -8000.0000 -8000.0000 -8000.0000 -0.1250 Sep -16000.0000 -16000.0000 -16000.0000 -0.1250 Oct -12000.0000 -12000.0000 -12000.0000 -0.1250 Nov -6000.0000 -6000.0000 -6000.0000 EPS Dec -4000.0000 -4000.0000 -4000.0000 EPS LOWER LEVEL UPPER MARGINAL ---- EQU objective . . . 1.0000 objective define cost ---- VAR production production in each month LOWER LEVEL UPPER MARGINAL Jul . 9500.0000 +INF . Aug . 9500.0000 +INF . Sep . 9500.0000 +INF . Oct . 9500.0000 +INF . Nov . 9500.0000 +INF . Dec . 9500.0000 +INF . ---- VAR productionIncrease increase in production over previous month LOWER LEVEL UPPER MARGINAL Jul . 5500.0000 +INF . Aug . . +INF 0.1250 Sep . . +INF 0.2500 Oct . . +INF 0.3750 Nov . . +INF 0.5000 Dec . . +INF 0.5000 ---- VAR productionDecrease decrease in production over previous month LOWER LEVEL UPPER MARGINAL Jul . . +INF 0.2500 Aug . . +INF 0.2500 Sep . . +INF 0.2500 Oct . . +INF 0.2500 Nov . . +INF 0.2500 Dec . . +INF 0.2500 ---- VAR inventory inventory at end of month LOWER LEVEL UPPER MARGINAL Jul . 7500.0000 10000.0000 . Aug . 9000.0000 10000.0000 . Sep . 2500.0000 10000.0000 . Oct . . 10000.0000 0.1250 Nov . 3500.0000 10000.0000 . Dec . 9000.0000 10000.0000 . LOWER LEVEL UPPER MARGINAL ---- VAR cost -INF 2750.0000 +INF . **** REPORT SUMMARY : 0 NONOPT 0 INFEASIBLE 0 UNBOUNDED EXECUTION TIME = 0.010 SECONDS 0.7 Mb LNX200-121 USER: Computer Sciences Dept. G010628:1627AS-LNX University of Wisconsin-Madison DC2621 **** FILE SUMMARY INPUT /afs/cs.wisc.edu/u/s/w/swright/public/html/635/examples/mightysteel.gms OUTPUT /afs/cs.wisc.edu/u/s/w/swright/public/html/635/examples/mightysteel.lst