/******************************************************** Xpress-BCL Java Example Problems ================================ file xbcutex.java ````````````````` Simplified version of xbexpl1.java showing how to define cuts with BCL. (c) 2008 Fair Isaac Corporation author: S.Heipcke, 2005, rev. Dec. 2011 ********************************************************/ import java.io.*; import com.dashoptimization.*; public class xbcutex { static final int NJ = 4; /* Number of jobs */ static final int NT = 10; /* Time limit */ /**** DATA ****/ static final double[] DUR = {3,4,2,2}; /* Durations of jobs */ static XPRBvar[] start; /* Start times of jobs */ static XPRBvar[][] delta; /* Binaries for start times */ static XPRBvar z; /* Maximum completion time (makespan) */ /*************************************************************************/ static class CutMgrCallback implements XPRScutMgrListener { public int XPRScutMgrEvent(XPRSprob oprob, Object data) { XPRBprob bprob; XPRBcut[] ca; int num,i; bprob = (XPRBprob)data; /* Get the BCL problem */ try { bprob.beginCB(oprob); num = oprob.getIntAttrib(XPRS.NODES); if(num == 2) { /* Only generate cuts at node 2 */ ca = new XPRBcut[2]; ca[0] = bprob.newCut(start[1].add(2) .lEql(start[0]), 2); ca[1] = bprob.newCut(start[2].mul(4) .add(start[3].mul(-5,3)) .lEql(-17), 2); System.out.println("Adding constraints:"); for(i=0;i<2;i++) ca[i].print(); bprob.addCuts(ca); } bprob.endCB(); } catch(XPRSprobException e) { System.out.println("Error " + e.getCode() + ": " + e.getMessage()); } return 0; /* Call this method once per node */ } } /*************************************************************************/ static void jobsModel(XPRBprob p) { XPRBexpr le; int j,t; /****VARIABLES****/ start = new XPRBvar[NJ]; /* Create start time variables */ for(j=0;j