IBM ILOG Dispatcher User's Manual > Transportation Industry Solutions > Docking Bays: Modeling External Resources > Solve

The solution is largely computed, improved, and displayed by methods previously presented for the PDP problem, but with two additions. A small section of code is added to iterate through the Scheduler activity, and a Scheduler subgoal is added to instantiate the starting times of the visits.

Step 7   -  

Add the activity iteration

Add the following code after the comment //Add the activity iteration.

  IlcScheduler sched(_solver);
  for (IlcActivityIterator iter(sched); iter.ok(); ++iter) {
    _solver.out() << *iter << endl;

This section of the function RoutingSolver::printInformation iterates through the activity schedule to retrieve solution information for display.

Step 8   -  

Add the subgoals

Add the following code after the comment //Add the subgoals.

  IloGoal instantiateCost = IloDichotomize(env,
                                           dispatcher.getCostVar(),
                                           IloFalse);
  IloGoal schedGoal = IloSetTimesForward(env);
  IloGoal subGoal = schedGoal && instantiateCost;
  IloGoal restoreSolution = IloRestoreSolution(env, _solution) && subGoal;
  IloGoal goal = IloSavingsGenerate(env, schedGoal) && instantiateCost;

The predefined Scheduler subgoal IloSetTimesForward instantiates the activity variables, which via propagation, in turn instantiates the time variables of the visits. It is necessary to do this to make certain that the current solution is feasible.

Step 9   -  

Compile and run the program

The solution improvement phase finds a solution using 6 vehicles with a cost of 1432.17 units:

  1641.01
Improving solution
Number of fails               : 0
Number of choice points       : 1068
Number of variables           : 2215
Number of constraints         : 564
Reversible stack (bytes)      : 385944
Solver heap (bytes)           : 1041460
Solver global heap (bytes)    : 184996
And stack (bytes)             : 20124
Or stack (bytes)              : 44244
Search Stack (bytes)          : 4044
Constraint queue (bytes)      : 9148
Total memory used (bytes)     : 1689960
Running time since creation   : 0.023437
Number of nodes               : 51
Number of visits              : 70
Number of vehicles            : 15
Number of dimensions          : 3
Number of accepted moves      : 11
===============
Cost         : 1432.17
Number of vehicles used : 6