! Single period, multiproduct inventory problem,
  Version 3, demand is Normal distributed with a
  known mean and standard deviation for each type 
  of demand;
SETS:
   DTYPE: MEAN, SD;
 ! There are a set of scenarios;
   SCENE: SELLWW, SELLWE, SELLBB, SELLBE;
   SXD(SCENE,DTYPE): DEMAND,  U, Z;
ENDSETS
DATA: ! There are three types of demand: 1) Customers who will accept only WHITE, 2) Customers who will accept only BLUE, 3) Customers who will accept either; DTYPE= WHITE BLUE EITHER; MEAN = 90 80 30; ! Expected demand of each type; SD = 24 21 10; ! Estimated standard deviation in demand; SPRICE= 48; ! The selling price/unit, same for Blue & White; PCOST = 22; ! The purchase cost/unit paid by the retailer; ! Scenario related stuff; SCENE = 1..100; ! Arbitrarily choose a seed for the quasi-random number generator and generate uniform random variables for each scenario; U = @QRAND( 314159); ENDDATA ! Generate the demands; @FOR( SCENE(s): @FOR(DTYPE(p): !Generate standard Normal r.v. for each scenario s & demand type p; @FREE( Z(s,p)); @FREE(DEMAND(s,p)); U(s,p)= @PSN( Z(s,p)); ! This causes Z to follow a Standard Normal; DEMAND(s,p)= @SMAX(0, MEAN(p) + SD(p)*Z(s,p)); ! No demands < 0; ); ); ! Count number of scenarios; NS = @SIZE( SCENE); ! Maximize average profit over all scenarios; MAX = PROFIT; PROFIT = @SUM( SCENE(s): SPRICE*(SELLWW(s) + SELLWE(s) + SELLBB(s) + SELLBE(s)) - PCOST*(STOCKW+STOCKB))/NS; @GIN( STOCKW); @GIN(STOCKB); ! Can only stock an integer number; ! Use suggestive notation for three types of demand; W = 1; B = 2; E = 3; @FOR( SCENE(s): ! SELLij = number of type i items sold to type j demand; ! We cannot sell more than we stock; SELLWW(s) + SELLWE(s) <= STOCKW; SELLBB(s) + SELLBE(s) <= STOCKB; ! nor more than demand; SELLWW(s) <= DEMAND(s,W); SELLBB(s) <= DEMAND(s,B); SELLWE(s) + SELLBE(s) <= DEMAND(s,E); );