IBM ILOG Dispatcher User's Manual > The Basics > Multiple Tours per Vehicle > Solve > Define the main function |
Define the main function |
INDEX
![]() |
After you finish creating the RoutingModel
and RoutingSolver
classes and the printInformation
function, you use them in the main
function. You can use command line syntax to pass the names of input files to the model. If you do not specify input files, the defaults will be used. In the main
function, you first create an environment. Then you create an instance of the RoutingModel
class, which takes the environment and input files as parameters. You create an instance of the RoutingSolver
class, which takes the model as a parameter. You call the member function RoutingSolver::insertAllReturnVisits
to add the return visits to the first solution. You call the member function RoutingSolver::orderVisits
to create a submodel and order the customer visits. This member function takes two parameters: the unordered visit array and the graph from the routing model mdl
. You call the member function RoutingSolver::insertCustomerVisits
to insert the ordered customer visits into the first solution. You use Solver to improve the first solution and print this solution. The following code is provided for you:
Step 22 - | Compile and run the program |
Compile and run the program. You will get results that show the routing plan and information for the improved solution. The solution uses 4 vehicles. Each vehicle makes one return visit to the depot, that is, each vehicle performs two tours. There are 12 unused return visits. See "Complete Output" for details. The solution improvement phase finds a solution using 4 vehicles with a total cost of 2114.8 units after making 139 cost-decreasing moves:
The complete program and output are listed in "Complete Program". You can also view it online in the YourDispatcherHome/examples/src/multitr.cpp
file.
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |