/******************************************************** BCL Example Problems ==================== file xbexpl1.c `````````````` BCL user guide example. Definition of variables and constraints, variable arrays and SOS, followed by file output, solving and printing of solutions. (c) 2008-2023 Fair Isaac Corporation author: S.Heipcke, Jan. 2000, rev. Mar. 2011 ********************************************************/ #include #include "xprb.h" /**************************************************************************/ /* Define *one* of the following options to try out different problem */ /* formulations: */ /**************************************************************************/ #define BASIC #undef ARRAYC #undef SOS #undef ARRAY /**************************************************************************/ #define NJ 4 /* Number of jobs */ #define NT 10 /* Time limit */ /**** DATA ****/ double DUR[] = {3,4,2,2}; /* Durations of jobs */ /*{4,2,3,4}; {5,1,1,6}; {5,5,4,4}; */ #ifdef ARRAY XPRBarrvar start; /* Start times of jobs */ XPRBarrvar delta[NJ]; /* Sets of binaries for start times */ #else XPRBvar start[NJ]; /* Start times of jobs */ XPRBvar delta[NJ][NT]; /* Binaries for start times */ #endif XPRBsos set[NJ]; /* Sets regrouping start times for jobs */ XPRBvar z; /* Maximum completion time (makespan) */ XPRBprob prob; /* BCL problem */ void jobs_model(void); /* Basic model formulation */ void jobs_modela(void); /* Model using arrays of variables for some constraints */ void jobs_modelb(void); /* Model using SOS */ void jobs_modelc(void); /* Model using arrays of variables for all variables */ void jobs_solve(void); /* Solving and solution printing */ /*************************************************************************/ void jobs_model(void) { XPRBctr ctr; int j,t; prob=XPRBnewprob("Jobs"); /* Initialization */ /****VARIABLES****/ /* Create start time variables */ for(j=0;j