| IBM ILOG Dispatcher User's Manual > Transportation Industry Solutions > Adding Vehicle Breaks > Model |
Model |
INDEX
PREVIOUS
NEXT
|
Once you have written a description of your problem, you can use Dispatcher classes to model it.
Step 2 - | Open the example file |
Open the example file YourDispatcherHome/examples/src/tutorial/breaks_partial.cpp in your development environment.
As in the previous examples, you will use a RoutingModel class to call the functions that create the dimensions, nodes, vehicles, and visits. In this example, the RoutingModel class also calls functions that create and constrain the breaks.
Step 3 - | Declare the RoutingModel class |
Add the following code after the comment //Declare the RoutingModel class
Two new functions appear in RoutingModel to model breaks: createVehicleBreaks and createBreaksRelation.
The function createVehicles is very similar to previous examples, but introduces a new member function.
Step 4 - | Create the vehicles |
Add the following code after the comment //Create the vehicles.
The member function IloVehicle::setSpeed sets the speed of vehicle over the dimension time to be 30.0.
Next, you will create the vehicle breaks.
Step 5 - | Create the vehicle breaks |
Add the following code after the comment //Create the vehicle breaks.
This section of code iterates over all vehicle breaks, regardless of the break name (coffee, lunch, and so on), and adds them to the model. startLB, startUB, durationLB, and durationUB refer to the lower and upper bounds on the start and duration of each break. The various break starts and durations (with their associated bounds) are calculated over the 24 hours of the delivery days, and the resulting vehicle break constraint is then applied to vehicle with the constructor IloVehicleBreakCon.
The following code is the first section of RoutingModel::createVehicleBreaks, and is provided for you. This shows how the data is read and identified from the vehicle breaks input file.
Step 6 - | Create the break constraints |
Add the following code after the comment //Create the break constraints
This code is a section of the function RoutingModel::createBreaksRelation. break1, break2, totalDuration, and constraint are read in from the breaks relation input file. break1 and break2 are added together, and the totalDuration is constrained to be equal, at least, or at most the amount of break time specified.
| © Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |