IBM ILOG Dispatcher User's Manual > The Basics > IBM ILOG Dispatcher Concepts > Solve > Displaying the solution

Each vehicle is associated with a route. For each vehicle, the route it serves is identified by the first visit and last visit. More formally, a route is a set of visits that are served by one vehicle.

The route of a given vehicle is accessible through an iterator, an instance of the class IloDispatcher::RouteIterator for iterating on the route depicted by the state of the extracted variables or IloRoutingSolution::RouteIterator for iterating on the route saved in a solution. Both iterators are initialized with a vehicle. RouteIterator::operator++ moves from one visit in the route to the next visit, while RouteIterator::operator* returns the current visit pointed to by the iterator. The following code shows how to use such iterators to display the route associated with a vehicle.

IloSolver solver(mdl);
IloDispatcher dispatcher(solver);
for(IloDispatcher::RouteIterator ri(dispatcher, vehicle); ri.ok(); ++ri) {
  IloVisit visit = *ri;
  solver.out() << visit.getName() << " ";
}
solver.out() << endl;