Additions, Changes and Removals in Gurobi 12.0#
Release Highlights#
Gurobi V12 provides performance improvements accross a variety of model families. The details for these improvements will be provided after the beta period.
Gurobi now supports nonlinear constraints of the form \(y = f(x)\), where \(f\) is a multivariate function given by a closed-form expression.
New features#
Nonlinear Constraints#
Gurobi now supports nonlinear constraints of the form \(y = f(x)\)
where \(f: \mathbf{R}^n \rightarrow \mathbf{R}\). Gurobi will
solve models containing such constraints to global optimality using a
branch-and-bound algorithm. The function \(f\) is provided as a
closed form expression in gurobipy (see below) and as expression trees from C
,
C++
, Java
and .NET
.
Querying allocated memory#
New attributes MemUsed and MaxMemUsed have been added to
the Model
class in all APIs. They allow you to query the current and maximum
amount of RAM allocated by the environment holding that model.
Corresponding what
values MEMUSED
and MAXMEMUSED
can be used to
query these values from callbacks. See Callback Codes for details.
More information from MULTIOBJ callback#
The MULTIOBJ
callback can now provide information about each
optimization pass: status, best objective value, best bound, mip gap,
simplex iteration count, explored and unexplored nodes, runtime and
work. See the What values table for more
details.
In-place conversion of models to fixed#
New functions have been added to convert a MIP model into a continuous one. In particular, the integer variables get fixed to their values in the solution loaded. Instead of creating a new model, these functions modify the existing model with which they are invoked.
Tuning multi-objective models#
The parameter MultiObjSettings can now be used on the
command-line when invoking grbtune
to tune one or more multi-objective
models. For each model, the first setting, or set of parameters, will be
applied to the first multi-objective iteration, etc. The parameters
specified this way are considered fixed by the tuner. Hence, they overrule
any parameter values selected by the tuner.
In case of the API, for each individually model mutli-objective settings can be added via the multi-objective environments.
Restrict to set of parameters to tune on#
With the parameter TuneParams user can provide a comma-separated list of JSON files containing parameters with their properties the tuner should consider. For each parameter a minimum, a maximum value can be defined or a list values the parameter can take. An example is shown in the parameter description of TuneParams.
New attribute for models solved with Barrier#
Models that have been solved using the barrier algorithm (i.e. continuous LP models and continuous convex QP models) have a new attribute BarPi that gives dual values for each constraint in the best barrier iterate.
New attributes for LP models#
Model attributes ObjBound and ObjBoundC are now available for LP models (they were previously only available for MIP models).
Callback settable parameters#
A few parameters that control the termination of the solving process can be modified from within a callback. Those are: TimeLimit, WorkLimit, NodeLimit, BarIterLimit, PumpPasses. This makes it easier for users to implement custom termination criteria that, for example, set a time limit based on dynamic solving process data like the current incumbent objective value. How to do that for the different APIs is illustrated here.
Changes to gurobipy#
Nonlinear expression support#
gurobipy
now supports building nonlinear expressions natively using
existing Var
and MVar
objects and Python
operators. These expressions can be added directly to a model as
nonlinear constraints using Model.addConstr
or
Model.addGenConstrNL
.
The new NLExpr
modeling object provides the core
functionality. Documentation for this class is a good starting point to
learn what is possible. The new nlfunc
module adds python functions defining sine, cosine, exponential,
logarithm, and others for use in expression construction.
Nonlinear modeling is also integrated with the matrix-friendly API
through the new MNLExpr
class.
Asynchronous optimization#
gurobipy
now supports asynchronous optimization through the methods
Model.optimizeAsync
and Model.sync
. This allows an
optimization solve to be started as a background task, enabling a simpler
approach to foreground progress monitoring than callbacks.
Logging changes#
The behaviour of the parameter LogToConsole has changed
in gurobipy
. Previously, setting LogToConsole=0
suppressed log
messages to standard output and prevented messages from being sent to
the Python logging
module. With Gurobi V12, setting
LogToConsole=0
only suppresses standard output; log messages are
still sent to the Python logger. See Monitoring Progress - Logging for
further details on usage.
Deprecated functionality#
If you are upgrading from a previous version of Gurobi, we recommend
first running your code with Gurobi 11 and warnings enabled to catch
deprecations in gurobipy
. Fixing these deprecated usages will help
to keep compatibility for Gurobi V12 and later versions. Warnings can be
enabled by running your code with the -X dev
or -W default
flags. See the Python Development
Mode or
warnings package
documentation for further details.
In Gurobi V12, the following usage is deprecated and will be removed in a future version:
Passing a
tupledict
directly to the general constraint helpersand_
,or_
,max_
,min_
, andnorm
, or the equivalent methodsModel.addGenConstrAnd
,Model.addGenConstrOr
,Model.addGenConstrMax
,Model.addGenConstrMin
, andModel.addGenConstrNorm
, is deprecated. To apply these constraints across all variables in a tupledicttd
, passtd.values()
instead. This change is to avoid an inconsistency between passing a tupledict and a regular Python dictionary to these methods.Wildcard name matching using ‘*’ and ‘?’ for parameter names is deprecated in
setParam
,Model.setParam
,Env.setParam
, andModel.getParamInfo
.Passing the string ‘default’ as a means of resetting a single parameter to its default value is deprecated in
setParam
,Model.setParam
, andEnv.setParam
.
Removal of deprecated functionality#
The three-argument signature
Model.addConstr(lhs, sense, rhs)
has been removed, leaving onlyModel.addConstr(constr, name)
. Separate(lhs, sense, rhs)
arguments can still be passed toModel.addLConstr
andModel.addQConstr
.Directly calling the
MVar
constructor is no longer supported.The following undocumented classes were removed from the
gurobipy
namespace so can no longer be addressed directly:AttrConstClass
,CallbackClass
,ErrorConstClass
,ParamConstClass
, andStatusConstClass
have been removed. To access Gurobi constants, use the equivalent attributes in theGRB
namespace instead:GRB.Attr
,GRB.Callback
,GRB.Error
,GRB.Param
, andGRB.Status
.ParamClass
,GenExprAbs
,GenExprAnd
,GenExprMax
,GenExprMin
,GenExprNorm
, andGenExprOr
have been removed.
Other notable changes#
New default value for FuncNonlinear
#
The default value of the FuncNonlinear parameter has changed. The new default (value 1) will use a dynamic outer-approximation approach for all univariate general functions constraints (unless their FuncNonlinear attribute is set to 0, in which case a static piecewise-linear approximation will be used instead).
Providing solutions through callbacks for Compute Server#
Gurobi V12 supports inserting user-provided solutions through callbacks
in the context of a Compute Server. For additional details, please
refer to the corresponding APIs in C
,
C++
,
Java
,
.NET
, and
Python
.
New use-case for IgnoreNames
#
When writing files, if the IgnoreNames parameter is set to 1, the names written in the files are now default names instead of the actual names of the objects.
Reduced memory to store solutions#
The amount of memory required to store solutions in the pool has been greatly reduced in Gurobi V12. This change applies to most models, and will not increase the memory used when it doesn’t apply. It facilitates the handling of very large numbers of solutions in the solution pool.
Printing solution quality at the end of a solve#
You can now use the --printquality
switch with the Gurobi
command-line tool to get some information about the
solution quality at the end of a solve.
Signatures in LP and MPS files#
The Gurobi Optimizer inserts a Signature
comment when writing an
LP or MPS file. This signature
facilitates the proper identification of the owner of a model, and the
handling of your data when you submit models to Gurobi for support.
For an LP file, this could look like this:
\ LP format - for model browsing. Use MPS format to capture full model detail.
\ Signature: 0x879dda9303b81740
Minimize
...
The signature is computed from the LICENSEID
field in the license
used when writing the model. It is an anonymized form of the
LICENSEID
, such that only Gurobi staff can decode the LICENSEID
from the signature. It is different for different models, even when the
same LICENSEID
is used. It is included for all types of
LP and MPS files, including REW and RLP formats.
Support for XZ compression tool#
In addition to .zip
, .gz
, .bz2
, and .7z
compression
formats, Gurobi V12 supports .xz
extension if the appropriate
tool is installed. See the file format
section in the reference manual for details on Gurobi file formats.
Deprecated functionality#
With Gurobi V12 we deprecate several flags of the command-line tools
gurobi_cl
and grbtune
. The functionality of these flags can
now be achieved with parameters.
Deprecation of the interactive shell#
The Gurobi interactive shell (gurobi.sh and gurobi.bat) is deprecated since version 11.0.2 and will be removed in a future release. Please set up your own Python environment to use gurobipy. For installation instruction see https://support.gurobi.com/hc/en-us/articles/360044290292