> Discrete Optimization > Early Tardy Scheduling > Reading the Data

As you see in Code Sample 19.1, the first part of this application reads data from a file and fills two 10x10 matrices:

    IloNumArray jobDueDate(env, nbJob);
    IloNumArray jobEarlinessCost(env, nbJob);
    IloNumArray jobTardinessCost(env, nbJob);

    NumMatrix   duration(env, nbJob);
    for(j = 0; j < nbJob; j++) {
      duration[j] = IloNumArray(env, nbResource);
    for (i = 0; i < nbResource; i++) {
        IloInt resourceIndex;
        f >> resourceIndex;
        f >> duration[j][i];
        activityOnAResource[resourceIndex].add(i);
      }
      f >> jobDueDate[j];
      f >> jobEarlinessCost[j];
      f >> jobTardinessCost[j];
    }

Code Sample 19.1 Reading data for early tardy scheduling

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:

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.

IntMatrix   activityOnAResource(env, nbResource);
    for(i = 0; i < nbResource; i++) {
      activityOnAResource[i] = IloIntArray(env);
    }