IBM ILOG Dispatcher User's Manual > The Basics > Minimizing the Number of Vehicles > Model > Declare the RoutingModel class

The code for the declaration of the class RoutingModel is provided for you:

class RoutingModel {
  IloEnv              _env;
  IloModel            _mdl;
  IloDispatcherGraph  _graph;
  IloDimension2       _time;
  IloDimension1       _weight;

  void addDimensions();
  void loadGraphInformation (char* arcFileName, char* turnFileName);
  void lastMinuteGraphChanges ();
  void createIloNodes(char* nodeFileName, char* coordFileName);
  void createVehicles(char* vehicleFileName);
  void createVisits(char* visitsFileName);

public:
  RoutingModel(IloEnv env, int argc, char* argv[]);
  ~RoutingModel() {}
  IloEnv    getEnv() const { return _env; }
  IloModel  getModel() const { return _mdl; }
};

There are only a few differences between the RoutingModel class used in a standard VRP and the RoutingModel class used in this problem.

The dimensions in this problem are time and weight. Unlike in Chapter 2, Modeling a Vehicle Routing Problem, distance is not a dimension. In this example, only the dimensions representing time and weight are required to set side constraints and to compute the cost. However, you could add a distance dimension if you wanted to include this dimension in the model.

The graph, an instance of the class IloDispatcherGraph, allows you create a graph representing a road network topology on which instances of IloNode can be positioned. This graph is composed of graph nodes--which are different from IloNodes--and arcs connecting these graph nodes. The cost in time and distance for traversing an arc is loaded from a file, as well as any penalties associated with making turns. See "Define the RoutingModel constructor".

IloDispatcherGraph computes the shortest paths between nodes for each vehicle. It is this shortest path that is used to create the dimension _time in this problem. See "Define the addDimensions function".

You must associate the graph nodes with instances of IloNode that represent depot and visit locations. See "Define the createIloNodes function".

The class RoutingModel introduces two member functions related to IloDispatcherGraph functionality: loadGraphInformation and lastMinuteGraphChanges. See "Define the loadGraphInformation function" and "Define the lastMinuteGraphChanges function".