(!****************************************************** Xpress-SP Example ====================== `````````````````` FILE: ATO.mos DESCRIPTION: Stochastic 2-stage linear model TYPE: Supply Chain: Assemble to order (ATO) system We study a simple yet well-known ATO system which is comprised of a set of components and products. Each product is manufactured by assembling a subset of available components. The demand of products is random, and the inventory level of the components must be such that the expected total cost is minimized. The total cost consists of inventory holding costs and penalties for lost sales of products. MODEL: Parameters: m: total number of components (indexed by i ) n: total number of products (indexed by j ) A(i,j): number of units of component i required to make one unit of product j x0: vector of initial inventory of components c: vector of unit cost of procurement of components h: vector of unit cost of components p: vector of unit costs for shortage of products Uncertainty: d(j): random demand for product j Variables: y: vector of inventory position of components z: vector of amount of product produced from the components x: vector of excess of components left in the inventory after the demands are met w: vector of lost sales of products Model: minimize {c(y-x0) + E { min hx+pw : Az+x=y, z+w=d,x,z,w>=0} : y>=x0} FURTHER INFO: see Xpress-SP guide see A. Dormer, A. Vazacopoulos, N. Verma, H. Tipi – “Modeling & Solving Stochastic Programming Problems in Supply Chain Management using Xpress-SP”, “Supply Chain Optimization”, Editors: Joseph Geunes and Panos Pardalos see Jing-Sheng Song, Paul Zipkin, “Supply Chain Operations: Assemble-to-Order Systems”, Forthcoming in Handbooks in Operations Research and Management Science, Vol. XXX: Supply Chain Management, T. de Kok and S. Graves (eds.), North-Holland. DATE: Oct 2006 (c) 2006 Dash Associates Author: Nitin Verma Dash Optimization Inc, NJ *******************************************************!) model "Assemble to order" !model name uses 'mmsp' !mosel model library for stochastic programming parameters !can be changed dynamically at run time DIR="Data/" DatFile=DIR+"ATO.dat" DistFile=DIR+"ATOdist.dat" end-parameters declarations m,n:integer !dimensions end-declarations initializations from DatFile !read dimensions m n end-initializations declarations Components=1..m !set of components Products=1..n !set of products c,h:array(Components) of real !procurement, holding cost p:array(Products) of real !penalty cost A:array(Components,Products) of real end-declarations initializations from DatFile c h p A end-initializations declarations Stages=1..2 !2-stage stochastic problem d:array(Products) of sprand !random demand x,y:array(Components) of spvar !excess inventory, inventory position w,z:array(Products) of spvar !lost sales, amount produced TotCost:splinctr !total cost incurred SupBal:array(Components) of splinctr !supply balance DemBal:array(Products) of splinctr !demand balance end-declarations !-----------------------------Stage association--------------------------- spsetstages(Stages) !set stages forall(i in Components) do spsetstage(y(i),1);spsetstage(x(i),2); end-do forall(j in Products) do spsetstage(d(j),2);spsetstage(w(j),2);spsetstage(z(j),2); end-do !----------------------------Scenario generation------------------------- declarations nVals:integer !number of discretized points end-declarations initializations from DistFile nVals end-initializations declarations val,prob:array(1..nVals) of real !discretized values and probabilities end-declarations initializations from DistFile val prob end-initializations forall(j in Products) spsetdist(d(j),val,prob) !set discretized distribution spgenexhtree !generate exhaustive scenario tree !--------------------------Model formulation------------------------------ TotCost:=sum(i in Components) (c(i)*y(i)+h(i)*x(i))+ sum(j in Products) p(j)*w(j) forall(i in Components) SupBal(i):=sum(j in Products) A(i,j)*z(j)+x(i)=y(i) forall(j in Products) DemBal(j):=z(j)+w(j)=d(j) minimize(TotCost) !Optimization end-model