There are two ways to implement lazy constraints for a MIP model.
- If the constraints can be enumerated upfront, set the Lazy attribute on the constraints that should be treated as lazy.
- If the constraints must be generated during the MIP search, you need to write a callback function and set the LazyConstraint parameter to 1. Details can be found in the reference manuals of the various APIs, Model.cbLazy() for example, and a TSP example which illustrates adding lazy constraints via a callback is provided in the examples subdirectory.
There is no support for lazy constraints in continuous models (LP, QP, or SOCP). To add a lazy constraint to a continuous model, you should stop solving, add the new constraint, and start solving again.