IBM ILOG Dispatcher User's Manual > The Basics > Adding Visit Disjunctions > Solve > Define the removeVisitAndResolve function

To remove that same new visit from the solution, you use the function removeVisitAndResolve. This function uses IloRoutingSolution::remove to directly remove the new visit to the solution. You then restore the solution.

Step 11   -  

Remove the visit and resolve

Add the following code after the comment //Remove the visit and resolve

IloBool RoutingSolver::removeVisitAndResolve (IloVisit visit) {
  _solution.remove(visit);
  if (_solver.solve(_restoreSolution))
      return IloTrue;
  else return IloFalse;
}