IBM ILOG Dispatcher User's Manual > Transportation Industry Solutions > Pickup and Delivery by Multiple Vehicles from Multiple Depots > Model > Define the RoutingModel::createVisits function |
Define the RoutingModel::createVisits function |
INDEX
![]() |
You use csv reader functionality to input visits from csv files. You then create a node for each pickup and delivery visit. This code is provided for you:
You next create the submodel for each pickup and delivery visit.
Step 11 - | Create visit models |
Add the following code after the comment //Create visit models
IloModel pickupModel(_env); IloModel deliveryModel(_env); |
You create a pickup visit and add the constraints. Each visit takes a certain amount of time (pickupTime
) and involves the delivery of a certain quantity
of good. It must be performed within a given time window. The visit is added to the submodel pickupModel
.
Step 12 - | Create pickup |
Add the following code after the comment //Create pickup
You follow the same procedure to create the delivery
visit, add constraints, and add the delivery visit to the submodel deliveryModel
.
Step 13 - | Create delivery |
Add the following code after the comment //Create delivery
Finally, you add the pickup and delivery order constraint to the pickupModel
. A reference to the deliveryModel
is placed via delivery.setObject
. This means that the submodel for a delivery can be retrieved from the delivery at any time. Finally, each pickupModel
and deliveryModel
are added to the model of the whole problem _mdl
.
Step 14 - | Order the pickup and delivery |
Add the following code after the comment //Order the pickup and delivery
pickupModel.add( IloOrderedVisitPair(_env, pickup, delivery) );
delivery.setObject( (IloAny)deliveryModel.getImpl() );
_mdl.add( pickupModel );
_mdl.add( deliveryModel );
++it;
}
orderReader.end();
}
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |