/******************************************************** Xpress-BCL C# Example Problems ============================== file xbcontr1.cs ```````````````` Contract allocation example. Combining BCL problem input with problem solving in Xpress-Optimizer. (c) 2008-2023 Fair Isaac Corporation authors: S.Heipcke, D.Brett. ********************************************************/ using System; using System.Text; using System.IO; using Optimizer; using BCL; namespace Examples { public class TestUGContr1 { const int District = 6; /* Number of districts */ const int 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 */ /*********************************************************************/ public static void Main() { XPRB.init(); int d,c; XPRBexpr l1,l2,lobj; /* Variables indicating whether a project is chosen */ XPRBvar[,] x = new XPRBvar[District,Contract]; /* Quantities allocated to contractors */ XPRBvar[,] y = new XPRBvar[District,Contract]; int i, ncol, len, stat; double[] sol; double val; /* Initialize a new problem in BCL */ XPRBprob p = new XPRBprob("Contr1"); XPRSprob xprsp; TestUGContr1 TestInstance = new TestUGContr1(); /**** VARIABLES ****/ for(d=0;d= TestInstance.VOLUME[c]); /* "Min": at least 2 districts per contract */ p.newCtr("Min", l2 >= 2 ); } /* Do not exceed max. output of any district */ for(d=0;d