UpdateMode

Changes the behavior of lazy updates
Type: int
Default value: 0
Minimum value: 0
Maximum value: 1

Changes the behavior of lazy updates. By default, whenever you add a new variable or constraint to the model, you must call update before you can access that new item. For example, you must call update before you can build a new constraint that involves a newly added variable. Setting the new UpdateMode parameter to 1 allows you to use new variables and constraints immediately for building or modifying the model. Note that the current model is still not changed and so the attributes about the new variables and constraints cannot be queried, until update is called.

Note that it is generally a good idea to add items to your Gurobi model in phases, calling update at the end of each phase. This practice allows Gurobi to build the internal representation of your model more efficiently. This new parameter is meant for cases where adding items in phases is inconvenient. It introduces a small amount of additional internal storage, and can introduce a small performance overhead. It may also cause Gurobi to make less aggressive use of warm-start information when modifying models and resolving using simplex.

You should set this parameter as soon as you create your Gurobi environment.

Note that you still need to call update to modify an attribute on an SOS constraint or a quadratic constraint.

For examples of how to query or modify parameter values from our different APIs, refer to our Parameter Examples.

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search