To obtain a new Search Tree for each move, proceed as follows:
-
Type:
IlcSolverDebugger debugger(solver);
while (debugger.initialize()) {
-
Create the initial solution:
solver.solve(IloGenerate(env, knightArr)
&& IloStoreSolution(env, sol));
-
While there are iterations, create a new Search Tree view and start a new search for each iteration:
&& debugger.newSearchTreeView() && solver.solve(move)) {
-
Store the new best solution if there is one, and display it:
if (sol.getObjectiveValue() < best.getObjectiveValue()) {
<< ", Knights = " << sol.getObjectiveValue() << endl<< ends;
debugger.sendSolution(txt.str());
-
If iterations are still left, ask
tabu
if it is complete:
} while (iter > 0 && !tabu.complete());
-
Restore the best solution found:
debugger.sendConsole("Restoring solution...\n");
debugger.newSearchTreeView();
solver.solve(IloRestoreSolution(env, best));
See the debuglsknight example for details on local search.