! Tornado parametric analysis of AstroCosmo model.  (AstroCosTrndo.lng)
 We are about to produce two products, Astros and Cosmos.
There are seven parameters of which we are unsure:
 1:2) The profit contribution of each (mainly selling price),
 3:4) Production line capacities for each of the two lines,
   5) Total amount of labor available per day.
 6:7) Labor usage rate/unit for each product,
For each parameter we estimate a
lowest possible value, PLO, a most likely median value, PMED,
and a highest possible value, PHI. We are interested how the
uncertainty in parameter value affects total profit.
The analysis identifies for each parameter, the "bottom line" uncertainty 
resulting from the input uncertainty of each parameter.
The Tornado diagram (it looks like a funnel cloud) gives a graphical
display, most uncertainty causing parameter at the top, 
least uncertainty causing parameter at the bottom;
! Keywords: Tornado diagram, Sensitivity analysis, Range analysis,
    Parametric analysis ;
  ! The set of parameters;
DATA: ! Names of random parameters; PSET = APROFIT CPROFIT ALABORCAP CLABORCAP LABORAVAIL ALABPRUSE CLABORUSE ; ! The median or base case values for the parameters; PMED = 20 30 60 50 120 1 2 ; ! Plausible low values for the parameters; PLO = 17 25 55 45 110 0.8 1.7 ; ! Plausible high values for the parameters; PHI = 25 38 65 60 140 1.4 2.3 ; ! For this parameter set we will see that LABORAVAIL has the greatest effect on bottom line uncertainty. CLABORCAP has the least effect (none) on bottom line uncertainty; ENDDATA SUBMODEL PARA ! The objective is to maximize profit; MAX = OBJ; OBJ = PAMV(1)*ASTRO + PAMV(2)*COSMO; ASTRO <= PAMV(3); ! Astro line capacity; COSMO <= PAMV(4); ! Cosmo line capacity; ! Labor usage <= labor available; PAMV(6)*ASTRO + PAMV(7)*COSMO <= PAMV(5); ENDSUBMODEL
CALC: ! Do a Tornado sensitivity analysis; ! First solve the base case; @FOR( PSET( p): PAMV(p) = PMED( p); ); @SOLVE( PARAMODEL); BASE = OBJ; ! Now loop over all parameters, solving the LO and HI case for parameter p, but with all other parameters at their base case; @FOR( PSET( p): PAMV(p) = PLO(p); ! First the LO case; @SOLVE( PARAMODEL); RESULTLO( p) = OBJ; PAMV(p) = PHI(p); ! Now the HI case; @SOLVE( PARAMODEL); RESULTHI( p) = OBJ; PAMV(p) = PMED(p); ! Restore base for this paramter; @WRITE(' For parameter ', PSET(p),', the range was ', RESULTHI(p)-RESULTLO(p), @NEWLINE(2)); ); ! Now do the Tornado diagram; @CHARTTORNADO( 'Tornado Diagram of Sensitivity to Uncertain Parameters', 'Profit', 'The Parameters', BASE, 'Parameter High', RESULTHI, 'Parameter Low', RESULTLO); ENDCALC