Originally posted by: ORstudent
Hello,
I am trying to use ILOHEURISTICCALLBACK for introducing solutions that got from heuristic but it gives me the following error:
The referenced IloExtractable has not been extracted by the IloAlgorithm.
What I am doing is the following:
xBest2 is a double array with the values of the decision variables for getting the objective value of the heuristic
bestSol2 is a double with the objective value of the solution I got from the heuristic
ILOHEURISTICCALLBACK1(heurCB,IloNumVarArray, vars)
{
int cols = vars.getSize();
IloNumArray X12 = IloNumArray(getEnv(),cols);
IloNum objVal = getIncumbentObjValue();
if(bestSol2!=-1&&bestSol2>objVal) //if the solution of the heuristic is better than the incumbent got by CPLEX so far, I replace it
{
for(int i=0;i<cols;i++)
X12[i] =(bool)xBest2[i];
objVal=bestSol2;
setSolution(vars,X12,objVal); //Here I got the error
}
}
Any clue of why I am getting the error?
Thanks!!
---
Edit :
Or should I directly use addMIPStart, that will make the same??
#CPLEXOptimizers#DecisionOptimization