I'm not sure if this is what you're asking, but if you attempt to write out the model after `solve()` it will not include the lazy constraints that you add through the callback function. If you want to literally print them out for debugging, you'll have to do that manually. For example, I modified the LazyConstraintCallback in the admipex5.py example that is included in the CPLEX installer:
# Add the following constraint to the noswot model via lazy
# constraint callback; the optimal solution will be cut off:
#
# lazy_con : W11 + W12 + W13 + W14 + W15 <= 3
#
class MyLazy(LazyConstraintCallback):
def __call__(self):
indices = ["W11", "W12", "W13", "W14", "W15"]
act = 0.0
for i in indices:
act += self.get_values(i)
if act > 3.01:
constraint = cplex.SparsePair(ind=indices, val=[1.0] * 5)
sense = "L"
rhs = 3.0
print("LC:", constraint, sense, rhs)
self.add(constraint=constraint,
sense=sense,
rhs=rhs)
With this you see lines like the following in the output:
LC: SparsePair(ind = ['W11', 'W12', 'W13', 'W14', 'W15'], val = [1.0, 1.0, 1.0, 1.0, 1.0]) L 3.0
#CPLEXOptimizers#DecisionOptimization