/******************************************************** Xpress-BCL Java Example Problems ================================ file xbcoco2.java ````````````````` 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 author: S.Heipcke, Jan. 2000, rev. Mar. 2011 ********************************************************/ import java.io.*; import com.dashoptimization.*; public class xbcoco2 { static final int NP = 2; /* Number of products (p) */ static final int NF = 2; /* factories (f) */ static final int NR = 2; /* raw materials (r) */ static final String REVFILE = System.getProperty("XPRBDATA") + "/coco/rev.dat"; static final String CMAKEFILE = System.getProperty("XPRBDATA") + "/coco/cmake.dat"; static final String CBUYFILE = System.getProperty("XPRBDATA") + "/coco/cbuy.dat"; static final String REQFILE = System.getProperty("XPRBDATA") + "/coco/req.dat"; static final String MXSELLFILE= System.getProperty("XPRBDATA") + "/coco/maxsell.dat"; static final String MXMAKEFILE= System.getProperty("XPRBDATA") + "/coco/mxmake.dat"; /****TABLES****/ static double[] REV; /* Unit selling price of product p */ static double[][] CMAK; /* Unit cost to make product p at factory f */ static double[] CBUY; /* Unit cost to buy raw material r */ static double[][] REQ; /* Requirement by unit of prod. p for raw mat. r */ static double[] MXSELL; /* Max. amount of p that can be sold */ static double[] MXMAKE; /* Max. amount factory f can make over all prod.s */ static double[][] PROFIT; /* Profit contribution of product p at factory f */ /***********************************************************************/ static void modCoco2() { XPRBvar[][] make; XPRBexpr lobj, lc; int p,f; try (XPRBprob pb = new XPRBprob("Coco2")) { /* Initialize BCL and create a new problem */ /****VARIABLES****/ make = new XPRBvar[NP][NF]; for(p=0;p