Dear Prof. Rubin,
Thanks a lot.
As you suggested, I developed a generic callback. Only when contextid == CPX_CALLBACKCONTEXT_CANDIDATE, I added my Benders cut and possible incumbnet in the generic callback.
While implementing my code, I saw strage iteration results. At some iteration, CPLEX did call the generic callback, but did not iterate from the first line of code in the generic callback. Actually the first-line code just printed some information, e.g., "Start generic callback". Sometimes, CPLEX implemented twice one line of code in the generic callback.
Can you give me some suggestions for figuring out this issue.
Thanks,
Xiangyong
------------------------------
Xiangyong Li
------------------------------
Original Message:
Sent: Tue October 20, 2020 03:59 PM
From: Paul Rubin
Subject: How to add Benders cut and simultaneously give an incubment to CPLEX?
Using legacy callbacks (which you appear to be doing), you have to attach a heuristic callback as well as the lazy constraint callback, and create a solution stack (or queue or similar memory structure) in your memory space. When the lazy constraint callback finds a solution, it pushes it on the stack. When the heuristic callback is invoked, it checks the stack, and if the stack is not empty the callback pops solutions from the stack and adds them as candidates.
Using the newer generic callback model, it's simpler. You can post a new candidate solution directly from the "incumbent" context, which is where the lazy constraints (cuts) are generated.
------------------------------
Paul Rubin
Professor Emeritus
Michigan State University
Original Message:
Sent: Tue October 20, 2020 08:46 AM
From: Xiangyong Li
Subject: How to add Benders cut and simultaneously give an incubment to CPLEX?
Dear all,
I am developing my own benders decomposition method. I used a lazyconstraintbacllback to add Benders cuts when an inteter solution was found.
If the subproblem corresonding to the solution is infeasible, I will add a feasibility cut.
If the subproblem is feasible, I will add an optimality cut. But at the same time, I may find an incumbent. So how to give this incumbent to CPLEX? I rember that CPLEX will accept an integer solution only when we did nothing in the lazyconstraintcallback
Thanks,
Xiangyong
------------------------------
Xiangyong
------------------------------
#DecisionOptimization