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

The constructor is defined as in Minimizing the Number of Vehicles. If you do not specify input files, the defaults will be used. This constructor will be called from the main function. It calls the following functions: addDimensions, loadGraphInformation, createIloNodes, createVehicles, and createVisits.

The following code is provided for you:

RoutingModel::RoutingModel( IloEnv env,
                              int argc,
                              char* argv[]):
    _env(env), _mdl(env), _graph(env) {
    addDimensions();

    // Load dispatcher graph information and add instance-specific features.
    char * arcFileName;
    if(argc < 2)  arcFileName =
        (char*) "../../../examples/data/dispatcherGraphData/gridNetwork.csv";
    else          arcFileName = argv[1];
    char * turnFileName;
    if(argc < 3)  turnFileName =
        (char*) "../../../examples/data/dispatcherGraphData/turnData.csv";
    else          turnFileName = argv[2];
    loadGraphInformation (arcFileName, turnFileName);

    //create IloNodes and associate them to graph nodes
    char * nodeFileName;
    if(argc < 4)  nodeFileName =
        (char*) "../../../examples/data/vrp50/vrp50nodes.csv";
    else          nodeFileName = argv[3];
    char * nodeCoordsFile;
    if(argc < 5)  nodeCoordsFile =
        (char*) "../../../examples/data/dispatcherGraphData/coordTable.csv";
    else          nodeCoordsFile = argv[4];
    createIloNodes(nodeFileName, nodeCoordsFile);

    //create vehicles
    char * vehiclesFileName;
    if(argc < 6)  vehiclesFileName =
        (char*) "../../../examples/data/vrp50/vrp50vehicles.csv";
    else          vehiclesFileName = argv[5];
    createVehicles(vehiclesFileName);

    //create visits
    char * visitsFileName;
    if(argc < 7)  visitsFileName =
        (char*) "../../../examples/data/vrp50/vrp50visits.csv";
    else          visitsFileName = argv[6];
    createVisits(visitsFileName);
}