/******************************************************** 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 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 point where you wish: const string XPRBDATAPATH = "../../data"; const string REVFILE = XPRBDATAPATH + "/coco/rev.dat"; const string CMAKEFILE = XPRBDATAPATH + "/coco/cmake.dat"; const string CBUYFILE = XPRBDATAPATH + "/coco/cbuy.dat"; const string REQFILE = XPRBDATAPATH + "/coco/req.dat"; const string MXSELLFILE = XPRBDATAPATH + "/coco/maxsell.dat"; const 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