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

Now, you declare three dimensions: _time and _length, computed as Euclidean distance, and _weight, used for capacity constraints. Note that Euclidean distance is used here for both time and length, but that other kinds of distance may be used as needed. As the model for each depot will require dimensions to be added, you keep the dimensions together in a model called _dimModel.

Step 9   -  

Add the dimensions

Add the following code after the comment //Add the dimensions

void RoutingModel::createDimensions() {
  _dimModel = IloModel(_env);

  _distance = IloDistance(_env, IloEuclidean);
  _weight = IloDimension1(_env, "weight");
  _dimModel.add(_weight);

  _time = IloDimension2(_env, _distance , "time");
  _dimModel.add(_time);

  _length = IloDimension2(_env, _distance , "distance");
  _dimModel.add(_length);

  _mdl.add(_dimModel);
}