/******************************************************** Xpress-BCL C++ Example Problems =============================== file xbcoco2.cxx ````````````````` 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 author: S.Heipcke, Jan. 2000, rev. Mar. 2011 ********************************************************/ #include #include #include "xprb_cpp.h" using namespace std; using namespace ::dashoptimization; #define NP 2 /* Number of products (p) */ #define NF 2 /* factories (f) */ #define NR 2 /* raw materials (r) */ #define REVFILE XPRBDATAPATH "/coco/rev.dat" #define CMAKEFILE XPRBDATAPATH "/coco/cmake.dat" #define CBUYFILE XPRBDATAPATH "/coco/cbuy.dat" #define REQFILE XPRBDATAPATH "/coco/req.dat" #define MXSELLFILE XPRBDATAPATH "/coco/maxsell.dat" #define MXMAKEFILE XPRBDATAPATH "/coco/mxmake.dat" /****TABLES****/ double REV[NP]; /* Unit selling price of product p */ double CMAK[NP][NF]; /* Unit cost to make product p at factory f */ double CBUY[NR]; /* Unit cost to buy raw material r */ double REQ[NP][NR]; /* Requirement by unit of prod. p for raw material r */ double MXSELL[NP]; /* Max. amount of p that can be sold */ double MXMAKE[NF]; /* Max. amount factory f can make over all products */ double PROFIT[NP][NF]; /* Profit contribution of product p at factory f */ /***********************************************************************/ void modCoco2(XPRBprob &pb) { XPRBvar make[NP][NF]; XPRBexpr lobj, lc; int p,f; /****VARIABLES****/ for(p=0;p