Provide an initial solution to a dispatcher model using an external (csv) file
How can I provide an initial solution to a dispatcher model using an external (csv) file?
The approach involves setting every visit to a particular vehicle using the
IloRoutingSolution.setVehicle() method. The order of the visits that each vehicle makes in the user provided solution also needs to be specified between the vehicle's first and last visit (obtained via the
IloVehicle.getLastVisit() calls respectively), using the
IloRoutingSolution.setNext() method. Along with this the findFirstSolution goal needs to be modified to restore the solution provided by the user as such:
IloGoal goal = restoreSolution && instantiateCost;
Attached is a modified version of the pdp example (which comes with the distribution at <DispatcherXX>\examples\src) along with a csv file that defines an initial solution to the model.
In its current scheme, the csv file needs to provide a list of vehicle & visit combinations making sure that all the visits of a particular vehicle are contiguous so as to be compatible with the logic in the code. You may need to change the
initPDP, nodeFileName, vehiclesFileName, visitsFileName variable values to match the location of the corresponding files on your file system.
More support for:
IBM ILOG CP
Dispatcher:First Solution Algorithms
Software version: 1.5, 1.6
Operating system(s): AIX, HP-UX, Linux, Solaris, Windows
Software edition: All Editions
Reference #: 1573352
Modified date: 31 October 2012
Translate this page: