From campbell@ist.uwaterloo.ca Thu Oct 8 16:45:03 EDT 1998 Yo! Here's an example program that shows how to do Sensitivity Analysis in GAMS and how to read the results (it is based on an example from the textbook that we studied in class). Colin ---------------------------------------------------------------- sets i /oz6, oz10/; variables x(i), z; x.lo(i) = 0; equations cost hours storage sales; cost.. z =e= 500*x('oz6') + 450*x('oz10'); hours.. 6*x('oz6') + 5*x('oz10') =l= 60; storage.. 10*x('oz6') + 20*x('oz10') =l= 150; sales.. x('oz6') =l= 8; model glassmodel /all/; *----------------------------------------------------------- * THREE STEPS FOR SENSITIVITY ANALYSIS: * * (1) Create a file called "cplex.opt" with these 2 lines: * * objrng * rhsrng * * (2) Add the following two lines here in your GAMS program: option lp=cplex; glassmodel.optfile=1; * (3) Run the program on "descartes" as it is * the only undergrad machine with CPLEX. *----------------------------------------------------------- solve glassmodel maximizing z using lp; display x.l, x.m; *----------------------------------------------------------- * The output in the GAMS listing file will contain: *----------------------------------------------------------- $ONTEXT EQUATION NAME LOWER CURRENT UPPER ------------- ----- ------- ----- COST -INF 0 +INF | These are HOURS 37.5 60 65.5 | bounds on STORAGE 128 150 240 | the RHS (b) SALES 6.429 8 +INF | variables | themselves. | E.g. hours can go | up _to_ 65.5. VARIABLE NAME LOWER CURRENT UPPER ------------- ----- ------- ----- | These are X(OZ6) -275 0 40 | bounds on X(OZ10) -33.33 0 550 | changes (deltas) | to the c values. | E.g. c for 6oz glasses | can go up _by_ 40. Z 1.11e-16 1 +INF *----------------------------------------------------------- $OFFTEXT ---------------------------------------------------------------- Colin Campbell (IST) -- www.ist.uwaterloo.ca/~campbell Scientific Computing and Communications Consultant ----------------------------------------------------------------