IBM ILOG Dispatcher User's Manual > Transportation Industry Solutions > Pickup and Delivery by Multiple Vehicles from Multiple Depots > Solve > Define the RoutingSolver::improvePlan function

After the routing for all depots has been improved independently, the routing for the problem as a whole is improved. After resetting the neighborhood and greedy metaheuristic, an improvement loop is entered to improve the cost of all depots using the goal _move. If there was some improvement, then you go back to an independent improvement of each depot. Otherwise, you leave the main improvement loop.

Step 17   -  

Improve the routing plan

Add the following code after the comment //Improve the routing plan

IloBool RoutingSolver::improvePlan() {
  _solver.out() << "Optimizing plan "
                << _solution.getSolution().getObjectiveValue()
                << flush;
  _nhood.reset();
  _greedy.reset();
  IloInt nbImproved = 0;
  while ( _solver.solve(_move) ) { ++nbImproved;}
  _solver.out() << " ---> "
               << _solution.getSolution().getObjectiveValue() << endl;
  return ( nbImproved > 0 );
}