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

The createIloNodes function is defined as in Minimizing the Number of Vehicles. You use IBM® ILOG® Concert Technology's csv functionality to input node data and node coordinate data from csv files. You use the member function IloDispatcherGraph::associatebyCoordsInFile to look up the coordinates of a given IloNode in a csv file and automatically associate it to the graph node with matching coordinates. Here is the complete code for defining the createIloNodes function:

void RoutingModel::createIloNodes(const char * nodeFileName,
                                  const char* coordFileName) {
  IloCsvReader csvNodeReader(_env, nodeFileName);
  IloCsvReader::LineIterator  it(csvNodeReader);
  while(it.ok()) {
    IloCsvLine line = *it;
    char * name = line.getStringByHeader("name");
    IloNode node(_env, line.getFloatByHeader("x"),
        line.getFloatByHeader("y"), 0, name);
    node.setKey(name);
    _graph.associateByCoordsInFile (node, coordFileName);
    ++it;
  }
  csvNodeReader.end();
}