2
$\begingroup$

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?

$\endgroup$
4
  • $\begingroup$ If you change the Benders strategy parameter value from 2 to 1, do you still get the exception? $\endgroup$
    – prubin
    Commented Jan 27, 2023 at 4:16
  • $\begingroup$ Yes. Also I use try & catch feature in C++ (I don't know if other languages has this feature or not, but it shows more detail about the error) and got "Invalid Benders Decomposition" massage. $\endgroup$
    – Vala
    Commented Jan 27, 2023 at 14:57
  • 1
    $\begingroup$ Check for any of the following: assigning integer variables to subproblems; assigning the same variable to two different problems; assigning an unused variable to some problem; failing to assign a variable to any problem. $\endgroup$
    – prubin
    Commented Jan 27, 2023 at 16:20
  • $\begingroup$ Will do it, Thanks!!! $\endgroup$
    – Vala
    Commented Jan 27, 2023 at 18:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.