/********************************************************/ /* Xpress-BCL C# Example Problems */ /* ============================== */ /* */ /* file xbburg.cs */ /* `````````````` */ /* Example for the use of Xpress-BCL */ /* (Burglar problem from the XPRESS-MP Tutorial, */ /* binary variable formulation) */ /* */ /* (c) 2008-2024 Fair Isaac Corporation */ /* authors: S.Heipcke, D.Brett. */ /********************************************************/ using System; using System.Text; using System.IO; using BCL; namespace Examples { public class TestBurglar { public const int NItems = 8; /* Number of items */ /****DATA****/ /* Item: 1 2 3 4 5 6 7 8 */ double[] VALUE = {15,100, 90, 60, 40, 15, 10, 1}; /* Value of items */ double[] WEIGHT = { 2, 20, 20, 30, 40, 30, 60, 10}; /* Weight of items */ double WTMAX = 102; /* Max weight allowed for haul */ public static void Main() { XPRB.init(); XPRBvar[] x = new XPRBvar[NItems]; XPRBexpr lobj, kn; int i; XPRBprob p = new XPRBprob("Burglar"); /* Initialize a new problem in BCL */ TestBurglar TestInstance = new TestBurglar(); /****VARIABLES****/ /* 1 if we take item i; 0 otherwise */ for(i=0;i