Additions, Changes and Removals in Gurobi 10.0#
Additional Release Notes for Gurobi 10.0.3#
None
Additional Release Notes for Gurobi 10.0.2#
A warning is now printed when running IIS on models with general function constraints.
Additional Release Notes for Gurobi 10.0.1#
Changes to the .NET standard library#
The .NET standard library is now signed with a strong name. This applies to both the C# library distributed with the full Gurobi installation and the NuGet package.
Conda package for Python 3.11#
A Conda package for Python 3.11 is now available.
Changed in Gurobi 10.0.0#
Changes to C API#
The parameter for method GRBcbproceed
has changed. The signature
was:
void GRBcbproceed(GRBmodel *model)
and is now:
int GRBcbproceed(void *cbdata)
Changes to attributes#
The VBasis variable attribute for a fixed variable will now return either -1 (non-basic at lower bound) or -2 (non-basic at upper bound), depending on the sign of the reduced cost (it previously always returned -1).
Changes to callback#
User callbacks could previously be called from a variety of Gurobi
methods. They will now only be called from methods that solve an
optimization model. The list of such methods of course includes
optimize
, but also feasRelax
, computeIIS
, and a few others.
Removed in Gurobi 10.0#
End of support for Python 2.7#
This version has dropped support for Python 2.7.
Only one set of C++ libraries for Windows#
We now only ship a single set of C++ libraries
(gurobi_c++md2017.lib
, gurobi_c++mdd2017.lib
, etc.), built with
Visual Studio 2017. These are binary compatible with Visual Studio
versions 2017-2022.
Removed attributes#
Attributes JobID and ComputeServer are no longer available. The same information can be obtained via the read-only parameters JobID and ComputeServer, which have been available since Gurobi 8.0.
Removed GRBgetlogfile method#
The C API method GRBgetlogfile
has been removed. Use the
LogFile parameter to obtain the name of the log file.
Removed legacy methods for creating Compute Server and Instant Cloud environments#
The following legacy methods and constructors for creating Compute Server and Instant Cloud environments have been removed:
C:
GRBloadclientenv
,GRBloadcloudenv
C++:
GRBEnv(const std::string& logfilename, const std::string& computeserver, const std::string& router, const std::string& password, const std::string& group, int CStlsInsecure, int priority, double timeout) GRBEnv(const std::string& logfilename, const std::string& accessID, const std::string& secretKey, const std::string& pool, int priority)
Java:
GRBEnv(String logFileName, String computeServer, String router, String password, String group, int CStlsInsecure, int priority, double timeout) GRBEnv(String logfilename, String accessID, String secretKey, String pool, int priority)
.NET:
GRBEnv(string logfilename, string computeserver, string router, string password, string group, int CStlsInsecure, int priority, double timeout) GRBEnv(string logfilename, string accessID, string secretKey, string pool, int priority)
gurobipy:
Env.ClientEnv
,Env.CloudEnv
,Matlab and R: The
env
parameter to the Gurobi functions. See Matlab and R changes below for conversion details.
You should use the configuration parameters instead, which were introduced in Gurobi 8.0 to simplify this process.
New features affecting all APIs#
Licensing#
The Gurobi Web License Service (WLS) previously only worked within containerized environments. With Gurobi 10.0, WLS licenses are also available that work outside of containers (on Windows, macOS and Linux), as well as in both types of environments.
New parameters#
The following parameters are new in Gurobi 10.0:
NetworkAlg to control the network simplex algorithm.
OBBT to control the aggressiveness of Optimality-Based Bound Tightening.
SoftMemLimit to limit the total amount of memory available to an optimization (leading to a graceful exit when the limit is hit).
SolutionTarget to specify the solution target for LP.
WLSTokenRefresh to specify the refresh interval of a Web License Service token.
Logistic General Constraint#
Added support for piecewise-linear approximation of the logistic function as a general constraint. With this feature, you can model the logistic function \(y = \frac{1}{1 + e^{-x}}\) on problem variables \(x\) and \(y\). As with all general constraints, you can control how fine-grained the piecewise-linear approximation should be. See the General Constraint section for more information.
Specific performance improvements#
In addition to general performance improvements across all supported problem classes, we have added the following enhancements for specific problem types:
Added a network simplex algorithm to speed up the solution of LPs with pure network structure.
Added a new QUBO heuristic to improve our ability to quickly find good feasible solutions for Quadratic Unconstrained Boolean Optimization problems.
Reorganized the concurrent LP solver to improve performance and reduce memory consumption.
Significantly improved performance on MIP models that contain constraints that model neural networks with ReLU activation functions.
Behavior changes affecting the Python matrix-friendly API#
With version 10.0 we have extended the capabilities of the existing
MVar
, MLinExpr
, and MQuadExpr
modeling classes and improved
their behaviour in many respects. Some of the changes may cause
incompatibilities with existing code that uses these objects, so we
suggest that you read the following summary carefully and adapt your
code accordingly.
More arithmetic operations supported#
You can now perform point-wise multiplication involving combinations of matrix-friendly modeling objects and NumPy ndarrays. For example:
a = numpy.random.rand(3)
x = model.addMVar(3)
y = model.addMVar(3)
# Add three linear constraints a[i]*x[i] = y[i]
model.addConstr(a * x == y)
# Add three quadratic constraints x[i]*y[i] = a[i]
model.addConstr(x * y == a)
Arbitrary dimensions now supported#
The classes MVar
, MLinExpr
, and MQuadExpr
now support
arbitrary numbers of dimensions. For example, you can now create 2-D
matrix linear expressions:
A = numpy.random.rand(4,3)
B = numpy.random.rand(4,2)
X = model.addMVar((3,2))
# Add 8 linear constraints A[i, :] @ X[:, j] == B[i, j]
model.addConstr(A @ X == B)
Dimensionality and consistency#
The classes MVar
, MLinExpr
, and MQuadExpr
now behave
similarly to NumPy’s ndarray when it comes to dimension handling. For
example:
X = model.addMVar((3,3))
sub1 = X[:, 1] # Gives 1-D (3,) Mvar
sub2 = X[:, 1:2] # Gives 2-D (3, 1) Mvar
sub3 = X[0, 1] # Gives 0-D () Mvar
In addition, a 0-D MVar object now acts like a “scalar” Var
object,
but it keeps its dimensionality properties.
Furthermore, in previous versions all MQuadExpr
objects containing
just one element had shape (1,)
. Such objects now follow the shape
rules of Python’s matrix multiplication operator:
Q = np.random.rand((3,3)); Q = Q + Q.T
x = model.addMVar((3,1))
expr1 = x.T @ Q @ x # expr1.shape is (1,1)
expr2 = x[:, 0] @ Q @ x[:, 0] # expr2.shape is ()
Arithmetic operations embrace NumPy’s broadcasting rules#
The behaviour of arithmetic operations among the matrix friendly modeling objects of different shapes now follows NumPy’s broadcasting rules. For example:
a = numpy.random.rand(3)
x = model.addMVar((3,3))
# a is broadcast along the first dimension of x; result is (3,3)
expr = a * x
Broadcasting is also applied implicitly when adding broadcastable expressions as constraints:
a = numpy.random.rand(3)
x = model.addMVar((3,3))
# a is broadcast along the first dimension of x.
# The effect is the same as doing addConstr(x - a == 0)
model.addConstr(x == a)
For detailed information on broadcasting we refer you to NumPy’s documentation.
Other changes#
Creating MVar objects through
Model.addMVar
is now roughly 40% faster.The optional attribute initializers for
Model.addMVar
now need to be passed in a broadcastable shape. In older versions, any list with an appropriate number of elements could be used, which is ambiguous in the case of a multi-dimensional MVar. Please refer to the documentation ofModel.addMVar
for details.Using the MVar constructor to convert a list of
Var
objects to anMVar
object is deprecated. A dedicated, faster method (MVar.fromlist
) has been introduced for this purpose.The method
MVar.sum
now takes an optionalaxis
argument to select an axis along which the summation should happen. Also, the shape of the resultingMLinExpr
after summing all elements is now()
, (0-D), as opposed to(1,)
in older versions.The method
MLinExpr.copy
now returns a deep copy, as opposed to a shallow copy in earlier versions.Invalid or incompatible matrix multiplication invocations now raise a
ValueError
instead of aGurobiError
.
To check whether your program calls any deprecated methods you can set
an appropriate filter in Python’s warnings
module. For example, you
can turn all warnings to runtime errors by starting the Python
interpreter with the option -W error
.
Changes in the Matlab and R APIs#
The env
argument to Matlab and R API functions has been removed.
This argument was previously used to provide the data required to
connect to a Compute Server or to Gurobi Instant Cloud. This information
should now be passed through parameters in the params
struct.
For example, the new signature of the “gurobi” function is
gurobi(model, params)
. To update a program that uses the env
argument, just set the appropriate parameters in params
to match the
fields you previously used in env
. The following table shows the
correspondence between the field names of the deprecated env
argument and Gurobi parameters:
env |
params |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A client MATLAB program that solves a model on a Compute Server should now look something like the following:
m.A = sparse(0,0); % Just a minimal model struct for demonstration
params.Method = 2; % Use barrier method (for demonstration)
params.ComputeServer = 'myserver.mycompany.com'; % Set server name
params.ServerPassword = 'pass'; % Set password
gurobi(m, params); % Solve model on server with barrier
Similarly for R, client code to solve a model on a Compute Server should look like:
m <- list(A = matrix(0)) # Just a minimal model struct for demonstration
params <- list()
params$Method <- 2 # Use barrier method (for demonstration)
params$ComputeServer <- "myserver.mycompany.com"; # Set server name
params$ServerPassword <- "pass"; # Set password
gurobi(m, params); # Solve model on server with barrier
In summary, this is now the full list of signatures for Matlab and R API functions:
gurobi(model, params)
gurobi_feasrelax(model, relaxobjtype, minrelax, penalties, params)
gurobi_iis(model, params)
gurobi_read(filename, params)
gurobi_relax(model, params)
gurobi_write(model, filename, params)
Compute Server, Cluster Manager, and Instant Cloud#
Detailed release notes for Compute Server, Cluster Manager, and Instant Cloud can be found here