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

Now, you create the function that searches for the first solution. This function is the same as the one you created in Solving a Vehicle Routing Problem. You search for a solution using _generalGoal and store the solution and its cost using the member function IloRoutingSolution::store. This code is provided for you:

IloBool RoutingSolver::findFirstSolution() {
  if (!_solver.solve(_generalGoal)) {
    _solver.error() << "Infeasible Routing Plan" << endl;
    return IloFalse;
  }
  _solution.store(_solver);
  return IloTrue;
}