x = model.addVar()
y = model.addVar()
expr = x + x + y
model.setObjectiveN(expr, 0)
incorrectly sets the first objective to \(x + y\). A workaround, if you
cannot ensure that like terms are collected in the expression passed to
setObjectiveN, is to create an intermediate variable to use as the
objective:
x = model.addVar()
y = model.addVar()
z = model.addVar(lb=-GRB.INFINITY)
expr = x + x + y
model.addConstr(z == expr)
model.setObjectiveN(z, 0)
Missing symbols in shared library libgurobi120
Fixed in version 12.0.1 and later
Exported symbols for the C functions GRBloadenv and
GRBemptyenv are missing from the shared libraries
libgurobi120.so, libgurobi120.dll and libgurobi120.dylib.
In order to safeguard applications against accidental use of incompatible
version combinations of Gurobi header and library, these functions are provided
in Gurobi 12.0.0 only as version-aware header defines by including the C header
gurobi_c.h. Most applications include this header file and hence are
unaffected by this issue. But trying to load symbols for these two functions
directly from the library, (e.g., through dlsym, Python’s ctypes
module, or any other language’s FFI) will result in an error, reporting that
the symbols cannot be found.
The symbols are restored in version 12.0.1 and later. As a workaround for
version 12.0.0, please change your application code to use the analogous but
undocumented functions
int GRBloadenvinternal(GRBenv **envP, const char *logfile,
int major, int minor, int tech);
int GRBemptyenvinternal(GRBenv **envP, int major, int minor, int tech);
while supplying the values 12, 0 and 0 for the three additional
parameters appearing in these signatures. For example, in plain C code you
would call these functions like this:
GRBenv *env = NULL;
int error = 0;
error = GRBloadenvinternal(&env, "", 12, 0, 0);
GRBenv *env = NULL;
int error = 0;
error = GRBemptyenvinternal(&env, 12, 0, 0);
Other issues
Fixed in version 12.0.1 and later
The file ReleaseNotes.html in the root directory of the
distribution incorrectly refers to the 12.0.0 version as beta3.
In gurobipy, some invalid usages of Model.addConstr for nonlinear
constraints create a trivially infeasible model, instead of raising an
exception when the constraint is added. For example:
import gurobipy as gp
env = gp.Env()
model = gp.Model(env=env)
x = model.addVar()
model.addConstr(x ** 3 == 1) # Should raise an exception
model.optimize() # Results in INFEASIBLE status
12.0.1 and later releases raise an exception for this invalid addConstr call.
Some multi-objective models may trigger an undocumented error with code 20000.
This issue is fixed in 12.0.1 and later. For version 12.0.0, you should set
MultiObjPre=0 to work around this issue.