Originally posted by: UserCplex
In response to SystemAdmin
>>ADDENDUM: CPLEX will not add the same cut/constraint twice, so it should do no harm (other than wasted CPU cycles) if the callback separates a cut/constraint that is already contained in the the pool. Only one instance of this cut/constraint will be added.
Hello,
I am bumping this up as I am facing a situation where I am going to be using the lazy cut pool.
I have a model for which at present, I have a mylazycutcallback() function that exactly separates and adds lazy cuts at candidate integer solutions. Violated lazy cuts are added within this callback function using the following:
CPXcutcallbackadd(lp.Env(), cbdata, wherefrom, lprow->num, lprow->rhs[0], lprow->sense[0], lprow->rmatind, lprow->rmatval, CPX_USECUT_FORCE);
From documentation: https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.5.1/ilog.odms.cplex.help/refcallablelibrary/html/functions/CPXcutcallbackadd.html
I gather that the usage of CPX_USECUT_FORCE above ensures that further in the Branch and Bound Tree (BBTree) this cut explicitly remains in the LP relaxation.
Now, instead of waiting until hitting a candidate integer solution, I am looking to run a heuristic generator of these lazy cuts at different (not necessarily candidate integer) nodes. Below is assuming that populating the lazy cut pool is possible within the tree and not just before a call to CPXmipopt().
My questions are:
(1)Is there any suggested callback function within which I should run this heuristic generator of lazy cuts?
(2)Within this heuristic generator, (based on documentation at https://www.ibm.com/support/knowledgecenter/SSSA5P_12.9.0/ilog.odms.cplex.help/refcallablelibrary/mipapi/addlazyconstraints.html), I plan to use the CPXaddlazyconstraints function to populate the identified cuts into the lazy cut pool. Is this the right way to populate the pool?
(3)Because this is a heuristic that is based on the current fractional/integer node solution, the identified lazy cuts need not be violated by the current solution (fractional or integer). So, is there any suggested stopping strategy within a callback? Otherwise, this will run into an infinite loop based on my current understanding.
(4)Because this is a heuristic, the identified lazy cuts can be duplicates of pre-existing cuts that were added to the lazy cut pool somewhere else in the BBTree. Is it more efficient for the user to check this using his own data structures to prevent duplication before calling CPXaddlazyconstraints or is whatever the user does going to be less efficient than optimized CPLEX duplication prevention or space bloat of the lazy cut pool? This is specifically why I quoted the CPLEX respose from the earlier post to the beginning of my post. That is, can the user be guaranteed that he need not do duplication check before calling CPXaddlazyconstraints() since even if a duplicate constraint is added, CPLEX is likely to be more efficient in detecting and discarding it?
(5)
I quote the following from CPLEX documentation:
>>Lazy constraints are only (and always) checked when an integer-feasible solution candidate has been identified, and of course, any of these constraints that turn out to be violated will then be applied to the full model.
If I understand correctly, at a candidate integer solution, the current integer solution is checked against each constraint of the pool, and the violated constraints (say 2 lazy constraints from the pool of currently say 10 constraints) will be added to the model. The size of the pool reduces to 8. What determines whether these 2 added constraints remain in the model or not? In other words, CPXcutcallbackadd() has an int purgeable argument, while CPXaddlazyconstraints() does not. How does CPLEX treat these two types of lazy constraints -- one added via the former function and the other via the latter function -- how are they similar, how are they different? Am I right in assuming that CPXaddlazyconstraints() populates a pool and once a violation of a constraint in this pool is found, the violated cut is added for all remaining LPs encountered in the BBTree even at nodes that are not related to the node at which the cut was found violated ?
Thank you.
#CPLEXOptimizers#DecisionOptimization