Reading the data

Shows how to read data from a file to fill matrices in the model.

The first part of this application reads data from a file and fills matrices:


      IloEnv env;

      IntMatrix   activityOnAResource(env);
      NumMatrix   duration(env);
      IloNumArray jobDueDate(env);
      IloNumArray jobEarlinessCost(env);
      IloNumArray jobTardinessCost(env);

      f >> activityOnAResource;
      f >> duration;
      f >> jobDueDate;
      f >> jobEarlinessCost;
      f >> jobTardinessCost;

      IloInt nbJob      = jobDueDate.getSize();
      IloInt nbResource = activityOnAResource.getSize();

Each line in the data file corresponds to an array in the matrix and thus represents all the information about activities for a given job.

For each job, other arrays contain further information from the data file:

  • jobDueDate contains the due date for each job;

  • jobEarlinessCost contains the penalty for being too early for each job;

  • jobTardinessCost contains the penalty for being too late for each job.

The matrix activityOnAResource contains the sets of activities that must be scheduled on the same resource. This information will be used to state resource constraints.