IBM ILOG Dispatcher User's Manual > The Basics > Solving a Vehicle Routing Problem > Solve > Define the findFirstSolution function |
Define the findFirstSolution function |
INDEX
![]() |
Now, you create the function that searches for the first solution.
Step 5 - | Find the first solution |
Add the following code after the comment //Find the first solution
IloBool RoutingSolver::findFirstSolution() { if (!_solver.solve(_goal)) { _solver.error() << "Infeasible Routing Plan" << endl; return IloFalse; } |
You use the member function IloSolver::solve
to search for a solution using _goal
. This goal searches for a first solution using the savings heuristic. It then finds the cost associated with this first solution.
Next, you use the member function IloRoutingSolution::store
to store the solution and its cost. These will be used in the solution improvement phase.
Step 6 - | Store the first solution |
Add the following code after the comment //Store the first solution
_solution.store(_solver); return IloTrue; } |
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |