I'm trying to solve an optimization model using Automated Benders with annotations using CPLEX library in C++. I've defined a master problem and N (number of supply nodes in my model's network) subproblems by annotations as below:
for (int i = 0; i < nI; i++)
{
for (int t = aan[i]; t < nT; t++)
{
for (int g = 0; g < nG; g++)
{
cplex.setAnnotation(benders, ztig[t][i][g], 0);
}
}
}
for (int o = 0; o < nO; o++)
{
for (int g = 0; g < nG; g++)
{
for (int d = 0; d < nD; d++)
{
cplex.setAnnotation(benders, ygod[g][o][d], o + 1);
for (int t = aan[o]; t < To; t++)
{
for (int i = 0; i < nI; i++)
{
if (Aij[o][i] == 1)
{
cplex.setAnnotation(benders, xtodijg[t][o][d][o][i][g], o + 1);
}
if (t >= tij[i][o])
{
if (Aij[i][o] == 1)
{
cplex.setAnnotation(benders, xtodijg[t - tij[i][o]][o][d][i][o][g], o + 1);
}
}
}
}
}
}
}
After setting benders strategy parameter two "worker" mode, I ran the code and got "Microsoft C++ exception: IloCplex::Exception at memory location" exception in solve command (following part)
cplex.setParam(IloCplex::Param::Benders::Strategy, 2);
//cplex.setOut(env.getNullStream());
if (!cplex.solve()) {
env.error() << "Failed to optimize the Master Problem!!!" << endl;
throw (-1);
}
Please note that model has been successfully solved by both Full mode of automated benders and branch & cut. So, I guess my annotations are not creating disjoint subproblems. I've checked the algebraic model many times, and subproblems are disjoint there. On the other hand, I couldn't find any mistakes in implementation of annotations. So does anyone has similar experience or ideas why its not working?