IBM ILOG Scheduler User's Manual > Integrated Applications > Handling an Overconstrained Problem: Adding Due Dates to the Bridge Problem > Defining the Problem

The array DueDates gives a targeted due date for all activities in the problem.

IloInt DueDates [] ={  8, 5, 12, 12, 18, 24,   // A1 -> A6
                       35, 17,                 // P1 -> P2
                       18, 10, 38, 23, 26, 37, // S1 -> S6
                       19, 11, 43, 20, 28, 38, // B1 -> B6
                       20, 13, 43, 26, 28, 39, // AB1 -> AB6
                       33, 22, 60, 53, 44, 80, // M1 -> M6
                       49, 105, 77, 65, 93,    // T1 -> T5
                       60, 102,                // V1 -> V2
                       32,                     // L
                       12,                     // UE
                       105,                    // UA
                       110};                   // PE 
 
const IloInt NumberOfActivities = 43;
 

This array is used to express that we want activity A1 to be finished eight days after the beginning of the project, activity A2 five days after the beginning of the project, and so on. These due date constraints are added with the Concert Technology member function IloNumVar::setUb. The function DefineModel includes parameters for the activities and due dates.

The array activities contains all the activities of the problem such that, for each element activities[i] of this array, its associated targeted due date is equal to dueDates[i].

Note that the Concert Technology member function setObject is used to associate each activity with its due date constraint. By doing that, we can retrieve easily, outside the function DefineModel, the due date constraint of each activity.

IloModel
DefineModel(IloEnv env, 
            IloInt* dueDates,
            IloNumVar& makespan,
            IloInt numberOfActivities) {
  /* ... */

  /* DUE DATES */
  IloInt i;
  for (i = 0 ; i < numberOfActivities ; i++) {
    activities[i].setEndMax(dueDates[i]);
    activities[i].setObject(&(dueDates[i]));
  }
  /* ... */
}