/******************************************************** Xpress-BCL C++ Example Problems =============================== file xbcontr1.cxx ````````````````` Contract allocation example. Combining BCL problem input with problem solving in Xpress-Optimizer. (c) 2008-2024 Fair Isaac Corporation author: S.Heipcke, Jan. 2000, rev. Oct. 2010 ********************************************************/ #include #include #include "xprb_cpp.h" #include "xprs.h" using namespace std; using namespace ::dashoptimization; #define District 6 /* Number of districts */ #define Contract 10 /* Number of contracts */ /**** DATA ****/ int OUTPUT[] = {50, 40, 10, 20, 70, 50}; /* Max. output per district */ int COST[] = {50, 20, 25, 30, 45, 40}; /* Cost per district */ int VOLUME[] = {20, 10, 30, 15, 20, 30, 10, 50, 10, 20}; /* Volume of contracts */ /***********************************************************************/ int main(int argc, char **argv) { int d,c; XPRBexpr l1,l2,lobj; XPRBvar x[District][Contract]; /* Variables indicating whether a project is chosen */ XPRBvar y[District][Contract]; /* Quantities allocated to contractors */ int i, ncol, len, stat, offset; double *sol, val; char *names; XPRSprob op; XPRBprob p("Contr1"); /* Initialize a new problem in BCL */ /**** VARIABLES ****/ for(d=0;d= VOLUME[c]); /* "Size": cover the required volume */ p.newCtr("Min", l2 >= 2 ); /* "Min": at least 2 districts per contract */ } for(d=0;d