/******************************************************** Xpress-BCL Java Example Problems ================================ file xbcoco3.java ````````````````` Coco Problem Phase 3. Introduce time periods and inventory. (c) 2008-2024 Fair Isaac Corporation author: S.Heipcke, Jan. 2000, rev. Mar. 2011 ********************************************************/ import java.io.*; import com.dashoptimization.*; public class xbcoco3 { 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 int NT = 4; /* time periods (t) */ static final String REVFILE = System.getProperty("XPRBDATA") + "/coco/revt.dat"; static final String CMAKEFILE = System.getProperty("XPRBDATA") + "/coco/cmake.dat"; static final String CBUYFILE = System.getProperty("XPRBDATA") + "/coco/cbuyt.dat"; static final String REQFILE = System.getProperty("XPRBDATA") + "/coco/req.dat"; static final String MXSELLFILE = System.getProperty("XPRBDATA") + "/coco/maxsellt.dat"; static final String MXMAKEFILE = System.getProperty("XPRBDATA") + "/coco/mxmake.dat"; static final String PSTOCK0FILE = System.getProperty("XPRBDATA") + "/coco/pstock0.dat"; static final String RSTOCK0FILE = System.getProperty("XPRBDATA") + "/coco/rstock0.dat"; /****TABLES****/ static double[][] REV; /* Unit selling price of product p in period t */ static double[][] CMAK; /* Unit cost to make product p at factory f */ static double[][] CBUY; /* Unit cost to buy raw material r in period t */ static double[][] REQ; /* Requirement by unit of prod. p for raw mat. r */ static double[][] MXSELL; /* Max. amount of p that can be sold in period t */ static double[] MXMAKE; /* Max. amount factory f can make over all prod.s */ static double[][] PSTOCK0; /* Initial product p stock level at factory f */ static double[][] RSTOCK0; /* Initial raw material r stock level at factory f*/ /****DATA****/ static final double CPSTOCK = 2; /* Unit cost to store any product p */ static final double CRSTOCK = 1; /* Unit cost to store any raw mat. r */ static final double MXRSTOCK = 300; /* Max. amount of r that can be stored each f and t */ /***********************************************************************/ static void modCoco3() { XPRBvar[][][] make, sell, pstock, buy, rstock; XPRBexpr lobj, lc; int p,f,r,t; try (XPRBprob pb = new XPRBprob("Coco3")) { /* Initialize BCL and create a new problem */ /****VARIABLES****/ make = new XPRBvar[NP][NF][NT]; sell = new XPRBvar[NP][NF][NT]; pstock = new XPRBvar[NP][NF][NT+1]; buy = new XPRBvar[NR][NF][NT]; rstock = new XPRBvar[NR][NF][NT+1]; for(p=0;p