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

We choose a slightly more sophisticated way to remove targeted due dates. First, we search for the minimal due dates of each activity if we had no capacity constraints. By definition, a minimal due date is the minimal end time of an activity. If a targeted due date is less than its minimal due date, we know for certain that the targeted due date cannot be satisfied.

It seems intuitive that a targeted due date should be easier to satisfy if it is far from its minimal due date. Conversely, it also seems intuitive that if a targeted due date is near its minimal due date, it should be more difficult to satisfy.

We temporarily remove the capacity constraints to find the minimal due dates, search for a solution, and then store each minimal due date with the Concert Technology function setLb.

    /* SECOND TRY: RELAXED CAPACITIES */
 
    IloSchedulerEnv schedEnv(env);
    IloResourceParam resParam = schedEnv.getResourceParam();
    resParam.ignoreCapacityConstraints(IloTrue);
 
    solver.out() << endl << "----------------------------------------" << endl;
    solver.out() << "Second try: relaxed capacities" << endl;
 
    if (solver.solve(goal)) {
      solver.out() << "current value of makespan: " << solver.getMin(makespan) 
                   << endl;
      solver.out() << "Overlapping activities: " << endl;
      PrintOverlappingActivities(solver);
      for(IloIterator<IloActivity> iter(env); iter.ok(); ++iter) {
        IloActivity act = *iter;
        act.setEndMin(scheduler.getActivity(act).getEndMin());
      }
    }
    else 
      solver.out() << "No solution! " << endl;
 

In addition, the function PrintOverlappingActivities is called to display the activities which overlap.

void
PrintOverlappingActivities(const IloSolver& solver) 
{
  IlcScheduler scheduler(solver);
  for (IlcResourceIterator resIter(scheduler); resIter.ok() ; ++resIter) {
    for (IlcResourceConstraintIterator RCiter(*resIter);
         RCiter.ok();
         ++RCiter) {
      IlcActivity act = RCiter.getActivity();
      for (IlcResourceConstraintIterator RCiter2(*resIter);
           RCiter2.ok();
           ++RCiter2) {
        IlcActivity act2 = RCiter2.getActivity();
        if (act == act2)
          break;
        IlcInt endMin1 = act.getEndMin();
        IlcInt startMax1 = act.getStartMax();
        if (endMin1 > startMax1) {
          IlcInt endMin2 = act2.getEndMin();
          IlcInt startMax2 = act2.getStartMax();
          if (endMin2 > startMax2)
            if ((startMax1 < endMin2) && (startMax2 < endMin1))
              solver.out() << act << " and " << act2 << " overlap " << endl;
        }
      }
    }
  }
}
 

Displaying the overlapping activities is done here only for information but one could define a repair policy from the set of these overlapping activities.