First, set the following:


Then, choose below:

Quick Start Guides

Example Tour

Reference Manual

AMPL-Gurobi Guide

Remote Services

Cloud Guide



Type: int
Modifiable: Yes

Determines whether a linear constraint is treated as a lazy constraint. At the beginning of the MIP solution process, any constraint whose Lazy attribute is set to 1, 2, or 3 (the default value is 0) is removed from the model and placed in the lazy constraint pool. Lazy constraints remain inactive until a feasible solution is found, at which point the solution is checked against the lazy constraint pool. If the solution violates any lazy constraints, the solution is discarded and one or more of the violated lazy constraints are pulled into the active model.

Larger values for this attribute cause the constraint to be pulled into the model more aggressively. With a value of 1, the constraint can be used to cut off a feasible solution, but it won't necessarily be pulled in if another lazy constraint also cuts off the solution. With a value of 2, all lazy constraints that are violated by a feasible solution will be pulled into the model. With a value of 3, lazy constraints that cut off the relaxation solution at the root node are also pulled in.

Note that deleting constraints from your model will cause this attribute to be discarded. If you'd like it to persist, your program will need to repopulate it after deleting the constraints and making a subsequent model update call.

Note that only linear constraints can be marked lazy. Marking other types of constraints (such as quadratic, SOS, or general constraints) as Lazy may result in an error, or may be ignored. This attribute only affects MIP models.

For examples of how to query or modify attributes, refer to our Attribute Examples.