IBM ILOG Scheduler User's Manual > Integrated Applications > Representing Time-Varying Resource Capacity > Solving the Problem

We use the predefined Solver function, IloGenerate, to generate a solution to the problem.

    /* FILL AN ARRAY WITH THE VARIABLES REPRESENTING THE START TIMES
       OF THE ACTIVITIES. */
    IloNumVarArray startTimes(env, NumberOfActivities, 0, IloInfinity, ILOINT);
    IloInt i = 0;
    for (IloIterator<IloActivity> iterator(env);
         iterator.ok();
         ++iterator) {
      IloActivity activity = *iterator;
      model.add(startTimes[i] == activity.getStartExpr());
      i++;
    }
    /* DEFINE A GOAL THAT GENERATE A SOLUTION TO THE PROBLEM. */
    IloGoal goal = IloGenerate(env, startTimes, IlcChooseMinMinInt);