Originally posted by: albertschrotenboer
I'm sorry, that was a typo. I've copied the code below. We detect that they are infeasible because solve() returns false. We only have linear constraints (via lazy and user callbacks as well as via a lazy constraint pool and a set of initial (also linear) constraints). I think dual reductions are disabled due to using lazy callback.
I suspect solve() returns false because the solution is infeasible in that specific node of the b&b tree from which the heuristic callback is called, while the solution is feasible without branching/preprocessing? constraints/decisions.
The code: g_globalSol is a thread safe vector<vector<double>> describing our solution, and model is an Object defining that encapsulates all constraints, variables and problem data.
IloNumArray vals = IloNumArray(model.d_env);
IloNumVarArray vars = IloNumVarArray(model.d_env);
int obj = 0;
for (int i = 0; i != model.d_nNodes; ++i)
{
for (int j = 0; j != model.d_nNodes; ++j)
{
int value = g_globalSol[i][j]._a;
if (value == 1 )
{
vals.add(g_globalSol[i][j]._a);
vars.add(model.d_x[i][j]);
obj += g_globalSol[i][j]._a * model.d_cost[i][j];
}
}
}
IntegerFeasibilityArray feas = IntegerFeasibilityArray(model.d_env);
getFeasibilities(feas, vars);
IloNumArray vals1 = IloNumArray(model.d_env);
IloNumVarArray vars1 = IloNumVarArray(model.d_env);
int nvars = vars.getSize();
for (int i = 0; i != nvars; ++i)
{
if (feas[i] != CPX_IMPLIED_INTEGER_FEASIBLE)
{
vars1.add(vars[i]);
vals1.add(vals[i]);
setBounds(vars1[i], vals1[i], vals1[i]);
}
}
if (solve())
setSolution(vars1, vals1);
vals.end();
vars.end();
vals1.end();
vars1.end();
feas.end();
#CPLEXOptimizers#DecisionOptimization