IBM ILOG Dispatcher User's Manual > The Basics > Multiple Tours per Vehicle > Model > Define the createVisits function |
Define the createVisits function |
INDEX
![]() |
The createVisits
function is defined as in Chapter 4, Minimizing the Number of Vehicles, except that instead of directly adding each visit to the model, you add each visit to an array of unordered visits. This array of unordered array of visits will be ordered in the submodel and used to create a first solution. The visits created by this function are the customer visits. The return visits to the depot are created by a member function of the class RoutingSolver
. See "Define the insertAllReturnVisits function".
Step 6 - | Add the visit to the array of unordered visits |
Add the following code after the comment //Add the visit to the array of unordered visits
_unorderedVisitArray.add(visit);
Likewise, the constraint on visit quantity is not added directly to the model. It is added by setting both the upper and lower bounds of the transit variable associated with the dimension _weight
equal to quantity
.
Step 7 - | Add the constraint on visit quantity |
Add the following code after the comment //Add the constraint on visit quantity
visit.getTransitVar(_weight).setBounds(quantity, quantity);
Here is the complete code for defining the createVisits
function:
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |