/******************************************************** Xpress-BCL C# Example Problems ============================== file xbcoco2.cs ```````````````` Coco Problem Phase 2. Use parameters, data tables and subscripted variables to separate the model structure from the data. Read data tables in from text data files. (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 TestCoco1 { const int NP = 2; /* Number of products (p) */ const int NF = 2; /* factories (f) */ const int NR = 2; /* raw materials (r) */ //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 REVFILE = XPRBDATAPATH + "/coco/rev.dat"; static string CMAKEFILE = XPRBDATAPATH + "/coco/cmake.dat"; static string CBUYFILE = XPRBDATAPATH + "/coco/cbuy.dat"; static string REQFILE = XPRBDATAPATH + "/coco/req.dat"; static string MXSELLFILE = XPRBDATAPATH + "/coco/maxsell.dat"; static string MXMAKEFILE = XPRBDATAPATH + "/coco/mxmake.dat"; /****TABLES****/ double[] REV = new double[NP]; /* Unit selling price of product p */ double[,] CMAK = new double[NP,NF]; /* Unit cost to make product p at factory f */ double[] CBUY = new double[NR]; /* Unit cost to buy raw material r */ double[,] REQ = new double[NP,NR]; /* Requirement by unit of prod. p for raw material r */ double[] MXSELL = new double[NP]; /* Max. amount of p that can be sold */ double[] MXMAKE = new double[NF]; /* Max. amount factory f can make over all products */ double[,] PROFIT = new double[NP,NF]; /* Profit contribution of product p at factory f */ XPRBprob pb = new XPRBprob("Coco2"); /* Initialize a new problem in BCL */ /***********************************************************************/ void modCoco2() { XPRBvar[,] make = new XPRBvar[NP,NF]; XPRBexpr lobj, lc; int p,f; /****VARIABLES****/ for(p=0;p