/******************************************************** Xpress-BCL C# Example Problems ============================== file xbcoco3.cs ```````````````` Coco Problem Phase 3. Introduce time periods and inventory. (c) 2008-2024 Fair Isaac Corporation authors: S.Heipcke, D.Brett. ********************************************************/ using System; using System.Text; using System.IO; using BCL; namespace Examples { public class TestCoco3 { const int NP = 2; /* Number of products (p) */ const int NF = 2; /* Factories (f) */ const int NR = 2; /* Raw materials (r) */ const int NT = 4; /* Time periods (t) */ //Define XPRBDATAPATH to wherever you have placed the data folder; here we expect it to be same directory as compiled example. static string XPRBDATAPATH = Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName + "/Data"; static string PSTOCK0FILE= XPRBDATAPATH + "/coco/pstock0.dat"; static string RSTOCK0FILE= XPRBDATAPATH + "/coco/rstock0.dat"; static string REVFILE = XPRBDATAPATH + "/coco/revt.dat"; static string CMAKEFILE = XPRBDATAPATH + "/coco/cmake.dat"; static string CBUYFILE = XPRBDATAPATH + "/coco/cbuyt.dat"; static string REQFILE = XPRBDATAPATH + "/coco/req.dat"; static string MXSELLFILE = XPRBDATAPATH + "/coco/maxsellt.dat"; static string MXMAKEFILE = XPRBDATAPATH + "/coco/mxmake.dat"; /****TABLES****/ double[,] REV = new double[NP,NT]; /* Unit selling price of product p in period t */ double[,] CMAK = new double[NP,NF]; /* Unit cost to make product p at factory f */ double[,] CBUY = new double[NR,NT]; /* Unit cost to buy raw material r in period t */ double[,] REQ = new double[NP,NR]; /* Requirement by unit of prod. p for raw material r */ double[,] MXSELL = new double[NP,NT]; /* Max. amount of p that can be sold in period t */ double[] MXMAKE = new double[NF]; /* Max. amount factory f can make over all products */ double[,] PSTOCK0 = new double[NP,NF]; /* Initial product p stock level at factory f */ double[,] RSTOCK0 = new double[NR,NF]; /* Initial raw material r stock level at factory f*/ /****DATA****/ double CPSTOCK = 2; /* Unit cost to store any product p */ double CRSTOCK = 1; /* Unit cost to store any raw material r */ double MXRSTOCK = 300; /* Max. amount of r that can be stored each f and t */ XPRBprob pb = new XPRBprob("Coco3"); /* Initialize a new problem in BCL */ /***********************************************************************/ void modCoco3() { XPRBvar[,,] make = new XPRBvar[NP,NF,NT]; XPRBvar[,,] sell = new XPRBvar[NP,NF,NT]; XPRBvar[,,] pstock = new XPRBvar[NP,NF,NT+1]; XPRBvar[,,] buy = new XPRBvar[NR,NF,NT]; XPRBvar[,,] rstock = new XPRBvar[NR,NF,NT+1]; XPRBexpr lobj, lc; int p,f,r,t; /****VARIABLES****/ for(p=0;p