/******************************************************** BCL Example Problems ==================== file xbcutex.c `````````````` Simplified version of xbexpl1.c showing how to define cuts with BCL. (c) 2008-2023 Fair Isaac Corporation author: S.Heipcke, 2000, rev. Mar. 2011 ********************************************************/ #include #include "xprb.h" #include "xprs.h" #define NJ 4 /* Number of jobs */ #define NT 10 /* Time limit */ /**** DATA ****/ double D[] = {3,4,2,2}; /* Durations of jobs */ XPRBvar start[NJ]; /* Start times of jobs */ XPRBvar delta[NJ][NT]; /* Binaries for start times */ XPRBvar z; /* Maximum completion time (makespan) */ /***********************************************************************/ int XPRS_CC usrcme(XPRSprob oprob, void* vd) { XPRBcut ca[2]; int num; int i=0; XPRBprob bprob; /* In terms of an example, we add a few additional constraints (without any relation to the original problem) at the second node of the MIP search tree. These constraints/cuts are applied at this node and all its child nodes. */ bprob = (XPRBprob)vd; XPRBbegincb(bprob, oprob); XPRSgetintattrib(oprob, XPRS_NODES, &num); if(num == 2) { /* ca0: s_1+2 <= s_0 */ ca[0] = XPRBnewcutprec(bprob, start[1], 2, start[0], 2); ca[1] = XPRBnewcut(bprob, XPRB_L, 2); /* ca1: 4*s_2 - 5,3*s_3 <= -17 */ XPRBaddcutterm(ca[1], start[2], 4); XPRBaddcutterm(ca[1], start[3], -5,3); XPRBaddcutterm(ca[1], NULL, -17); printf("Adding constraints:\n"); for(i=0;i<2;i++) XPRBprintcut(ca[i]); if(XPRBaddcuts(bprob, ca, 2)) printf("Problem with adding cuts.\n"); } XPRBendcb(bprob); return 0; } /*************************************************************************/ void cmodel1(XPRBprob prob) { XPRBctr ctr; int j,t; /****VARIABLES****/ /* Create start time variables */ for(j=0;j