IBM ILOG Dispatcher User's Manual > Transportation Industry Solutions > Pickup and Delivery by Multiple Vehicles from Multiple Depots > Model > Define the RoutingModel::createNodes function

The createNodes function is defined as in Lesson 7 Pickup and Delivery Problems. You use Concert Technology's csv reader functionality to input node data and node coordinate data from csv files. Here is the complete code for defining the createNodes function:

void RoutingModel::createNodes(const char* nodePath) {
  IloCsvReader nodeReader(_env, nodePath);
  for (IloCsvReader::LineIterator it(nodeReader); it.ok(); ++it) {
    IloCsvLine line = *it;
    const char* name = line.getStringByHeader("name");
    IloNode node(_env,
                 line.getFloatByHeader("x"),
                 line.getFloatByHeader("y"),
                 0, // no Z coordinate here.
                 name);
    node.setKey(name);
  }
  nodeReader.end();
}