Originally posted by: SystemAdmin
> Thanks for your reply. I used try/catch block, and I got the following exception message: "The referenced IloExtractable has not been extracted by the IloAlgorithm" when the code attempts to add a cut that is defined on newly introduced binary variables. Does this have anything to do with the fact that I am using macros, not callback classes directly?!
>
Using macros should not be a problem here. I think the exception is exactly what I suspected: You use newly created variables in your cuts and that is not supported.
> I started to think of something else to cope with the issue. I tried to make a huge array of binary decision variables before calling cplex.solve(), and I added a trivial constraint (say, the sum of all those variables are bigger than -1) to make sure that they are extracted to the model. Then, I used them one by one when necessary in the callback.
>
I am not sure that this works as expected. My guess is that CPLEX presolve will fix all these variables to 0. Is this going to be a problem?
>
> Oddly enough, now I get an integer point, and I make the cut (and I know, from my other implementation that does not use callback, the inequality must cut the point off), but CPLEX keeps generating the same point forever, i.e., the inequality does not seem to be added to the model, or it's not working.
>
Did you check whether your cuts are violated by the current solution? And if they are, by how much are they violated? It might be that they are only violated marginally and CPLEX therefore treats them as non-violated.
#CPLEXOptimizers#DecisionOptimization