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.
Rate this page:
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.