/******************************************************** BCL Example Problems ==================== file xbcoco3.c `````````````` Coco Problem Phase 3. Introduce time periods and inventory. (c) 2008-2023 Fair Isaac Corporation author: S.Heipcke, Jan. 2000, rev. Mar. 2011 ********************************************************/ #include #include "xprb.h" #define NP 2 /* Number of products (p) */ #define NF 2 /* Factories (f) */ #define NR 2 /* Raw materials (r) */ #define NT 4 /* Time periods (t) */ #define REVFILE XPRBDATAPATH "/coco/revt.dat" #define CMAKEFILE XPRBDATAPATH "/coco/cmake.dat" #define CBUYFILE XPRBDATAPATH "/coco/cbuyt.dat" #define REQFILE XPRBDATAPATH "/coco/req.dat" #define MXSELLFILE XPRBDATAPATH "/coco/maxsellt.dat" #define MXMAKEFILE XPRBDATAPATH "/coco/mxmake.dat" #define PSTOCK0FILE XPRBDATAPATH "/coco/pstock0.dat" #define RSTOCK0FILE XPRBDATAPATH "/coco/rstock0.dat" /****TABLES****/ double REV[NP][NT]; /* Unit selling price of product p in period t */ double CMAK[NP][NF]; /* Unit cost to make product p at factory f */ double CBUY[NR][NT]; /* Unit cost to buy raw material r in period t */ double REQ[NP][NR]; /* Requirement by unit of prod. p for raw material r */ double MXSELL[NP][NT]; /* Max. amount of p that can be sold in period t */ double MXMAKE[NF]; /* Max. amount factory f can make over all products */ double PSTOCK0[NP][NF]; /* Initial product p stock level at factory f */ double RSTOCK0[NR][NF]; /* Initial raw material r stock level at factory f*/ /****DATA****/ double CPSTOCK = 2; /* Unit cost to store any product p */ double CRSTOCK = 1; /* Unit cost to store any raw material r */ double MXRSTOCK = 300; /* Max. amount of r that can be stored each f and t */ /***********************************************************************/ void modcoco3(XPRBprob prob) { XPRBvar make[NP][NF][NT], sell[NP][NF][NT], pstock[NP][NF][NT+1], buy[NR][NF][NT], rstock[NR][NF][NT+1]; XPRBctr ctr; int p,f,r,t; /****VARIABLES****/ for(p=0;p