Originally posted by: anahana
Hi,
I'm using the class IloDispatcherTabuSearch to solve a number of VRP problems, the method does not improve any solution presented to it as Solver fails to find a solution using the goal passed to it. I used the method getFailureStatus() to print out the failure, and I got a 1, which I suppose corresponds to searchFailedNormally?
I tried this for many instances and many combinations of the tenure size and the nhood that TS uses, and I always get the same result; Solver fails to find any solution using the goal. Any idea why?
Here's the TS code just in case (the constructor for Solver is implemented exactly the same as in the examples presented in the documentation):
double RoutingSolver::improveWithTabu(IloInt _tenureSize, IloNHood _nhood)
{
//declarations
IloNum timeLimit = 5; //time in seconds
IloNum BSF = 0;
IloRoutingSolution rsol = _solution.makeClone(_env);
IloRoutingSolution best = _solution.makeClone(_env);
IloDispatcherTabuSearch dts(_env, _tenureSize);
IloSearchSelector sel = IloMinimizeVar(_env, _cost);
IloGoal move = IloSingleMove(_env, rsol, _nhood, dts, sel, _instantiateCost);
move = move && IloStoreBestSolution(_env, best);
//start timer
IloTimer timer(_env);
timer.start();
//optimization loop
while(timer.getTime() <= timeLimit)
{
if(_solver.solve(move))
{
IloRestoreSolution(_env, best);
cout << best.getObjectiveValue() << endl;
}
else
{
cout << _solver.getFailureStatus() << endl;
if(dts.complete())
break;
}
}
//store solution
IloGoal restoreSolution = IloRestoreSolution(_env, best) && _instantiateCost;
_solver.solve(restoreSolution);
//copy best to BSF
BSF = best.getObjectiveValue();
rsol.end();
best.end();
dts.end();
return BSF;
}
#CPOptimizer#DecisionOptimization