I need to add some lazy constraints within a CPLEX generic callback (version 22.1.1). Those lazy constraints do not exclude the current solution candidate, but they nevertheless exclude other integer points, so they cannot be loaded as user cuts.
From the documentation for the Java API I see that IloCplex.Callback.Context.rejectCandidate(IloRange[] arg)
allows to load lazy constraints, but reading the documentation is not obvious to me whether such lazy constraints MUST be violated by the current candidate solution or they can be any inequalities that preserve the optimal solution.
Also, I need to add such lazy constraints when either the lower or upper bound of the objective value change. As I am solving a minimization problem, my upper bounds are given by the value of the incumbent integer solution and my lower bounds are given by the value of the linear relaxations.
Although the former are available within the same scope/state as the one that allows the insertion of lazy constraints (IloCplex.Callback.Context.Id.Candidate
), the latter are available within (IloCplex.Callback.Context.Id.Relaxation
) where I cannot call the method rejectCandidate(...)
.
Do I have to store those constraints and wait for the next IloCplex.Callback.Context.Id.Candidate
state to apply the related lazy constraints? (this would be unfortunate, as those states are quire rare).
So my questions are:
How do I load lazy constraints that do not reject the current candidate solution?
What is the 'recommended' way to load lazy constraints when I am able to find them during a state which is not
IloCplex.Callback.Context.Id.Candidate
?
Originally asked on this StackOverflow post.