(!******************************************************* Mosel Example Problems ====================== file expl2.mos `````````````` Network example from BCL User Guide. (c) 2001 Dash Associates author: S.Heipcke *********************************************************!) model Trans uses "mmxprs", "mmetc" ! Load the optimizer and ETC libraries declarations Suppliers: set of string ! Set of suppliers Customers: set of string ! Set of customers COST: array(Suppliers,Customers) of real ! Cost per supplier-customer pair AVAIL: array(Suppliers) of real ! Availability of products DEMAND: array(Customers) of real ! Demand by customers x: array(Suppliers,Customers) of mpvar end-declarations diskdata(ETC_IN+ETC_SPARSE, "ex2cost.dat", COST) diskdata(ETC_IN+ETC_SPARSE, "ex2avail.dat", AVAIL) diskdata(ETC_IN+ETC_SPARSE, "ex2dem1.dat", DEMAND) forall(s in Suppliers, c in Customers | COST(s,c)>0) create(x(s,c)) MinCost:= sum(s in Suppliers, c in Customers) COST(s,c) * x(s,c) forall(s in Suppliers) av(s):= sum(c in Customers) x(s,c) <= AVAIL(s) forall(c in Customers) de(c):= sum(s in Suppliers) x(s,c) >= DEMAND(c) minimize(MinCost) writeln("Objective: ", getobjval) forall(s in Suppliers, c in Customers) if(getsol(x(s,c))>0) then writeln(s," (", AVAIL(s), ") -> ", c, " (", DEMAND(c), "): ", getsol(x(s,c)) ) end-if end-model