Additions, Changes, and Removals in Gurobi 14.0#

Release Highlights#

  • Gurobi 14.0 provides performance improvements across a variety of model families, including LP, MIP, and MINLP. No parameter settings or application code changes are necessary to benefit from these performance improvements. Detailed results will be posted on our website.

  • Two new MIP heuristics geared towards finding high-quality solutions quickly have been added to Gurobi 14: a PDHG-based heuristic with optional GPU acceleration, and a NoRel heuristic that is integrated with Gurobi’s branch-and-bound tree search.

  • Nonlinear objective functions and constraints are now first-class modeling entities in Gurobi 14.0. All APIs feature new methods and attributes for creation and modification of such nonlinear model components. Also, .NET languages now support expression-based nonlinear modeling.

New Features#

NoRel Tree Heuristic#

Gurobi’s popular NoRel heuristic is now integrated directly into the branch-and-bound tree search (“NoRel tree heuristic”). It is a more dynamic alternative to the standard NoRel heuristic, which runs prior to the root relaxation on a fixed budget (time, work, etc.).

Running the NoRel heuristic this way can be useful for models in which solving LP relaxations and processing search tree nodes is not too hard, but still finding high-quality solutions turns out to be difficult. Moreover, it can be useful for situations in which a tight time limit is in play and the goal is to find a solution within this time frame that is as good as possible.

You can control the effort spent in NoRel during the tree search through the newly introduced parameter NoRelTreeHeur. The existing NoRel heuristic and its controlling parameters are not influenced by this setting. Also, the NoRel tree heuristic is activated automatically if the high-level optimization strategy is set to emphasize finding feasible solutions (MIPFocus=1).

While activating this heuristic promotes finding high-quality solutions, the time for proving optimality of the solution may increase.

PDHG-Based MIP Heuristic#

In situations where the initial root node LP relaxation of a MIP takes a significant amount of time, you can try to use a newly added PDHG-based MIP heuristic. It runs prior to the solution of the root node LP relaxation and can compute high-quality MIP solutions based on relatively cheap PDHG iterations on the LP relaxation of the underlying MIP. Upon completion of this heuristic, the standard solve process follows suit, taking advantage of any incumbent solution that the PDHG-based MIP heuristic may have found.

You can use the parameters PDHGMIPHeurTime and PDHGMIPHeurWork to limit the time and work spent in this heuristic, and PDHGMIPHeurSolutions to stop the heuristic as soon as it has found the specified number of solutions. Note that this heuristic may also stop before it reaches any of the specified limits.

This heuristic can also benefit from GPU acceleration by running PDHG on the GPU; you can control this behavior through the PDHGGPU parameter.

PDHG Concurrent Crossover#

When solving an LP with PDHG, it is usually combined with a crossover step to eventually return a basic LP solution. Starting with Gurobi 14, multiple crossover threads run concurrently with the PDHG iterations, often reducing the total run time until an optimal basic solution is found.

Through the newly added parameter PDHGEarlyCrossover you can control how early into the PDHG iterations the concurrent crossover phase is started. Concurrent crossover is the new default. You can disable this new feature by setting the parameter to 0, reverting to the behavior of Gurobi 13.

Nonlinear Constraints and Objective#

Gurobi 14 introduces Nonlinear Constraints as a first-class modeling entity throughout the product. Unlike for the existing General Nonlinear constraints (which are deprecated in Gurobi 14), you can set constraint senses and right-hand side values through a set of newly added Nonlinear Constraint Attributes.

You can add, query, or delete nonlinear constraints by means of the following functions and methods:

A new nonlinear constraint object class (GRBNLConstr) has been added to the Python, C++, Java, and .NET APIs. Specific nonlinear attributes can be queried and set on these objects using the standard get/set methods.

Similarly you can now directly specify a nonlinear objective. New methods allow setting, querying, and deleting a nonlinear objective function specified as an expression tree:

For details on the expression tree format, refer to Expression Trees. For details on nonlinear objectives, refer to Nonlinear Objectives.

Expression-based nonlinear modeling in .NET#

When using C# or Visual Basic you can now use expression-based modeling patterns to build nonlinear constraints or objective functions. For example, if x and y are GRBVar objects, then Sqrt(x), x / y, Log(x) * x, and x * x * x all become GRBNLExpr objects. Operations that have no corresponding C# operator (e.g., Sqrt, Log, Logistic) are provided as static factory methods on this class.

Changes in gurobipy#

Nonlinear API#

gurobipy adopts the new Nonlinear Constraints type in version 14. In particular:

For example, you can add a constraint \(\tanh(x) \geq 0.1\) to a model by doing:

model.addConstr(nlfunc.tanh(x) >= 0.1)

If you are upgrading from a previous version, note that the constraint type returned by Model.addConstr when applied to nonlinear expression arguments will change. For example, in previous versions the following code:

nlc = model.addConstr(y == nlfunc.sin(x))

created a general nonlinear constraint of the form y = sin(x), and returned a GenConstr (or MGenConstr) object. In version 14 this code creates an equivalent nonlinear constraint of the form y - sin(x) == 0, and returns an NLConstr (or MNLConstr) object. The underlying model is slightly different, and the returned object has a different set of attributes.

We generally recommend using Model.setObjective and Model.addConstr to build nonlinear models. The API will create the appropriate constraint or objective type for the provided expression.

For more fine-grained control over nonlinear constraints, you can use:

For more fine-grained control over the separate quadratic and nonlinear components of the objective function, you can use:

Other Changes#

  • Model.cbUseSolution now returns GRB.UNDEFINED instead of GRB.INFINITY if no improved solution is found or the method has been called from GRB.Callback.MIP or GRB.Callback.MIPSOL. Recall that setting a solution within a GRB.Callback.MIP or GRB.Callback.MIPSOL callback only buffers the solution and processes it later. Therefore, when calling Model.cbUseSolution in these cases, the solution cannot be checked for feasibility, and no objective value can be returned.

  • All methods that take a file path as an argument now also accept a pathlib.Path object (or any os.PathLike type).

  • gurobipy now only installs a signal handler to catch CTRL-C interrupts for optimizations started from the main thread, matching Python’s own behavior. This avoids overriding Python’s signal handler when the optimizer is run on a background thread.

Changes to Other APIs#

  • GRBcbsolution now returns GRB_UNDEFINED instead of GRB_INFINITY if no improved solution is found or the routine has been called from a callback other than GRB_CB_MIPNODE. Recall that setting a solution within a GRB_CB_MIP or GRB_CB_MIPSOL callback only buffers the solution and processes it later. Therefore, the solution cannot be checked for feasibility and no objective value can be returned. Similar adjustments were made for C++, .NET, and Java.

  • Java objects GRBEnv, GRBModel, and GRBBatch now implement the AutoCloseable interface.

Other Notable Changes#

  • A new parameter OACuts was introduced to control generation of outer approximation cuts.

  • An MPS or LP file written by Gurobi now contains a comment “Note: variable lower bounds are 0 unless specified otherwise” in the Bounds section.

  • Two new parameters NLBarInitMu and NLBarStartPush were introduced to control the initial behavior of the NL barrier algorithm.

  • Default value for NLBarIterLimit was increased from 1000 to 10000.

  • When performing another presolve in a MIP solve, Gurobi now also prints the presolved model size after that additional presolve. So, a log could now look as follows with the additional “Presolved:” and “Variable types:” lines at the end:

    Optimize a model with 143787 rows, 12502 columns and 358516 nonzeros (Max)
    Model fingerprint: 0xcc9adb3f
    
    Model has 605 linear objective coefficients
    Variable types: 0 continuous, 12502 integer (12502 binary)
    Coefficient statistics:
      Matrix range     [1e+00, 4e+01]
      Objective range  [1e+00, 4e+01]
      Bounds range     [1e+00, 1e+00]
      RHS range        [1e+00, 5e+03]
    
    Presolve removed 140063 rows and 11165 columns
    Presolve time: 0.07s
    Presolved: 3724 rows, 1337 columns, 12576 nonzeros
    Variable types: 0 continuous, 1337 integer (1337 binary)
    Performing another presolve...
    Presolve removed 3091 rows and 83 columns
    Presolve time: 0.02s
    Presolved: 633 rows, 1254 columns, 5009 nonzeros
    Variable types: 0 continuous, 1254 integer (1254 binary)
    
  • Gurobi would now use lbzip2 to compress and uncompress *.bz2 files, if it finds this binary in the PATH. This tool uses parallel threads and is often much faster than bzip2.

  • The special meaning of value 1 for the SolutionLimit parameter has been removed. Previously, value 1 implicitly activated some additional heuristics that are good for finding a first feasible solution. This is now no longer the case. We decided that it is more important that any limit parameter, such as TimeLimit or NodeLimit, can only change the solution path at the moment when the limit is hit. From now on, setting SolutionLimit to 1 will not cause any change to the solution path either. In order to get closer to the behavior of previous Gurobi versions, you can activate these additional heuristics by setting the MIPFocus parameter to 1.

  • A new IsConvex attribute has been added to indicate whether the most recent optimization found the objective and constraints to be convex after presolve.

  • A new IsNLP attribute has been added to indicate whether the model contains any nonlinear constraint or objective.

  • The Gurobi Optimizer’s capacity to detect convexity has been extended to nonlinear models in some cases.

  • The new attributes PreCrossoverStatus, PreCrossoverX, and PreCrossoverPi are the preferred aliases for the deprecated attributes BarStatus, BarX, and BarPi. This name change clarifies that the attributes apply to any pre-crossover algorithm (both barrier and PDHG).

  • The --printquality option of gurobi_cl now prints primal and dual residuals for continuous models in addition to violations.

  • When tuning multi-objective models, you can now use the MIP gap as TuneCriterion. If a multi-objective model cannot be solved to optimality within the specified time limit, the tuner first compares parameter settings based on the number of objective passes that remain unsolved. If multiple settings leave the same number of objective passes unsolved, the tuner uses the MIP gap as a secondary criterion and favors the setting with the smaller gap.

  • Setting ConcurrentMethod to 4 when using the concurrent LP solver now runs PDHG, dual simplex, and primal simplex.

Changes in Parameter Inheritance#

When creating a concurrent environment or a multi-objective environment all parameters are left at their default value, instead of their value being copied from the model environment. In addition, the automatic setting of the InheritParams parameter changed from 0 (don’t inherit) to 1 (do inherit). This change means that it no longer matters whether parameters in the model environment are changed before or after the supporting environment is created, as long as they are changed before the optimization is started. Refer to Inheritance of Parameter Values for more details.

Local optimization applicability#

With the introduction of the new nonlinear constraint API the support for General Nonlinear Constraints in local optimization (see OptimalityTarget parameter) has been removed.

Deprecated functionality#

If you are upgrading from a previous version of Gurobi, we recommend first running your code with Gurobi 13 and warnings enabled to catch deprecations in gurobipy. Fixing these deprecated usages will help to keep compatibility for Gurobi 14 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 14, the following usage is deprecated and will be removed in a future version:

Removal of deprecated functionality#

Removals from gurobipy#

  • Wildcard matching of file paths in the read and Model.read methods has been removed.