IBM ILOG Dispatcher User's Manual > Transportation Industry Solutions > Pickup and Delivery by Multiple Vehicles from Multiple Depots > Model > Declare the RoutingModel class

As in Chapter 7, Pickup and Delivery Problems, you create a RoutingModel class, which is used to model the problem. There are several important differences between the RoutingModel class used in a standard PDP and the RoutingModel class used in this problem. There is a model for the whole problem _mdl and a model for the dimensions _dimModel. Instead of a createVehicles function, you have a createDepots function. The createDepots function will call the Depot class constructor and create the submodel for each depot. The createVisits function creates small submodels for each pickup and delivery visit. The RoutingModel class uses Concert Technology's ability to maintain nested submodels to maintain the coherence of the model for the whole problem and the submodels for each depot, the submodels for each pickup and delivery visit, and the submodel for dimensions. The code for the declaration of the class RoutingModel is provided for you:

class RoutingModel {
  IloEnv              _env;
  IloModel            _mdl;
  IloModel            _dimModel;
  IloDistance         _distance;
  IloDimension2       _time;
  IloDimension2       _length;
  IloDimension1       _weight;
  const char* _depotPath; //  "../../../examples/data/mdvrp/depots.csv";
  const char* _visitPath; //  "../../../examples/data/mdvrp/vrp100.csv";
  const char* _nodePath;  //  "../../../examples/data/mdvrp/node100.csv";

  IloInt _nbOfDepots;
  Depot** _depots;
protected:
  void createDimensions();
  void createNodes (const char* nodePath);
  void createDepots(const char* depotPath);
  void createVisits(const char* orderPath);
public:
  RoutingModel(IloEnv env);
  ~RoutingModel() {}

  IloEnv    getEnv() const { return _env; }
  IloModel  getModel() const { return _mdl; }
  IloInt getNumberOfDepots() const { return _nbOfDepots;}
  Depot* getDepot(IloInt d) const {
    assert( d >= 0 );
    assert( d < _nbOfDepots);
    return _depots[d];
  }
  void parse(int argc, char** argv);
  void init();
  void createModel();

};