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

To create a new visit in the model, you create an instance of IloNode corresponding to the customer location. You use the member function IloDispatcherGraph::associateByCoordsInFile to look up the coordinates of this IloNode in a csv file and automatically associate it to the graph node with matching coordinates. You then create an instance of IloVisit located at the customer node. This visit has a delay time of 10 units, a quantity of 12 units, and a time window. You use the member function IloModel::add(IloVisit) to add the visit from the model.

Step 7   -  

Create an additional visit

Add the following code after the comment //Create an additional visit

IloVisit RoutingModel::createAdditionalVisits (int argc, char * argv[]) {
  char * nodeCoordsFile;
  if(argc < 5)  nodeCoordsFile =
      (char*) "../../../examples/data/dispatcherGraphData/coordTable.csv";
  else          nodeCoordsFile = argv[4];
  IloNode customer(_env, 43, 63);
  _graph.associateByCoordsInFile (customer, nodeCoordsFile);
  IloVisit visit(customer, "Extra visit");
  _mdl.add(visit.getDelayVar(_time) == 10);
  _mdl.add(visit.getTransitVar(_weight) == 12);
  _mdl.add(70 <= visit.getCumulVar(_time) <= 120);
  _mdl.add(visit);
  return visit;
}